BinaryOpPolicy.h

Go to the documentation of this file.
00001 // @(#)root/smatrix:$Id: BinaryOpPolicy.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Authors: J. Palacios    2006  
00003 #ifndef ROOT_Math_BinaryOpPolicy 
00004 #define ROOT_Math_BinaryOpPolicy 1
00005 
00006 // Include files
00007 
00008 /** @class BinaryOpPolicy BinaryOpPolicy.h Math/BinaryOpPolicy.h
00009  *  
00010  *
00011  *  @author Juan PALACIOS
00012  *  @date   2006-01-10
00013  *
00014  *  Classes to define matrix representation binary combination policy.
00015  *  At the moment deals with symmetric and generic representation, and
00016  *  establishes policies for multiplication (and division) and addition
00017  *  (and subtraction)
00018  */
00019 
00020 
00021 #ifndef ROOT_Math_MatrixRepresentationsStatic
00022 #include "Math/MatrixRepresentationsStatic.h"
00023 #endif
00024 
00025 namespace ROOT { 
00026 
00027   namespace Math {
00028 
00029     /**
00030        matrix-matrix multiplication policy
00031      */
00032     template <class T, class R1, class R2>
00033     struct MultPolicy
00034     {
00035       enum { 
00036         N1 = R1::kRows,
00037         N2 = R2::kCols
00038       };
00039       typedef MatRepStd<T, N1, N2> RepType;
00040     };
00041 
00042     /**
00043        matrix addition policy
00044      */
00045     template <class T, unsigned int D1, unsigned int D2, class R1, class R2>
00046     struct AddPolicy
00047     {
00048       enum { 
00049         N1 = R1::kRows,
00050         N2 = R1::kCols
00051       };
00052       typedef MatRepStd<typename R1::value_type, N1, N2 > RepType;  
00053     };
00054 
00055     template <class T, unsigned int D1, unsigned int D2>
00056     struct AddPolicy<T, D1, D2, MatRepSym<T,D1>, MatRepSym<T,D1> >
00057     {
00058       typedef  MatRepSym<T,D1> RepType;
00059     };
00060 
00061     /**
00062        matrix transpose policy
00063      */
00064     template <class T, unsigned int D1, unsigned int D2, class R>
00065     struct TranspPolicy
00066     {
00067       enum { 
00068         N1 = R::kRows,
00069         N2 = R::kCols
00070       };
00071       typedef MatRepStd<T, N2, N1> RepType;
00072     };
00073     // specialized case of transpose of sym matrices
00074     template <class T, unsigned int D1, unsigned int D2>
00075     struct TranspPolicy<T, D1, D2, MatRepSym<T,D1> > 
00076     {
00077       typedef MatRepSym<T, D1> RepType;
00078     };
00079   }  // namespace Math
00080   
00081 }  // namespace ROOT
00082 
00083 #endif // MATH_BINARYOPPOLICY_H

Generated on Tue Jul 5 14:25:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1