as.symmetric: as.symmetric

Description Usage Arguments Details Value References See Also Examples

Description

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().

Usage

1
as.symmetric(x, triangle = "u")

Arguments

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.

Details

The storage scheme is packed symmetric storage, so only the diagonal and the specified triangle are stored.

Value

A symmetric matrix.

References

http://www.netlib.org/lapack/lug/node123.html

See Also

isSym, kdim, and classes

Examples

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')

wrathematics/band documentation built on May 4, 2019, 9:48 a.m.