<a id="skfolio-utils-stats-symmetrize"></a>

# skfolio.utils.stats.symmetrize

<a id="skfolio.utils.stats.symmetrize"></a>

### skfolio.utils.stats.symmetrize(matrix, where=None)

In-place symmetrization: $M \leftarrow (M + M^T) / 2$.

When `where` is provided, only the sub-block indexed by the mask is
symmetrized, leaving the rest of the matrix untouched. This is useful for
matrices that contain NaN rows/columns where a full transpose would
propagate NaNs into the finite block.

* **Parameters:**
  **matrix** *ndarray of shape (n, n)*
  : Square matrix to symmetrize in-place.

  **where** *ndarray of shape (n,), optional*
  : Boolean mask indicating which rows/columns to include. If `None`,
    the full matrix is symmetrized.

