diag_ind: Make vector of 1-dimensional diagonal indices for square...

View source: R/lib.R

diag_indR Documentation

Make vector of 1-dimensional diagonal indices for square matrix

Description

Compute vector of indices for efficient access to diagonal of a square matrix

Usage

diag_ind(n)

Arguments

n

integer dimension of (square) matrix

Value

integer vector of length n with indices (unidimensional) of square matrix

See Also

diag_mat

Examples

ind <- diag_ind(5)
diag_mat(seq(5))[ind]

awblocker/networkTomography documentation built on May 14, 2022, 10:05 p.m.