CommutatorMatr {MultiStatM}R Documentation

Commutator Matrix

Description

This function generates various types of commutator matrices.

Usage

CommutatorMatr(Type, ...)

Arguments

Type

A string specifying the type of commutator matrix. Choices are "Kmn", "Kperm", "Mixing", or "Moment".

...

Additional arguments specific to the type of commutator matrix (see Details).

Details

The function CommutatorMatr supports the following types of commutator matrices:

Kmn

Description: Transforms vec(A) to vec(A^T), where A^T is the transpose of matrix A. An option for sparse matrix is provided. By default, a non-sparse matrix is produced. Using sparse matrices increases computation times but requires far less memory. Arguments:

m (integer)

Number of rows of the first matrix.

n (integer)

Number of columns of the first matrix.

useSparse (logical, optional)

If TRUE, returns a sparse matrix. Default is FALSE.

Kperm

Description: Generates a commutation matrix for a specified permutation of matrix dimensions. An option for sparse matrix is provided. By default, a non-sparse matrix is produced. Using sparse matrices increases computation times but requires far less memory. Arguments:

perm (integer vector)

The permutation vector.

dims (integer vector)

The dimensions of the matrices involved.

useSparse (logical, optional)

If TRUE, returns a sparse matrix. Default is FALSE.

Mixing

Description: Generates the Mixing commutation matrix used in linear algebra transformations involving tensor products. An option for sparse matrix is provided. By default, a non-sparse matrix is produced. Using sparse matrices increases computation times but requires far less memory. Arguments:

d1 (integer vector)

Dimensions of the first set.

d2 (integer vector)

Dimensions of the second set.

useSparse (logical, optional)

If TRUE, returns a sparse matrix. Default is FALSE.

Moment

Description: Generates the Moment commutation matrix based on partitioning of moments. An option for sparse matrix is provided. By default, a non-sparse matrix is produced. Using sparse matrices increases computation times but requires far less memory. Arguments:

el_rm (integer vector)

Elements of the partition.

d (integer)

Dimension of the partition.

useSparse (logical, optional)

If TRUE, returns a sparse matrix. Default is FALSE.

Value

Depending on the type:

Kmn

A commutation matrix of dimension mn \times mn. If useSparse=TRUE, an object of class "dgCMatrix" is produced.

Kperm

A square permutation matrix of size prod(dims). If useSparse=TRUE, an object of class "dgCMatrix" is produced.

Mixing

A square matrix of dimension prod(d1) * prod(d2). If useSparse=TRUE, an object of class "dgCMatrix" is produced.

Moment

A commutator matrix for moment formulae.

See Also

Other Commutators: CommutatorIndx()

Examples

# Example for Kmn
CommutatorMatr("Kmn", m = 3, n = 2)

# Example for Kperm
dims <- c(2, 3, 2)
perm <- c(1, 3, 2)
CommutatorMatr("Kperm", perm = perm, dims = dims)

# Example for Mixing
d1 <- c(2, 3, 2)
d2 <- c(3, 2, 2)
CommutatorMatr("Mixing", d1 = d1, d2 = d2)

# Example for Moment
n <- 4
r <- 2
m <- 1
d <- 2
PTA <- PartitionTypeAll(n)
el_r <- PTA$eL_r[[r]][m,]
CommutatorMatr("Moment", el_r = el_r, d = d)

[Package MultiStatM version 2.0.0 Index]