symmpart {Matrix} | R Documentation |
symmpart(x) computes the symmetric part (x + t(x))/2
and the
skew symmetric part (x - t(x))/2
of a square matrix x
.
Note that x == symmpart(x) + skewpart(x)
for all square
matrices.
symmpart(x) skewpart(x)
x |
a square matrix; either “traditional” of class
"matrix" , or typically, inheriting from the
Matrix class. |
symmpart()
returns a symmetric matrix, inheriting from
symmetricMatrix
iff x
inherited from
Matrix
.
skewpart()
returns a skew-symmetric matrix,
typically of the same class as x
(or the closest
“general” one, see generalMatrix
).
m <- Matrix(1:4, 2,2) symmpart(m) skewpart(m) stopifnot(all(m == symmpart(m) + skewpart(m)))