Learn R Programming

SuperGauss (version 1.0.2)

Toeplitz-class: Constructor and methods for Toeplitz matrix objects.

Description

The Toeplitz class contains efficient methods for linear algebra with symmetric positive definite (i.e., variance) Toeplitz matrices.

Usage

Toeplitz(n, acf)

Arguments

n

Size of the Toeplitz matrix.

acf

Autocorrelation vector of Toeplitz matrix.

Value

A Toeplitz object.

Methods

If Toep is a Toeplitz object with first row/column given by acf, then:

Toep$setAcf(acf)

Sets the autocorrelation of the matrix.

Toep$getAcf()

Gets the autocorrelation of the matrix.

nrow(Toep), ncol(Toep), dim(Toep)

Selected dimension(s) of the matrix.

Toep %*% X, X %*% Toep

Toeplitz-Matrix and Matrix-Toeplitz multiplication. Also works if X is a vector.

solve(Toep, X), solve(Toep)

Solves Toeplitz systems of equations. When second argument is missing, returns the inverse of the Toeplitz matrix.

determinant(Toep)

Log-determinant of the Toeplitz matrix, i.e., same thing as log(det(toeplitz(acf))).

Toep$traceT2(acf2)

If T1 == toeplitz(acf) and T2 == toeplitz(acf2), computes the trace of solve(T1, T2). This is used in the computation of the gradient of Gaussian likelihoods with Toeplitz variance matrix.

Toep$traceT4(acf2, acf3)

If T1 == toeplitz(acf), T2 == toeplitz(acf2), and T3 == toeplitz(acf3), computes the trace of solve(T1, T2) %*% solve(T1, T3). This is used in the computation of the Hessian of Gaussian likelihoods with Toeplitz variance matrix.

Details

It is assumed that the autocorrelation of the Toeplitz object defines a valid (i.e., positive definite) variance matrix. The multiplication algorithms still work when this is not the case but the other algorithms do not (return values typically contain NaNs).

Examples

Run this code
# NOT RUN {
# construction
acf <- exp(-(1:5))
Toep <- Toeplitz(acf = acf)
# alternatively, can allocate space first
Toep <- Toeplitz(n = length(acf))
Toep$setAcf(acf = acf)

dim(Toep) # == c(nrow(Toep), ncol(Toep))
Toep # show method
Toep$getAcf() # extract the acf

# linear algebra
X <- matrix(rnorm(10), 5, 2)
Toep %*% X
t(X) %*% Toep
solve(Toep, X)
determinant(Toep) # log-determinant
# }

Run the code above in your browser using DataLab