skbio.stats.distance.SymmetricMatrix.as_redundant#
- SymmetricMatrix.as_redundant()[source]#
Return a redundant form deep copy of the matrix.
- Returns:
- SymmetricMatrix
A new matrix object with the same data stored in redundant form.
See also
Notes
This method always returns a new matrix object, even if the matrix is already in redundant form. The new matrix object is a deep copy of the original matrix.
Examples
Convert from condensed form to redundant form:
>>> from skbio.stats.distance import SymmetricMatrix >>> sm_condensed = SymmetricMatrix([1, 2, 3], ... ids=['a', 'b', 'c'], ... condensed=True) >>> sm_condensed.data array([ 1., 2., 3.]) >>> sm_square = sm_condensed.as_redundant() >>> sm_square.data array([[ 0., 1., 2.], [ 1., 0., 3.], [ 2., 3., 0.]])