Description Usage Arguments Details Value References See Also Examples
Convert a regular R matrix into a packed symmetric matrix, whether or not
the input matrix was symmetric. Test for symmetry with band::isSym()
and NOT R's isSymmetric()
.
1 | as.symmetric(x, triangle = "u")
|
x |
A matrix containing numeric, integer, or logical data. |
triangle |
A single character, either "u" or "l" for upper or lower, respectively. This determines which triangle is used to create the packed storage matrix. The default is the upper triangle. Case is ignored. |
The storage scheme is packed symmetric storage, so only the diagonal and the specified triangle are stored.
A symmetric matrix.
http://www.netlib.org/lapack/lug/node123.html
1 2 3 4 5 6 | x <- matrix(1:25, nrow=5)
# use the upper triangle. note that 'x' is not symmetric, but the return is
as.symmetric(x)
# lower triangle
as.symmetric(x, 'l')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.