1 #define START 0
2 
3 #include "TMV.h"
4 #include "TMV_SymBand.h"
5 #include "TMV_Test.h"
6 #include "TMV_Test_2.h"
7 #include "TMV_TestSymBandArith.h"
8 
9 #define NOMULTEQ
10 #define NOELEMMULT
11 
12 template <class T1, class T2>
CanAddEq(const tmv::SymBandMatrixView<T1> & a,const tmv::DiagMatrixView<T2> &)13 inline bool CanAddEq(
14     const tmv::SymBandMatrixView<T1>& a, const tmv::DiagMatrixView<T2>& )
15 { return a.issym() || tmv::isReal(T2()); }
16 
17 #include "TMV_TestMatrixArith.h"
18 
19 template <class T>
TestSymBandMatrixArith_C1()20 void TestSymBandMatrixArith_C1()
21 {
22     std::vector<tmv::SymBandMatrixView<T> > sb;
23     std::vector<tmv::SymBandMatrixView<std::complex<T> > > csb;
24     MakeSymBandList(sb,csb,InDef);
25 
26     const int N = sb[0].size();
27 
28     tmv::Matrix<T> a1(N,N);
29     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) a1(i,j) = T(3+i-5*j);
30     tmv::Matrix<std::complex<T> > ca1(N,N);
31     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) ca1(i,j) =
32         std::complex<T>(3+i-5*j,2-3*i);
33 
34     tmv::DiagMatrix<T> d1(a1);
35     tmv::DiagMatrix<std::complex<T> > cd1(ca1);
36     tmv::DiagMatrixView<T> d1v = d1.view();
37     tmv::DiagMatrixView<std::complex<T> > cd1v = cd1.view();
38 
39     for(size_t i=START;i<sb.size();i++) {
40         if (showstartdone) {
41             std::cout<<"Start loop i = "<<i<<std::endl;
42             std::cout<<"si = "<<sb[i]<<std::endl;
43         }
44 
45         tmv::SymBandMatrixView<T> si = sb[i];
46         tmv::SymBandMatrixView<std::complex<T> > csi = csb[i];
47 
48         TestMatrixArith4(si,csi,d1v,cd1v,"SymBand/Diag");
49         TestMatrixArith5(si,csi,d1v,cd1v,"SymBand/Diag");
50         TestMatrixArith6x(si,csi,d1v,cd1v,"SymBand/Diag");
51     }
52 }
53 
54 #ifdef TEST_DOUBLE
55 template void TestSymBandMatrixArith_C1<double>();
56 #endif
57 #ifdef TEST_FLOAT
58 template void TestSymBandMatrixArith_C1<float>();
59 #endif
60 #ifdef TEST_LONGDOUBLE
61 template void TestSymBandMatrixArith_C1<long double>();
62 #endif
63 #ifdef TEST_INT
64 template void TestSymBandMatrixArith_C1<int>();
65 #endif
66