Learn R Programming

klin (version 2007-02-05)

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

Description

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

Usage

klin.solve(A, b)

Arguments

A
A list that contains the matrices, preferably of class Matrix.
b
A conformable numeric vector.

Value

A numeric vector x which solves the system.

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.

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

Run this code
## 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

Run the code above in your browser using DataLab