- qspec.analyze. covariance_matrix ( cov=None , sigma=None , corr=None , k=None , n=None )[source]
-
Construct covariance matrices $\mathbf{\Sigma}_i\in\mathbb{R}^{n\times n}$ from standard deviations $\vec{\sigma}_i\in\mathbb{R}^n$ and correlation matrices $\mathbf{\rho}_i\in\mathbb{R}^{n\times n}$
$$ (\mathbf{\Sigma}_i)_{jk} = (\vec{\sigma}_i)_j(\vec{\sigma}_i)_k(\mathbf{\rho}_i)_{jk}. $$- Parameters:
-
- covarray_like | None
The covariance matrices $\mathbf{\Sigma}_i$. Must have shape
(k, n, n), wherekis the number of data points andnthe number of dimensions of each data point. IfNone, the other parameters are used. Else, all other parameters are ignored.- sigmaarray_like | None
The standard deviations $\vec{\sigma}_i$ of the data vectors. Must have shape
(k, n). IfNone, all diagonal elements of the covariance matrix equal 1.- corrarray_like | None
The correlation matrices $\mathbf{\rho}_i$ of the data vectors. Must have shape
(k, n, n). Ifn == 2it can have shape(k, ). IfNone, all off-diagonal elements of the covariance matrix are 0.- kint | None
The number of data points. It is ignored if
sigmaorcorris specified.- nint | None
The number of dimensions $n$ of each data point. It is ignored if
sigmaorcorris specified.
- Returns:
-
- covndarray
Covariance matrices $\mathbf{\Sigma}_i$ constructed from
sigmaandcorr.