klin.preparels: Prepares matrices for the least squares solver In klin: Linear equations with Kronecker structure

Description

You should use this function whenever you are calling klin.ls repeatedly with the same matrices.

Usage

 1 klin.preparels(A) 

Arguments

 A A list that contains the matrices, preferably of class Matrix.

Details

To compute the least squares estimate, we are solving

(A_1 \times A_2 … \times A_K)^T (A_1 \times A_2 \times … \times A_K) = (A_1 \times A_2 \times … \times A_K)^T b

However, for square A_i matrices, one can premultiply both sides by the Kronecker product of the inverse of $A_i^T$ (in the corresponding place) and identity matrices, making the problem simpler.

klin.prepls calculates the matrices needed on both sides, but does not evaluate the Kronecker product.

Value

A list of class klin.prepls, contains matrices for the left and right hand side.

Author(s)

Tamas K Papp <[email protected]>

See Also

klin.eval, klin.solve, klin.ls, klin.klist.

Examples

 1 2 3 4 5 6 7 8 9 ## dimensions n <- c(2,4,3) m <- n+c(1,0,2) # we need m >= n ## make random matrices A <- lapply(seq_along(n), function(i) Matrix(rnorm(m[i]*n[i]),m[i],n[i])) b <- rnorm(prod(m)) # make random b prepA <- klin.preparels(A) x <- klin.ls(prepA,b) 

klin documentation built on May 30, 2017, 4:08 a.m.