CommutatorMatr | R Documentation |
This function generates various types of commutator matrices.
CommutatorMatr(Type, ...)
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). |
The function CommutatorMatr
supports the following types of commutator matrices:
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.
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.
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.
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.
Depending on the type:
A commutation matrix of dimension mn \times mn
. If useSparse=TRUE
, an object of class "dgCMatrix" is produced.
A square permutation matrix of size prod(dims)
. If useSparse=TRUE
, an object of class "dgCMatrix" is produced.
A square matrix of dimension prod(d1) * prod(d2)
. If useSparse=TRUE
, an object of class "dgCMatrix" is produced.
A commutator matrix for moment formulae.
Other Commutators:
CommutatorIndx()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.