symmpart-methods | R Documentation |
symmpart
and skewpart
compute the symmetric and skew
symmetric parts (x + t(x))/2
and (x - t(x))/2
of a
square matrix x
. symmpart(x) + skewpart(x)
is equal
to x
for all finite square matrices x
.
symmpart(x, ...)
skewpart(x, ...)
## S4 method for signature 'denseMatrix'
symmpart(x, uplo = "U", trans = "C", ...)
## S4 method for signature 'CsparseMatrix'
symmpart(x, uplo = "U", trans = "C", ...)
## S4 method for signature 'RsparseMatrix'
symmpart(x, uplo = "U", trans = "C", ...)
## S4 method for signature 'TsparseMatrix'
symmpart(x, uplo = "U", trans = "C", ...)
## S4 method for signature 'diagonalMatrix'
symmpart(x, trans = "C", ...)
## S4 method for signature 'indMatrix'
symmpart(x, ...)
## S4 method for signature 'matrix'
symmpart(x, trans = "C", ...)
## Methods for 'skewpart' are parallel, but without 'uplo'
x |
a square matrix or |
uplo |
a character string, |
trans |
a character string, |
... |
optional arguments passed from or to other methods. |
symmpart(x)
returns a symmetric or Hermitian matrix,
inheriting from symmetricMatrix
or diagonalMatrix
if x
inherits from Matrix
.
skewpart(x)
returns a skew-symmetric or skew-Hermitian matrix,
inheriting from generalMatrix
,
symmetricMatrix
or
diagonalMatrix
if x
inherits from Matrix
.
isSymmetric
, forceSymmetric
.
m <- Matrix(1:4, 2,2)
symmpart(m)
skewpart(m)
stopifnot(all(m == symmpart(m) + skewpart(m)))
dn <- dimnames(m) <- list(row = c("r1", "r2"), col = c("var.1", "var.2"))
stopifnot(all(m == symmpart(m) + skewpart(m)))
colnames(m) <- NULL
stopifnot(all(m == symmpart(m) + skewpart(m)))
dimnames(m) <- unname(dn)
stopifnot(all(m == symmpart(m) + skewpart(m)))
## investigate the current methods:
showMethods(skewpart, include = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.