CMS 3D CMS Logo

Functions

GsfMatrixTools Namespace Reference

Functions

template<unsigned int N>
double trace (const ROOT::Math::SMatrix< double, N, N > &matrix)
template<typename T , unsigned int N>
double trace (ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &a, ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &b)

Function Documentation

template<unsigned int N>
double GsfMatrixTools::trace ( const ROOT::Math::SMatrix< double, N, N > &  matrix)

Definition at line 16 of file GsfMatrixTools.h.

References i, MultiGaussianStateTransform::N, and query::result.

Referenced by Genexception::dump(), main(), edm::pythonToCppException(), and pythonToCppException().

                                                             {
    double result(0.);
    for ( unsigned int i=0; i<N; i++ )  result += matrix(i,i);
    return result;
  }
template<typename T , unsigned int N>
double GsfMatrixTools::trace ( ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &  a,
ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > const &  b 
)

Definition at line 27 of file GsfMatrixTools.h.

References a, b, i, and MultiGaussianStateTransform::N.

                                                                         {
    typedef typename ROOT::Math::SMatrix<T,N,N,ROOT::Math::MatRepSym<T,N> >::const_iterator CI;
    CI i1 = a.begin();
    CI e1 = a.end();
    CI i2 = b.begin();
    //  CI e2 = b.end();
  
    T res =0;
    // sum of the lower triangle;
    for (;i1!=e1; i1++, i2++)
      res += (*i1)*(*i2);
    res *=2.;
    // remove the duplicated diagonal...
    for (unsigned int i=0;i<N;i++)
      res -= a(i,i)*b(i,i);
  return res;
  }