A select few functions to make constructing and calculating the determinant of tridiagnonal matrices more efficient.

tridiag(a, b, c)

det.tridiag(x)

Arguments

a

A vector of size n, whose entries will form a diagonal. No default value.

b

A vector of size n-1, whose entries will form a sub-diagonal. No default value.

c

A vector of size n-1, whose entries will form a super-diagonal. Defaults is c = b.

x

A square matrix.

Details

To be completed later.

Examples

tridiag(c(1, 2, 3, 4), c(5, 6, 7), c(8, 9, 10))
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    8    0    0
#> [2,]    5    2    9    0
#> [3,]    0    6    3   10
#> [4,]    0    0    7    4
tridiag(c(1, 2, 3), c(4, 5), c(6, 7))
#>      [,1] [,2] [,3]
#> [1,]    1    6    0
#> [2,]    4    2    7
#> [3,]    0    5    3