diag_mat: Make diagonal matrix from vector

Description Usage Arguments Value See Also Examples

View source: R/lib.R

Description

Build matrix with supplied vector on diagonal; this is much faster than diag due to the use of matrix instead of array

Usage

1

Arguments

x

numeric vector for diagonal

Value

matrix of size length(x) x length(x) with x along diagonal

See Also

diag_ind

Examples

1

Example output

     [,1] [,2] [,3] [,4] [,5]
[1,]    1    0    0    0    0
[2,]    0    2    0    0    0
[3,]    0    0    3    0    0
[4,]    0    0    0    4    0
[5,]    0    0    0    0    5

networkTomography documentation built on May 2, 2019, 3:28 a.m.