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 NOADDEQ
10 #define NOMULTEQ
11 #define NOELEMMULT
12 
13 #include "TMV_TestMatrixArith.h"
14 
15 template <class T>
TestSymBandMatrixArith_B1()16 void TestSymBandMatrixArith_B1()
17 {
18     std::vector<tmv::SymBandMatrixView<T> > sb;
19     std::vector<tmv::SymBandMatrixView<std::complex<T> > > csb;
20     MakeSymBandList(sb,csb,InDef);
21 
22     const int N = sb[0].size();
23 
24     tmv::Matrix<T> a1(N,N);
25     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) a1(i,j) = T(3+i-5*j);
26     tmv::Matrix<std::complex<T> > ca1(N,N);
27     for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) ca1(i,j) =
28         std::complex<T>(3+i-5*j,2-3*i);
29 
30     tmv::MatrixView<T> a1v = a1.view();
31     tmv::MatrixView<std::complex<T> > ca1v = ca1.view();
32 
33 #if (XTEST & 2)
34     tmv::Matrix<T> a2(2*N,2*N);
35     for (int i=0; i<2*N; ++i) for (int j=0; j<2*N; ++j) a2(i,j) = T(1-3*i+6*j);
36     tmv::Matrix<std::complex<T> > ca2(2*N,2*N);
37     for (int i=0; i<2*N; ++i) for (int j=0; j<2*N; ++j) ca2(i,j) =
38         std::complex<T>(1-3*i+6*j,-4+2*j);
39 
40     tmv::Matrix<T,tmv::RowMajor> a3 = a2.rowRange(0,N);
41     tmv::Matrix<std::complex<T> > ca3 = a3 * std::complex<T>(-3,4);
42     tmv::Matrix<T,tmv::RowMajor> a4 = a1.colRange(0,0);
43     tmv::Matrix<std::complex<T> > ca4 = a4;
44 
45     tmv::MatrixView<T> a3v = a3.view();
46     tmv::MatrixView<T> a4v = a4.view();
47     tmv::MatrixView<std::complex<T> > ca3v = ca3.view();
48     tmv::MatrixView<std::complex<T> > ca4v = ca4.view();
49 #endif
50 
51     for(size_t i=START;i<sb.size();i++) {
52         if (showstartdone) {
53             std::cout<<"Start loop i = "<<i<<std::endl;
54             std::cout<<"si = "<<sb[i]<<std::endl;
55         }
56 
57         tmv::SymBandMatrixView<T> si = sb[i];
58         tmv::SymBandMatrixView<std::complex<T> > csi = csb[i];
59 
60         TestMatrixArith4(si,csi,a1v,ca1v,"SymBand/SquareM");
61         TestMatrixArith5(si,csi,a1v,ca1v,"SymBand/SquareM");
62         TestMatrixArith6x(si,csi,a1v,ca1v,"SymBand/SquareM");
63 #if (XTEST & 2)
64         TestMatrixArith4(si,csi,a3v,ca3v,"SymBand/NonSquareM");
65         TestMatrixArith5(si,csi,a3v,ca3v,"SymBand/NonSquareM");
66         TestMatrixArith6x(si,csi,a3v,ca3v,"SymBand/NonSquareM");
67         TestMatrixArith4(si,csi,a4v,ca4v,"SymBand/DegenerateM");
68         TestMatrixArith5(si,csi,a4v,ca4v,"SymBand/DegenerateM");
69         TestMatrixArith6x(si,csi,a4v,ca4v,"SymBand/DegenerateM");
70 #endif
71     }
72 }
73 
74 #ifdef TEST_DOUBLE
75 template void TestSymBandMatrixArith_B1<double>();
76 #endif
77 #ifdef TEST_FLOAT
78 template void TestSymBandMatrixArith_B1<float>();
79 #endif
80 #ifdef TEST_LONGDOUBLE
81 template void TestSymBandMatrixArith_B1<long double>();
82 #endif
83 #ifdef TEST_INT
84 template void TestSymBandMatrixArith_B1<int>();
85 #endif
86