1
2 #define START 0
3
4 #include "TMV.h"
5 #include "TMV_Sym.h"
6 #include "TMV_Test.h"
7 #include "TMV_Test_2.h"
8 #include "TMV_TestSymArith.h"
9
10 #define NOLDIVEQ
11 #define NORDIVEQ
12 #include "TMV_TestMatrixDivArith.h"
13
14 template <class T>
TestSymDiv_B2(tmv::DivType dt,PosDefCode pdc)15 void TestSymDiv_B2(tmv::DivType dt, PosDefCode pdc)
16 {
17 const int N = 10;
18
19 std::vector<tmv::SymMatrixView<T> > s;
20 std::vector<tmv::SymMatrixView<std::complex<T> > > cs;
21 MakeSymList(s,cs,pdc);
22
23 tmv::Matrix<T> a1(N,N);
24 for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) a1(i,j) = T(1-3*i+j);
25 a1.diag().addToAll(T(10)*N);
26 a1 /= T(10);
27 tmv::Matrix<std::complex<T> > ca1 = a1 * std::complex<T>(3,-4);
28 a1.diag().addToAll(T(10)*N);
29 ca1.diag().addToAll(T(10)*N);
30
31 tmv::MatrixView<T> a1v = a1.view();
32 tmv::MatrixView<std::complex<T> > ca1v = ca1.view();
33
34 #if (XTEST & 2)
35 tmv::Matrix<T> a3 = a1.colRange(0,N/2);
36 tmv::Matrix<std::complex<T> > ca3 = ca1.colRange(0,N/2);
37 tmv::Matrix<T> a4 = a1.rowRange(0,N/2);
38 tmv::Matrix<std::complex<T> > ca4 = ca1.rowRange(0,N/2);
39 tmv::Matrix<T> a5(2*N,N);
40 a5.rowRange(0,N) = a1;
41 a5.rowRange(N,2*N) = a1;
42 tmv::Matrix<std::complex<T> > ca5(2*N,N);
43 ca5.rowRange(0,N) = ca1;
44 ca5.rowRange(N,2*N) = ca1;
45 tmv::Matrix<T> a6 = a5.transpose();
46 tmv::Matrix<std::complex<T> > ca6 = ca5.transpose();
47
48 tmv::MatrixView<T> a3v = a3.view();
49 tmv::MatrixView<T> a4v = a4.view();
50 tmv::MatrixView<T> a5v = a5.view();
51 tmv::MatrixView<T> a6v = a6.view();
52 tmv::MatrixView<std::complex<T> > ca3v = ca3.view();
53 tmv::MatrixView<std::complex<T> > ca4v = ca4.view();
54 tmv::MatrixView<std::complex<T> > ca5v = ca5.view();
55 tmv::MatrixView<std::complex<T> > ca6v = ca6.view();
56 #endif
57
58 for(size_t i=START;i<s.size();i++) {
59 if (showstartdone)
60 std::cout<<"Start loop: i = "<<i<<", si = "<<
61 tmv::TMV_Text(s[i])<<" "<<s[i]<<std::endl;
62 tmv::SymMatrixView<T> si = s[i];
63 tmv::SymMatrixView<std::complex<T> > csi = cs[i];
64
65 si.saveDiv();
66 csi.saveDiv();
67
68 TestMatrixDivArith1(dt,a1v,si,ca1v,csi,"Sym/SquareMatrix");
69 if (dt == tmv::LU) continue;
70 #if (XTEST & 2)
71 TestMatrixDivArith1(dt,a3v,si,ca3v,csi,"Sym/NonSquareMatrix");
72 TestMatrixDivArith1(dt,a4v,si,ca4v,csi,"Sym/NonSquareMatrix");
73 TestMatrixDivArith1(dt,a5v,si,ca5v,csi,"Sym/NonSquareMatrix");
74 TestMatrixDivArith1(dt,a6v,si,ca6v,csi,"Sym/NonSquareMatrix");
75 #endif
76 }
77 }
78
79 #ifdef TEST_DOUBLE
80 template void TestSymDiv_B2<double>(tmv::DivType dt, PosDefCode pdc);
81 #endif
82 #ifdef TEST_FLOAT
83 template void TestSymDiv_B2<float>(tmv::DivType dt, PosDefCode pdc);
84 #endif
85 #ifdef TEST_LONGDOUBLE
86 template void TestSymDiv_B2<long double>(tmv::DivType dt, PosDefCode pdc);
87 #endif
88