Covmat¶
Attention
This is the older version of the covariance matrix calculation. If you care about getting the result, but not on the internal details consider using the CovariatedPrediction transformation instead.
Description¶
Covmat class contains three distinct trasformations used to calculate the covariance matrix.
cov transformation calculates the full covariance matrix based on statistical errors and input Jacobian.
inv transformation calculates the inverse of the input matrix.
cholesky transformation calculates Cholesky decomposition of the covariance matrix, as needed by the Chi2 transformation.
Cov transformation¶
Description¶
- Calculate the final covariance matrix based on:
statistical errors
extra systematical part based on the variation of the prediction \(\mu\) due to variation of the systematical parameters \(\eta\).
Inputs¶
'stat'
— vector with statistical errors \(S\).Derivative (Jacobian) \(D_1\) of the prediction \(\mu\) over uncertain parameter \(\eta_1\).
Derivative (Jacobian) \(D_i\) of the prediction \(\mu\) over uncertain parameter \(\eta_i\).
etc.
See Derivative
transformation. Parameters \(\eta_i\) are meant to be uncorrelated. (To be updated)
Inputs (derivatives) are processed via rank1(data)
method.
Outputs¶
'cov'
— full covariance matrix \(V\).
Outputs are frozen upon calculation.
Implementation¶
Calculates covariance matrix \(V\) in the linear approximation:
where \(V_\text{stat}\) is a diagonal matrix with \((V_\text{stat})_{ii} = S_i\).
and \(D\) is the complete Jacobian:
Considering prediction column of size \([N \times 1]\) and uncertainties vector of size \(M\) the Jacobian \(D\) dimension is \([N \times M]\) and covariance matrix \(V\) dimension is \([N \times N]\).
The calculation of \(V\) is implemented iteratively:
where \(V_0=V_\text{stat}\).
Inv transformation¶
Computes the inverse of a matrix.
Inputs¶
'cov'
— matrix \(V\).
Outputs¶
'inv'
— matrix \(V^{-1}\).
Cholesky transformation¶
Computes the Cholesky decomposition of the symmetric positive definite matrix matrix.
Inputs¶
'cov'
— matrix \(V\).
Outputs¶
'L'
— lower triangular matrix \(L\), such that \(V=LL^T\).
IMPORTANT: Be sure to use \(L\) as lower triangular matrix (use numpy.tril or triangularView<Eigen::Lower>). Upper triangular part may contain unmaintained non-zero elements.