Learn R Programming

networkTomography (version 0.3)

diag_mat: Make diagonal matrix from vector

Description

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

Usage

diag_mat(x)

Arguments

x
numeric vector for diagonal

Value

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

See Also

diag_ind

Examples

Run this code
diag_mat(seq(5))

Run the code above in your browser using DataLab