1 /////////////////////////////////////////////////////////////////////////////// 2 // // 3 // The Template Matrix/Vector Library for C++ was created by Mike Jarvis // 4 // Copyright (C) 1998 - 2016 // 5 // All rights reserved // 6 // // 7 // The project is hosted at https://code.google.com/p/tmv-cpp/ // 8 // where you can find the current version and current documention. // 9 // // 10 // For concerns or problems with the software, Mike may be contacted at // 11 // mike_jarvis17 [at] gmail. // 12 // // 13 // This software is licensed under a FreeBSD license. The file // 14 // TMV_LICENSE should have bee included with this distribution. // 15 // It not, you can get a copy from https://code.google.com/p/tmv-cpp/. // 16 // // 17 // Essentially, you can use this software however you want provided that // 18 // you include the TMV_LICENSE file in any distribution that uses it. // 19 // // 20 /////////////////////////////////////////////////////////////////////////////// 21 22 23 #ifndef TMV_DiagTriArithFunc_H 24 #define TMV_DiagTriArithFunc_H 25 26 #include "tmv/TMV_BaseDiagMatrix.h" 27 #include "tmv/TMV_BaseTriMatrix.h" 28 29 #define CT std::complex<T> 30 31 namespace tmv { 32 33 // C (+)= alpha * A * B 34 template <bool add, typename T, typename Ta, typename Tb> 35 void MultMM( 36 const T alpha, const GenDiagMatrix<Ta>& A, 37 const GenUpperTriMatrix<Tb>& B, UpperTriMatrixView<T> C); 38 39 template <bool add, typename T, typename Ta, typename Tb> 40 void MultMM( 41 const T alpha, const GenDiagMatrix<Ta>& A, 42 const GenLowerTriMatrix<Tb>& B, LowerTriMatrixView<T> C); 43 44 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenUpperTriMatrix<Ta> & A,const GenDiagMatrix<Tb> & B,UpperTriMatrixView<T> C)45 inline void MultMM( 46 const T alpha, const GenUpperTriMatrix<Ta>& A, 47 const GenDiagMatrix<Tb>& B, UpperTriMatrixView<T> C) 48 { MultMM<add>(alpha,B.transpose(),A.transpose(),C.transpose()); } 49 50 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenLowerTriMatrix<Ta> & A,const GenDiagMatrix<Tb> & B,LowerTriMatrixView<T> C)51 inline void MultMM( 52 const T alpha, const GenLowerTriMatrix<Ta>& A, 53 const GenDiagMatrix<Tb>& B, LowerTriMatrixView<T> C) 54 { MultMM<add>(alpha,B.transpose(),A.transpose(),C.transpose()); } 55 56 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenDiagMatrix<Ta> & A,const GenUpperTriMatrix<Tb> & B,UpperTriMatrixView<CT> C)57 inline void MultMM( 58 const T alpha, const GenDiagMatrix<Ta>& A, 59 const GenUpperTriMatrix<Tb>& B, UpperTriMatrixView<CT> C) 60 { MultMM<add>(CT(alpha),A,B,C); } 61 62 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenDiagMatrix<Ta> & A,const GenLowerTriMatrix<Tb> & B,LowerTriMatrixView<CT> C)63 inline void MultMM( 64 const T alpha, const GenDiagMatrix<Ta>& A, 65 const GenLowerTriMatrix<Tb>& B, LowerTriMatrixView<CT> C) 66 { MultMM<add>(CT(alpha),A,B,C); } 67 68 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenUpperTriMatrix<Ta> & A,const GenDiagMatrix<Tb> & B,UpperTriMatrixView<CT> C)69 inline void MultMM( 70 const T alpha, const GenUpperTriMatrix<Ta>& A, 71 const GenDiagMatrix<Tb>& B, UpperTriMatrixView<CT> C) 72 { MultMM<add>(CT(alpha),A,B,C); } 73 74 template <bool add, typename T, typename Ta, typename Tb> MultMM(const T alpha,const GenLowerTriMatrix<Ta> & A,const GenDiagMatrix<Tb> & B,LowerTriMatrixView<CT> C)75 inline void MultMM( 76 const T alpha, const GenLowerTriMatrix<Ta>& A, 77 const GenDiagMatrix<Tb>& B, LowerTriMatrixView<CT> C) 78 { MultMM<add>(CT(alpha),A,B,C); } 79 80 template <bool add, typename T, typename Ta, typename Tb> MultMM(const CT,const GenDiagMatrix<Ta> &,const GenUpperTriMatrix<Tb> &,UpperTriMatrixView<T>)81 inline void MultMM( 82 const CT , const GenDiagMatrix<Ta>& , 83 const GenUpperTriMatrix<Tb>& , UpperTriMatrixView<T> ) 84 { TMVAssert(TMV_FALSE); } 85 86 template <bool add, typename T, typename Ta, typename Tb> MultMM(const CT,const GenDiagMatrix<Ta> &,const GenLowerTriMatrix<Tb> &,LowerTriMatrixView<T>)87 inline void MultMM( 88 const CT , const GenDiagMatrix<Ta>& , 89 const GenLowerTriMatrix<Tb>& , LowerTriMatrixView<T> ) 90 { TMVAssert(TMV_FALSE); } 91 92 template <bool add, typename T, typename Ta, typename Tb> MultMM(const CT,const GenUpperTriMatrix<Ta> &,const GenDiagMatrix<Tb> &,UpperTriMatrixView<T>)93 inline void MultMM( 94 const CT , const GenUpperTriMatrix<Ta>& , 95 const GenDiagMatrix<Tb>& , UpperTriMatrixView<T> ) 96 { TMVAssert(TMV_FALSE); } 97 98 template <bool add, typename T, typename Ta, typename Tb> MultMM(const CT,const GenLowerTriMatrix<Ta> &,const GenDiagMatrix<Tb> &,LowerTriMatrixView<T>)99 inline void MultMM( 100 const CT , const GenLowerTriMatrix<Ta>& , 101 const GenDiagMatrix<Tb>& , LowerTriMatrixView<T> ) 102 { TMVAssert(TMV_FALSE); } 103 104 } // namespace tmv 105 106 #undef CT 107 108 #endif 109