<a id="skfolio-prior-covariancesqrt"></a>

# skfolio.prior.CovarianceSqrt

<a id="skfolio.prior.CovarianceSqrt"></a>

### *class* skfolio.prior.CovarianceSqrt(components=(), diagonal=None)

Matrix square root decomposition of a covariance matrix.

Encodes $\Sigma = \sum_i A_i A_i^\top + \operatorname{diag}(d)^2$ in a form
suitable for second-order cone (SOC) constraints:

$$
\left\lVert
\begin{pmatrix}
    A_1^\top w \\
    \vdots \\
    A_m^\top w \\
    d \odot w
\end{pmatrix}
\right\rVert_2
\le v
\;\Longleftrightarrow\;
w^\top \Sigma\, w \le v^2
$$

This representation avoids forming a full $(n \times n)$ Cholesky factor when
the covariance has lower-dimensional components and a diagonal component.

* **Attributes:**
  **components** *tuple of ndarray of shape (n, k_i)*
  : Matrices $A_i$ of shape $(n, k_i)$ contributing
    $\sum_i A_i A_i^\top$ to the covariance.

  **diagonal** *ndarray of shape (n,) or None*
  : Vector $d$ contributing $\operatorname{diag}(d)^2$ to the
    covariance.

