Belle II Software  release-08-01-10
CovarianceMatrixUtil Struct Reference

Collection of functions related to covariance matrices. More...

#include <CovarianceMatrixUtil.h>

Static Public Member Functions

template<int N>
static CovarianceMatrix< N > identity ()
 Constructs an identity matrix.
 
template<int N>
static void transport (const JacobianMatrix< N, N > &jacobian, CovarianceMatrix< N > &cov)
 Transport the covariance matrix inplace with the given jacobian matrix.
 
template<int M, int N>
static CovarianceMatrix< M > transported (const JacobianMatrix< M, N > &jacobian, const CovarianceMatrix< N > &cov)
 Return a copy of the covariance matrix transported with the given jacobian matrix.
 
template<int N>
static void scale (const ParameterVector< N > &scales, CovarianceMatrix< N > &cov)
 Scale the covariance inplace by the given factors in each parameter.
 
template<int N>
static CovarianceMatrix< N > scale (const ParameterVector< N > &scales, const CovarianceMatrix< N > &cov)
 Return a copy of the covariance scaled by the given factors in each parameter.
 
template<int N1, int N2>
static CovarianceMatrix< N1+N2 > stackBlocks (const CovarianceMatrix< N1 > &block1, const CovarianceMatrix< N2 > &block2)
 Combines two covariance matrices by putting them in two blocks on the diagonal of a larger matrix.
 
template<class ACovarianceMatrix , int I = 0, int N = 0>
static ACovarianceMatrix getSub (const CovarianceMatrix< N > &cov)
 Gets a subcovariance from a covariance matrix.
 
template<int N>
static CovarianceMatrix< N > fromPrecision (const PrecisionMatrix< N > &prec)
 Convert precision matrix to covariance matrix - allows for reduced rank.
 
template<int N>
static PrecisionMatrix< N > toPrecision (const CovarianceMatrix< N > &cov)
 Convert covariance matrix to precision matrix - allows for reduced rank.
 
template<int N>
static CovarianceMatrix< N > fromFullPrecision (const PrecisionMatrix< N > &prec)
 Convert covariance matrix to precision matrix - assumes full rank.
 
template<int N>
static PrecisionMatrix< N > fullToPrecision (const CovarianceMatrix< N > &cov)
 Convert precision matrix to covariance matrix - assumes full rank.
 
template<int N>
static double average (const ParameterVector< N > &par1, const CovarianceMatrix< N > &cov1, const ParameterVector< N > &par2, const CovarianceMatrix< N > &cov2, ParameterVector< N > &par, CovarianceMatrix< N > &cov)
 Averages two parameter vectors taking into account their respective covariances. More...
 
template<int M, int N1>
static double average (const ParameterVector< N1 > &par1, const CovarianceMatrix< N1 > &cov1, const JacobianMatrix< N1, M > &ambiguity1, const ParameterVector< M > &par2, const CovarianceMatrix< M > &cov2, ParameterVector< M > &par, CovarianceMatrix< M > &cov)
 Averages two parameter vectors, one being from a projected space, taking into account their respective covariances and the ambiguity of the projection to the actual state. More...
 
template<int M, int N1, int N2>
static double average (const ParameterVector< N1 > &par1, const CovarianceMatrix< N1 > &cov1, const JacobianMatrix< N1, M > &ambiguity1, const ParameterVector< N2 > &par2, const CovarianceMatrix< N2 > &cov2, const JacobianMatrix< N2, M > &ambiguity2, ParameterVector< M > &par, CovarianceMatrix< M > &cov)
 Averages two parameter vectors from a projected space taking into account their respective covariances and ambiguity matrices. More...
 
template<int M, int N1>
static double kalmanUpdate (const ParameterVector< N1 > &par1, const CovarianceMatrix< N1 > &cov1, const JacobianMatrix< N1, M > &ambiguity1, ParameterVector< M > &par2, CovarianceMatrix< M > &cov2)
 Updates a parameter and its covariance by integrating information from parameter vector in a projected space and its covariances. More...
 

Detailed Description

Collection of functions related to covariance matrices.

Definition at line 36 of file CovarianceMatrixUtil.h.

Member Function Documentation

◆ average() [1/3]

static double average ( const ParameterVector< N > &  par1,
const CovarianceMatrix< N > &  cov1,
const ParameterVector< N > &  par2,
const CovarianceMatrix< N > &  cov2,
ParameterVector< N > &  par,
CovarianceMatrix< N > &  cov 
)
inlinestatic

Averages two parameter vectors taking into account their respective covariances.

Parameters
par1First parameters
cov1Covariance matrix to the first parameters
par2Second parameters
cov2Covariance matrix to the second parameters
[out]parAveraged parameters
[out]covAveraged covariance matrix
Returns
Chi square deviation of orignal parameters to the average

Definition at line 146 of file CovarianceMatrixUtil.h.

152  {
153  PrecisionMatrix<N> precision1 = toPrecision(cov1);
154  PrecisionMatrix<N> precision2 = toPrecision(cov2);
155  PrecisionMatrix<N> precision;
156  double chi2 =
157  PrecisionMatrixUtil::average(par1, precision1, par2, precision2, par, precision);
158  cov = fromPrecision(precision);
159  return chi2;
160  }
static CovarianceMatrix< N > fromPrecision(const PrecisionMatrix< N > &prec)
Convert precision matrix to covariance matrix - allows for reduced rank.
static PrecisionMatrix< N > toPrecision(const CovarianceMatrix< N > &cov)
Convert covariance matrix to precision matrix - allows for reduced rank.
static double average(const ParameterVector< N > &parameter1, const PrecisionMatrix< N > &precision1, const ParameterVector< N > &parameter2, const PrecisionMatrix< N > &precision2, ParameterVector< N > &parameter, PrecisionMatrix< N > &precision)
Averages two parameter vectors taking into account their respective precision.

◆ average() [2/3]

static double average ( const ParameterVector< N1 > &  par1,
const CovarianceMatrix< N1 > &  cov1,
const JacobianMatrix< N1, M > &  ambiguity1,
const ParameterVector< M > &  par2,
const CovarianceMatrix< M > &  cov2,
ParameterVector< M > &  par,
CovarianceMatrix< M > &  cov 
)
inlinestatic

Averages two parameter vectors, one being from a projected space, taking into account their respective covariances and the ambiguity of the projection to the actual state.

Parameters
par1First parameters
cov1Covariance matrix to the first parameters
ambiguity1Projection ambiguity of the first parameters
par2Second parameters
cov2Covariance matrix to the second parameters
[out]parAveraged parameters
[out]covAveraged covariance matrix
Returns
Chi square deviation of orignal parameters to the average

Definition at line 177 of file CovarianceMatrixUtil.h.

◆ average() [3/3]

static double average ( const ParameterVector< N1 > &  par1,
const CovarianceMatrix< N1 > &  cov1,
const JacobianMatrix< N1, M > &  ambiguity1,
const ParameterVector< N2 > &  par2,
const CovarianceMatrix< N2 > &  cov2,
const JacobianMatrix< N2, M > &  ambiguity2,
ParameterVector< M > &  par,
CovarianceMatrix< M > &  cov 
)
inlinestatic

Averages two parameter vectors from a projected space taking into account their respective covariances and ambiguity matrices.

Parameters
par1First parameters
cov1Covariance matrix to the first parameters
ambiguity1Projection ambiguity of the first parameters
par2Second parameters
cov2Covariance matrix to the second parameters
ambiguity2Projection ambiguity of the second parameters
[out]parAveraged parameters
[out]covAveraged covariance matrix
Returns
Chi square deviation of original parameters to the average

Definition at line 210 of file CovarianceMatrixUtil.h.

◆ kalmanUpdate()

static double kalmanUpdate ( const ParameterVector< N1 > &  par1,
const CovarianceMatrix< N1 > &  cov1,
const JacobianMatrix< N1, M > &  ambiguity1,
ParameterVector< M > &  par2,
CovarianceMatrix< M > &  cov2 
)
inlinestatic

Updates a parameter and its covariance by integrating information from parameter vector in a projected space and its covariances.

The update is expressed in terms of Kalman's equations.

This function updates the values of the second parameters in place.

Parameters
par1First parameters
cov1Covariance matrix to the first parameters
ambiguity1Projection ambiguity of the first parameters
[in,out]par2Second parameters - updated inplace
[in,out]cov2Second covariance matrix - updated inplace
Returns
Chi square deviation of orignal parameters to the average

Definition at line 249 of file CovarianceMatrixUtil.h.


The documentation for this struct was generated from the following file: