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 NOELEMMULT
10 
11 template <class T1, class T2>
CanAddEq(const tmv::DiagMatrixView<T1> & m1,const tmv::SymBandMatrixView<T2> & m2)12 inline bool CanAddEq(
13     const tmv::DiagMatrixView<T1>& m1, const tmv::SymBandMatrixView<T2>& m2)
14 { return m1.size() == m2.size() && m2.nlo() == 0; }
15 
16 template <class T1, class T2, class T3>
CanMultMM(const tmv::DiagMatrixView<T1> & a,const tmv::SymBandMatrixView<T2> & b,const tmv::DiagMatrixView<T3> & c)17 inline bool CanMultMM(
18     const tmv::DiagMatrixView<T1>& a, const tmv::SymBandMatrixView<T2>& b,
19     const tmv::DiagMatrixView<T3>& c)
20 { return a.size() == b.size() && b.size() == c.size() && b.nlo() == 0; }
21 
22 template <class T1, class T2, class T3>
CanMultMM(const tmv::SymBandMatrixView<T1> & a,const tmv::DiagMatrixView<T2> & b,const tmv::DiagMatrixView<T3> & c)23 inline bool CanMultMM(
24     const tmv::SymBandMatrixView<T1>& a, const tmv::DiagMatrixView<T2>& b,
25     const tmv::DiagMatrixView<T3>& c)
26 { return a.size() == b.size() && b.size() == c.size() && a.nlo() == 0; }
27 
28 template <class T1, class T2, class T3>
CanMultMM(const tmv::SymBandMatrixView<T1> & a,const tmv::SymBandMatrixView<T2> & b,const tmv::DiagMatrixView<T3> & c)29 inline bool CanMultMM(
30     const tmv::SymBandMatrixView<T1>& a, const tmv::SymBandMatrixView<T2>& b,
31     const tmv::DiagMatrixView<T3>& c)
32 {
33     return a.size() == b.size() && b.size() == c.size() &&
34         a.nlo() == 0 && b.nlo() == 0;
35 }
36 
37 #include "TMV_TestMatrixArith.h"
38 
39 template <class T>
TestSymBandMatrixArith_C2()40 void TestSymBandMatrixArith_C2()
41 {
42 #if (XTEST & 2)
43     std::vector<tmv::SymBandMatrixView<T> > sb;
44     std::vector<tmv::SymBandMatrixView<std::complex<T> > > csb;
45     MakeSymBandList(sb,csb,InDef);
46 
47     const int N = sb[0].size();
48 
49     tmv::Matrix<T> a1(N,N);
50     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) a1(i,j) = T(3+i-5*j);
51     tmv::Matrix<std::complex<T> > ca1(N,N);
52     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) ca1(i,j) =
53         std::complex<T>(3+i-5*j,2-3*i);
54 
55     tmv::DiagMatrix<T> d1(a1);
56     tmv::DiagMatrix<std::complex<T> > cd1(ca1);
57     tmv::DiagMatrixView<T> d1v = d1.view();
58     tmv::DiagMatrixView<std::complex<T> > cd1v = cd1.view();
59 
60     for(size_t i=START;i<sb.size();i++) {
61         if (showstartdone) {
62             std::cout<<"Start loop i = "<<i<<std::endl;
63             std::cout<<"si = "<<sb[i]<<std::endl;
64         }
65 
66         tmv::SymBandMatrixView<T> si = sb[i];
67         tmv::SymBandMatrixView<std::complex<T> > csi = csb[i];
68 
69         TestMatrixArith4(d1v,cd1v,si,csi,"Diag/SymBand");
70         TestMatrixArith5(d1v,cd1v,si,csi,"Diag/SymBand");
71         TestMatrixArith6x(d1v,cd1v,si,csi,"Diag/SymBand");
72     }
73 #endif
74 }
75 
76 #ifdef TEST_DOUBLE
77 template void TestSymBandMatrixArith_C2<double>();
78 #endif
79 #ifdef TEST_FLOAT
80 template void TestSymBandMatrixArith_C2<float>();
81 #endif
82 #ifdef TEST_LONGDOUBLE
83 template void TestSymBandMatrixArith_C2<long double>();
84 #endif
85 #ifdef TEST_INT
86 template void TestSymBandMatrixArith_C2<int>();
87 #endif
88