squareform#

hypercoil.functional.matrix.squareform(X: Tensor) Tensor[source]#

Convert between symmetric matrix and vector forms.

Warning

Unlike numpy or matlab implementations, this does not verify a conformant input.

Parameters:
Xtensor

Block of symmetric matrices, in either square matrix or vectorised form.

Returns:
tensor

If the input block is in square matrix form, returns it in vector form. If the input block is in vector form, returns it in square matrix form.