R語言
sdiag
位於 mgcv
包(package)。 說明
提取或修改矩陣的子對角線或上對角線。
用法
sdiag(A,k=0)
sdiag(A,k=0) <- value
參數
A |
一個矩陣 |
k |
矩陣的次(負)或超(正)對角線。 0 是主對角線。 |
value |
單個值,或與對角線長度相同的向量。 |
值
包含請求的對角線的向量,或請求的對角線替換為 value
的矩陣。
例子
require(mgcv)
A <- matrix(1:35,7,5)
A
sdiag(A,1) ## first super diagonal
sdiag(A,-1) ## first sub diagonal
sdiag(A) <- 1 ## leading diagonal set to 1
sdiag(A,3) <- c(-1,-2) ## set 3rd super diagonal
作者
Simon N. Wood simon.wood@r-project.org
相關用法
- R scat 用於重尾數據的 GAM 縮放 t 係列
- R smooth.construct.cr.smooth.spec GAM 中的懲罰三次回歸樣條
- R smooth.construct.bs.smooth.spec GAM 中的懲罰 B 樣條
- R smooth.construct GAM 中平滑項的構造函數
- R smooth.construct.sz.smooth.spec GAM 中的約束因子平滑交互
- R smooth.construct.re.smooth.spec GAM 中的簡單隨機效應
- R slanczos 計算對稱矩陣的截斷特征分解
- R single.index 具有 mgcv 的單指數模型
- R smooth.info 提供有關平滑規範的額外信息的通用函數
- R smooth2random 將平滑轉換為適合估計隨機效應的形式
- R smooth.construct.mrf.smooth.spec 馬爾可夫隨機場平滑
- R smooth.construct.gp.smooth.spec 低階高斯過程平滑
- R smooth.construct.tp.smooth.spec GAM 中的懲罰薄板回歸樣條
- R smooth.construct.ad.smooth.spec GAM 中的自適應平滑
- R smooth.construct.so.smooth.spec 皂膜平滑劑
- R smooth.construct.ds.smooth.spec 低階 Duchon 1977 樣條
- R sp.vcov 從 (RE)ML GAM 擬合中提取平滑參數估計器協方差矩陣
- R smooth.construct.fs.smooth.spec GAM 中平滑交互的因子
- R smooth.construct.ps.smooth.spec GAM 中的 P 樣條
- R smooth.construct.sos.smooth.spec 球體上的樣條線
- R smooth.construct.tensor.smooth.spec 張量積平滑構造函數
- R shash Sinh-arcsinh 位置比例和形狀模型族
- R s 在 GAM 公式中定義平滑
- R smooth.construct.t2.smooth.spec 張量積平滑構造函數
- R smoothCon GAM 平滑項的預測/構造包裝函數
注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Extract or modify diagonals of a matrix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。