band {bnbc}R Documentation

Get Band

Description

Get or set band from matrix.

Usage

band(mat, band.no)
band(mat, band.no) <- value

Arguments

mat

A matrix.

band.no

Integer specifying which matrix band. band.no = 1 retrieves the main diagonal.

value

A scalar or vector equal in length to the matrix band.

Details

A matrix band is the set of elements in a matrix from a specific off-diagonal.

Value

A matrix band in the form of a vector.

See Also

getBandIdx

Examples

mat <- matrix(1:9, 3, 3)
band(mat, band.no = 2)
mat
band(mat, band.no = 2) <- c(9,10)
mat

data(cgEx)
tact.1 <- contacts(cgEx)[[1]]
b2 <- band(tact.1, 2)
band(tact.1, 2) <- b2

[Package bnbc version 1.4.0 Index]