Library: | multi |
See also: | diag xdiag |
Quantlet: | diagrv | |
Description: | replaces the diagonal of x by v |
Usage: | y = diagrv(x,v) | |
Input: | ||
x | n x p x d1 x d2 ... array of n x p matrices | |
v | np x 1 vector, where np is min(n, p) | |
Output: | ||
y | n x p x d1 x d2 ... array of n x p matrices |
library("multi") diagrv( diag( #(1, 2) ), 5|5 )
Contents of y [1,] 5 0 [2,] 0 5
library("multi") diagrv( matrix(3, 2, 2), 5|5 )
Contents of y [,,1,1,1,1,1,1] [1,] 5 1 [2,] 1 5 [3,] 1 1 [,,2,1,1,1,1,1] [1,] 5 1 [2,] 1 5 [3,] 1 1