Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:14

0001 // @(#)root/smatrix:$Id$
0002 // Authors: J. Palacios    2006
0003 #ifndef ROOT_Math_BinaryOpPolicy
0004 #define ROOT_Math_BinaryOpPolicy 1
0005 
0006 // Include files
0007 
0008 /** @class BinaryOpPolicy BinaryOpPolicy.h Math/BinaryOpPolicy.h
0009  *
0010  *
0011  *  @author Juan PALACIOS
0012  *  @date   2006-01-10
0013  *
0014  *  Classes to define matrix representation binary combination policy.
0015  *  At the moment deals with symmetric and generic representation, and
0016  *  establishes policies for multiplication (and division) and addition
0017  *  (and subtraction)
0018  */
0019 
0020 
0021 #include "Math/MatrixRepresentationsStatic.h"
0022 
0023 namespace ROOT {
0024 
0025   namespace Math {
0026 
0027     /**
0028        matrix-matrix multiplication policy
0029      */
0030     template <class T, class R1, class R2>
0031     struct MultPolicy
0032     {
0033       enum {
0034          N1 = R1::kRows,
0035          N2 = R2::kCols
0036       };
0037       typedef MatRepStd<T, N1, N2> RepType;
0038     };
0039 
0040     /**
0041        matrix addition policy
0042      */
0043     template <class T, unsigned int D1, unsigned int D2, class R1, class R2>
0044     struct AddPolicy
0045     {
0046       enum {
0047          N1 = R1::kRows,
0048          N2 = R1::kCols
0049       };
0050       typedef MatRepStd<typename R1::value_type, N1, N2 > RepType;
0051     };
0052 
0053     template <class T, unsigned int D1, unsigned int D2>
0054     struct AddPolicy<T, D1, D2, MatRepSym<T,D1>, MatRepSym<T,D1> >
0055     {
0056       typedef  MatRepSym<T,D1> RepType;
0057     };
0058 
0059     /**
0060        matrix transpose policy
0061      */
0062     template <class T, unsigned int D1, unsigned int D2, class R>
0063     struct TranspPolicy
0064     {
0065       enum {
0066          N1 = R::kRows,
0067          N2 = R::kCols
0068       };
0069       typedef MatRepStd<T, N2, N1> RepType;
0070     };
0071     // specialized case of transpose of sym matrices
0072     template <class T, unsigned int D1, unsigned int D2>
0073     struct TranspPolicy<T, D1, D2, MatRepSym<T,D1> >
0074     {
0075       typedef MatRepSym<T, D1> RepType;
0076     };
0077   }  // namespace Math
0078 
0079 }  // namespace ROOT
0080 
0081 #endif // MATH_BINARYOPPOLICY_H