scipy.spatial.distance.squareform(X, force='no', checks=True)

Converts a vector-form distance vector to a square-form distance matrix, and vice-versa.

Parameters :

X : ndarray

Either a condensed or redundant distance matrix.

Returns :

Y : ndarray

If a condensed distance matrix is passed, a redundant one is returned, or if a redundant one is passed, a condensed distance matrix is returned.

force : string

As with MATLAB(TM), if force is equal to ‘tovector’ or ‘tomatrix’, the input will be treated as a distance matrix or distance vector respectively.

checks : bool

If checks is set to False, no checks will be made for matrix symmetry nor zero diagonals. This is useful if it is known that X - X.T1 is small and diag(X) is close to zero. These values are ignored any way so they do not disrupt the squareform transformation.

Previous topic


Next topic


This Page