Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.connectome.sym_matrix_to_vec#

nilearn.connectome.sym_matrix_to_vec(symmetric, discard_diagonal=False)[source]#

Return the flattened lower triangular part of an array.

If diagonal is kept, diagonal elements are divided by sqrt(2) to conserve the norm.

Acts on the last two dimensions of the array if not 2-dimensional.

New in version 0.3.

Parameters
symmetricnumpy.ndarray or list of numpy arrays, shape (…, n_features, n_features)

Input array.

discard_diagonalboolean, optional

If True, the values of the diagonal are not returned. Default=False.

Returns
outputnumpy.ndarray

The output flattened lower triangular part of symmetric. Shape is (…, n_features * (n_features + 1) / 2) if discard_diagonal is False and (…, (n_features - 1) * n_features / 2) otherwise.