/////////////////////////////////////////////////////////////////////////////// // // // The Template Matrix/Vector Library for C++ was created by Mike Jarvis // // Copyright (C) 1998 - 2016 // // All rights reserved // // // // The project is hosted at https://code.google.com/p/tmv-cpp/ // // where you can find the current version and current documention. // // // // For concerns or problems with the software, Mike may be contacted at // // mike_jarvis17 [at] gmail. // // // // This software is licensed under a FreeBSD license. The file // // TMV_LICENSE should have bee included with this distribution. // // It not, you can get a copy from https://code.google.com/p/tmv-cpp/. // // // // Essentially, you can use this software however you want provided that // // you include the TMV_LICENSE file in any distribution that uses it. // // // /////////////////////////////////////////////////////////////////////////////// #ifndef TMV_TriBandArithFunc_H #define TMV_TriBandArithFunc_H #include "tmv/TMV_BaseTriMatrix.h" #include "tmv/TMV_BaseBandMatrix.h" #include "tmv/TMV_BandMatrixArithFunc.h" #define CT std::complex namespace tmv { template inline void AddMM( const T x2, const GenUpperTriMatrix& m2, BandMatrixView m1) { if (m2.isunit()) { if (m2.size() > 1) AddMM(x2,BandMatrixViewOf(m2.offDiag()), m1.diagRange(1,m2.size())); m1.diag().addToAll(x2); } else { AddMM(x2,BandMatrixViewOf(m2),m1); } } template inline void AddMM( const T x2, const GenLowerTriMatrix& m2, BandMatrixView m1) { if (m2.isunit()) { if (m2.size() > 1) AddMM(x2,BandMatrixViewOf(m2.offDiag()), m1.diagRange(-m2.size()+1,0)); m1.diag().addToAll(x2); } else { AddMM(x2,BandMatrixViewOf(m2),m1); } } template inline void MultMM( const T x, const GenUpperTriMatrix& m1, const GenBandMatrix& m2, BandMatrixView m0) { if (m1.isunit()) { UpperTriMatrix m1x = m1; MultMM(x,BandMatrixViewOf(m1x),m2,m0); } else { MultMM(x,BandMatrixViewOf(m1),m2,m0); } } template inline void MultMM( const T x, const GenBandMatrix& m1, const GenUpperTriMatrix& m2, BandMatrixView m0) { if (m2.isunit()) { UpperTriMatrix m2x = m2; MultMM(x,m1,BandMatrixViewOf(m2x),m0); } else { MultMM(x,m1,BandMatrixViewOf(m2),m0); } } template inline void MultMM( const T x, const GenLowerTriMatrix& m1, const GenBandMatrix& m2, BandMatrixView m0) { if (m1.isunit()) { LowerTriMatrix m1x = m1; MultMM(x,BandMatrixViewOf(m1x),m2,m0); } else { MultMM(x,BandMatrixViewOf(m1),m2,m0); } } template inline void MultMM( const T x, const GenBandMatrix& m1, const GenLowerTriMatrix& m2, BandMatrixView m0) { if (m2.isunit()) { LowerTriMatrix m2x = m2; MultMM(x,m1,BandMatrixViewOf(m2x),m0); } else { MultMM(x,m1,BandMatrixViewOf(m2),m0); } } template inline void AddMM( const T x2, const GenUpperTriMatrix& m2, BandMatrixView m1) { AddMM(CT(x2),m2,m1); } template inline void AddMM( const T x2, const GenLowerTriMatrix& m2, BandMatrixView m1) { AddMM(CT(x2),m2,m1); } template inline void AddMM( const CT , const GenUpperTriMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } template inline void AddMM( const CT , const GenLowerTriMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } template inline void MultMM( const T x, const GenUpperTriMatrix& m1, const GenBandMatrix& m2, BandMatrixView m0) { MultMM(CT(x),m1,m2,m0); } template inline void MultMM( const T x, const GenBandMatrix& m1, const GenUpperTriMatrix& m2, BandMatrixView m0) { MultMM(CT(x),m1,m2,m0); } template inline void MultMM( const T x, const GenLowerTriMatrix& m1, const GenBandMatrix& m2, BandMatrixView m0) { MultMM(CT(x),m1,m2,m0); } template inline void MultMM( const T x, const GenBandMatrix& m1, const GenLowerTriMatrix& m2, BandMatrixView m0) { MultMM(CT(x),m1,m2,m0); } template inline void MultMM( const CT , const GenUpperTriMatrix& , const GenBandMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } template inline void MultMM( const CT , const GenBandMatrix& , const GenUpperTriMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } template inline void MultMM( const CT , const GenLowerTriMatrix& , const GenBandMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } template inline void MultMM( const CT , const GenBandMatrix& , const GenLowerTriMatrix& , BandMatrixView ) { TMVAssert(TMV_FALSE); } } #undef CT #endif