Learn R Programming

klin (version 2007-02-05)

klin.ls: Solves a least squares problem where the matrix is a Kronecker product

Description

Computes the least squares estimate x which minimizes the Euclidian norm of A %x% x - b, where A is a Kronecker product of matrices.

Usage

klin.ls(A, b)

Arguments

A
A list that contains the matrices, preferably of class Matrix, or a list of class klin.prepls (see Details).
b
A conformable numeric vector.

Value

A numeric vector.

Details

The matrices in the list A should be of the class Matrix. This allows the user to take advantage of their special structure (eg sparsity).

This function is just glue for klin.preparels and klin.solve. If you are using the same A multiple times, it is suggested that you call klin.preparels and save the result. This allows Matrix to memoize the factors of crossprod(A[[i]]) where needed.

References

Paul E. Buis and Wayne R. Dyksen. Efficient Vector and Parallel Manipulation of Tensor Products. ACM Transactions on Mathematical Software, Vol. 22, No. 1, March 1996, Pages 18--23.

See Also

klin.eval, klin.solve, klin.preparels, klin.klist.

Examples

Run this code
## 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
x <- klin.ls(A,b)

Run the code above in your browser using DataLab