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

Description Usage Arguments Details Value Note Author(s) References See Also Examples

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

1
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.

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.

Value

A numeric vector.

Note

The algorithm (given in the reference) is orders of magnitude more efficient (both in terms of CPU and memory usage) than computing the Kronecker product and calling crossprod and solve.

Author(s)

Tamas K Papp <tpapp@princeton.edu>

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

1
2
3
4
5
6
7
8
## 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)

klin documentation built on May 2, 2019, 1:05 p.m.