1 #define START 0
2
3 #include "TMV.h"
4 #include "TMV_Band.h"
5 #include "TMV_Test.h"
6 #include "TMV_Test_2.h"
7 #include "TMV_TestBandArith.h"
8
9 #define NOADDEQ
10 #define NOELEMMULT
11
12 template <class T1, class T2, class T3>
CanMultMM(const tmv::DiagMatrixView<T1> & a,const tmv::BandMatrixView<T2> & b,const tmv::DiagMatrixView<T3> & c)13 inline bool CanMultMM(
14 const tmv::DiagMatrixView<T1>& a, const tmv::BandMatrixView<T2>& b,
15 const tmv::DiagMatrixView<T3>& c)
16 {
17 return b.colsize() == a.size() && b.rowsize() == a.size() &&
18 c.size() == a.size() && b.nlo() == 0 && b.nhi() == 0;
19 }
20
21 template <class T1, class T2, class T3>
CanMultMM(const tmv::BandMatrixView<T2> & a,const tmv::DiagMatrixView<T1> & b,const tmv::DiagMatrixView<T3> & c)22 inline bool CanMultMM(
23 const tmv::BandMatrixView<T2>& a, const tmv::DiagMatrixView<T1>& b,
24 const tmv::DiagMatrixView<T3>& c)
25 {
26 return a.colsize() == b.size() && a.rowsize() == b.size() &&
27 c.size() == a.size() && a.nlo() == 0 && a.nhi() == 0;
28 }
29
30 template <class T1, class T2, class T3>
CanMultMM(const tmv::BandMatrixView<T1> & a,const tmv::BandMatrixView<T2> & b,const tmv::DiagMatrixView<T3> & c)31 inline bool CanMultMM(
32 const tmv::BandMatrixView<T1>& a, const tmv::BandMatrixView<T2>& b,
33 const tmv::DiagMatrixView<T3>& c)
34 {
35 return a.colsize() == c.size() && b.rowsize() == c.size() &&
36 a.rowsize() == b.colsize() &&
37 a.nlo() == 0 && a.nhi() == 0 && b.nlo() == 0 && b.nhi() == 0;
38 }
39
40 #include "TMV_TestMatrixArith.h"
41
42 template <class T>
TestBandMatrixArith_C2()43 void TestBandMatrixArith_C2()
44 {
45 #if (XTEST & 2)
46 std::vector<tmv::BandMatrixView<T> > b;
47 std::vector<tmv::BandMatrixView<std::complex<T> > > cb;
48 MakeBandList(b,cb);
49
50 const int N = b[0].rowsize();
51
52 tmv::Matrix<T> a1(N,N);
53 for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) a1(i,j) = T(3+i-5*j);
54 tmv::Matrix<std::complex<T> > ca1(N,N);
55 for (int i=0; i<N; ++i) for (int j=0; j<N; ++j)
56 ca1(i,j) = std::complex<T>(3+i-5*j,4-8*i-j);
57
58 tmv::DiagMatrix<T> d1(a1);
59 tmv::DiagMatrix<std::complex<T> > cd1(ca1);
60 tmv::DiagMatrixView<T> d1v = d1.view();
61 tmv::DiagMatrixView<std::complex<T> > cd1v = cd1.view();
62
63 for(size_t i=START;i<b.size();i++) {
64 if (showstartdone) {
65 std::cerr<<"Start loop "<<i<<std::endl;
66 std::cerr<<"bi = "<<b[i]<<std::endl;
67 }
68 tmv::BandMatrixView<T> bi = b[i];
69 tmv::BandMatrixView<std::complex<T> > cbi = cb[i];
70
71 TestMatrixArith4(d1v,cd1v,bi,cbi,"Diag/Band");
72 TestMatrixArith5(d1v,cd1v,bi,cbi,"Diag/Band");
73 TestMatrixArith6x(d1v,cd1v,bi,cbi,"Diag/Band");
74 }
75 #endif
76 }
77
78 #ifdef TEST_DOUBLE
79 template void TestBandMatrixArith_C2<double>();
80 #endif
81 #ifdef TEST_FLOAT
82 template void TestBandMatrixArith_C2<float>();
83 #endif
84 #ifdef TEST_LONGDOUBLE
85 template void TestBandMatrixArith_C2<long double>();
86 #endif
87 #ifdef TEST_INT
88 template void TestBandMatrixArith_C2<int>();
89 #endif
90