## Kronecker Product of Arrays

## Usage

    kronecker(X, Y, FUN="*", ...)
    X %x% Y

## Arguments

`X` | vector or array.
`Y` | vector or array.
`FUN` | a function, possibly specified as character (string).
`...` | optional arguments to be passed to `FUN`.

## Description

Computes the generalised kronecker product of two arrays, `X` and `Y`. `kronecker(X, Y)` returns an array `A` with dimensions `dim(X) * dim(Y)`.

## Details

If `X` and `Y` do not have the same number of dimensions, the smaller array is padded with dimensions of size one. `A` consists of submatrices constructed by taking `X` one term at a time and expanding that term as `FUN(x, Y, ...)`.

`%x%` is an `.Alias` for `kronecker` (where `FUN` is hardwired to `"*"`).

## Author(s)

Jonathan Rougier

## References

Shayle R. Searle (1982). Matrix Algebra Useful for Statistics; John Wiley and Sons.

## See Also

`outer` on which `kronecker` is built and `matmult` for usual matrix multiplication.

## Examples

    # simple scalar multiplication
    ( M <- matrix(1:6, ncol=2) )
    all(kronecker(4, M)==4 * M)

    ( A <- matrix(0:3, ncol=2) )
    A %x% cbind(2:3)
    # Block diagonal array:
    kronecker(diag(3), M)
    all(kronecker(diag(3), M) == diag(3) %x% M)

[Package Contents]