R/triDiag.R

Defines functions triDiag

Documented in triDiag

triDiag <- function(diagonal, upper, lower,
                    nrow = length(diagonal), ncol = nrow) {
    value <- diag(diagonal, nrow, ncol)
    R <- row(value)
    C <- col(value)
    value[C == R + 1] <- upper
    value[C == R - 1] <- lower
    value
}

Try the SoDA package in your browser

Any scripts or data that you put into this service are public.

SoDA documentation built on Oct. 28, 2020, 9:07 a.m.