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.

7.1.5. nilearn.connectome.sym_matrix_to_vec

nilearn.connectome.sym_matrix_to_vec(symmetric, discard_diagonal=False)

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:

symmetric : numpy.ndarray or list of numpy arrays, shape (…, n_features, n_features)

Input array.

discard_diagonal : boolean, optional

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

Returns:

output : numpy.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.