sym2vec
#
- hypercoil.functional.matrix.sym2vec(sym: Tensor, offset: int = 1) Tensor #
Convert a block of symmetric matrices into ravelled vector form.
Ordering in the ravelled form follows the upper triangle of the matrix block.
- Parameters:
- symtensor
Block of tensors to convert. The last two dimensions should be equal, with each slice along the final 2 axes being a square, symmetric matrix.
- offsetint (default 1)
Offset from the main diagonal where the upper triangle begins. By default, the main diagonal is not included. Set this to 0 to include the main diagonal.
- Returns:
- vectensor
Block of ravelled vectors formed from the upper triangles of the input sym, beginning with the diagonal offset from the main by the input offset.