klin.solve: Solve linear systems where the matrix is a Kronecker product

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

Description

Solves the system A %*% x == b for x given A and b, where A is a Kronecker product of matrices.

Usage

1
klin.solve(A, b)

Arguments

A

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

b

A conformable numeric vector.

Details

The matrices in the list A should be square matrices of the class Matrix. This allows the user to take advantage of their special structure (eg sparsity), also, their factors will be memoized by Matrix.

Value

A numeric vector x which solves the system.

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 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.preparels, klin.ls, klin.klist.

Examples

1
2
3
4
5
6
7
8
9
## dimensions
m <- c(4,7,2)
## make random matrices
A <- lapply(seq_along(m),
            function(i) Matrix(rnorm(m[i]^2),m[i],m[i]))
b <- rnorm(prod(m))		# make random b
x1 <- solve(klin.klist(A),b)    # brute force way
x2 <- klin.solve(A, b)          # using klin.eval
range(x1-x2)			# should be small

Example output

Loading required package: Matrix
[1] -1.953993e-14  6.972201e-14

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