1 #ifndef MeasAlgoShapeletMyMatrix_H
2 #define MeasAlgoShapeletMyMatrix_H
12 namespace algorithms {
15 typedef tmv::Vector<double>
DVector;
18 typedef tmv::Matrix<double>
DMatrix;
25 typedef tmv::Vector<std::complex<double> >
CDVector;
26 typedef tmv::VectorView<std::complex<double> >
CDVectorView;
28 typedef tmv::Matrix<std::complex<double> >
CDMatrix;
29 typedef tmv::MatrixView<std::complex<double> >
CDMatrixView;
32 typedef tmv::Vector<float>
FVector;
35 typedef tmv::Matrix<float>
FMatrix;
40 typedef tmv::Vector<std::complex<float> >
CFVector;
41 typedef tmv::VectorView<std::complex<float> >
CFVectorView;
43 typedef tmv::Matrix<std::complex<float> >
CFMatrix;
44 typedef tmv::MatrixView<std::complex<float> >
CFMatrixView;
52 #define TVector(T) tmv::Vector<T>
53 #define TVectorView(T) tmv::VectorView<T>
54 #define TConstVectorView(T) tmv::ConstVectorView<T>
55 #define TMatrix(T) tmv::Matrix<T>
56 #define TMatrixView(T) tmv::MatrixView<T>
57 #define TConstMatrixView(T) tmv::ConstMatrixView<T>
60 #define TMV_rowsize() rowsize()
61 #define TMV_colsize() colsize()
62 #define TMV_cref(i,j) cref(i,j)
63 #define TMV_ref(i,j) ref(i,j)
64 #define TMV_diag() diag()
66 #define EIGEN_asDiag()
67 #define TMV_setToIdentity() setToIdentity()
68 #define TMV_subVector(i1,i2) subVector(i1,i2)
69 #define TMV_subMatrix(i1,i2,j1,j2) subMatrix(i1,i2,j1,j2)
70 #define TMV_realPart() realPart()
71 #define TMV_imagPart() imagPart()
72 #define TMV_normSq() normSq()
73 #define TMV_normInf() normInf()
74 #define TMV_maxAbsElement() maxAbsElement()
75 #define TMV_addToAll(x) addToAll(x)
76 #define TMV_setAllTo(x) setAllTo(x)
77 #define TMV_colpart(j,i1,i2) col(j,i1,i2)
78 #define TMV_rowpart(i,j1,j2) row(i,j1,j2)
79 #define TMV_diagpart(i,j1,j2) diag(i,j1,j2)
80 #define TMV_det() det()
81 #define TMV_transposeSelf() transposeSelf()
82 #define TMV_sumElements() sumElements()
85 #define TMV_view(m) (m).view()
86 #define TMV_vview(v) (v).view()
87 #define TMV_colRange(m,j1,j2) (m).colRange(j1,j2)
88 #define TMV_rowRange(m,i1,i2) (m).rowRange(i1,i2)
89 #define TMV_ptr(m) (m).ptr()
90 #define TMV_cptr(m) (m).cptr()
91 #define TMV_stepi(m) (m).stepi()
92 #define TMV_stepj(m) (m).stepj()
93 #define TMV_DiagMatrixViewOf(v) DiagMatrixViewOf(v)
94 #define TMV_conjugateSelf(m) (m).conjugateSelf();
95 #define EIGEN_Transpose(m) m
96 #define EIGEN_ToScalar(m) m
97 #define TMV_NormInf(m) NormInf(m)
98 #define TMV_Norm(m) Norm(m)
101 #define TMV_const const
102 #define EIGEN_mutable
103 #define EIGEN_twice(x) x
106 #define TMV_QR(m) (m).divideUsing(tmv::QR); (m).saveDiv()
107 #define TMV_QR1(m) (m).divideUsing(tmv::QR); (m).saveDiv()
108 #define TMV_QR2(m) (m).resetDiv()
109 #define TMV_QRisSingular(m) (m).isSingular()
110 #define TMV_throwSingular throw tmv::Singular()
111 #define TMV_QR_Solve(m,x,b) x = b/m
112 #define TMV_QR_InverseATA(m,cov) (m).makeInverseATA(cov)
116 #include "Eigen/Core"
120 #include "Eigen/Cholesky"
125 namespace algorithms {
166 #define TVector(T) Eigen::Matrix<T,Eigen::Dynamic,1>
167 #define TVectorView(T) Eigen::Block<TVector(T) >
168 #define TConstVectorView(T) const Eigen::Block<TVector(T) >
169 #define TMatrix(T) Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>
170 #define TMatrixView(T) Eigen::Block<TMatrix(T) >
171 #define TConstMatrixView(T) const Eigen::Block<TMatrix(T) >
174 #define TMV_rowsize() cols()
175 #define TMV_colsize() rows()
176 #define TMV_cref(i,j) coeff(i,j)
177 #define TMV_ref(i,j) coeffRef(i,j)
178 #define TMV_diag() diagonal()
179 #define EIGEN_diag() diagonal().array()
180 #define EIGEN_asDiag() .asDiagonal()
181 #define TMV_setToIdentity() setIdentity()
182 #define TMV_subVector(i1,i2) segment(i1,((i2)-(i1)))
183 #define TMV_subMatrix(i1,i2,j1,j2) block(i1,j1,((i2)-(i1)),((j2)-(j1)))
184 #define TMV_realPart() real()
185 #define TMV_imagPart() imag()
186 #define TMV_normSq() squaredNorm()
187 #define TMV_normInf() lpNorm<Eigen::Infinity>()
188 #define TMV_maxAbsElement() array().abs().maxCoeff()
189 #define TMV_addToAll(x) array() += (x)
190 #define TMV_setAllTo(x) setConstant(x)
191 #define TMV_colpart(j,i1,i2) col(j).segment(i1,i2)
192 #define TMV_rowpart(i,j1,j2) row(i).segment(j1,j2)
195 #define TMV_diagpart(i,j1,j2) diagonal().segment(j1,j2)
196 #define TMV_det() determinant()
197 #define TMV_transposeSelf() transposeInPlace()
198 #define TMV_sumElements() sum()
201 #define TMV_view(m) (m).block(0,0,(m).rows(),(m).cols())
202 #define TMV_vview(v) (v).segment(0,(v).size())
203 #define TMV_colRange(m,j1,j2) (m).block(0,j1,(m).rows(),((j2)-(j1)))
204 #define TMV_rowRange(m,i1,i2) (m).block(i1,0,((i2)-(i1)),(m).cols())
205 #define TMV_ptr(m) &((m).coeffRef(0,0))
206 #define TMV_cptr(m) &((m).coeff(0,0))
207 #define TMV_stepi(m) ((m).rowStride())
208 #define TMV_stepj(m) ((m).colStride())
209 #define TMV_DiagMatrixViewOf(v) (v).asDiagonal()
210 #define TMV_conjugateSelf(m) (m) = (m).conjugate()
211 #define EIGEN_Transpose(m) (m).transpose()
212 #define EIGEN_ToScalar(m) (m)(0,0)
213 #define TMV_NormInf(m) (m).lpNorm<Eigen::Infinity>()
214 #define TMV_Norm(m) (m).norm()
218 #define EIGEN_mutable mutable
219 #define EIGEN_twice(x) x,x
222 #define TMV_QR(m) Eigen::ColPivHouseholderQR<DMatrix> QR_Solver_ ## m = (m).colPivHouseholderQr();
224 #define TMV_QR2(m) Eigen::ColPivHouseholderQR<DMatrix> QR_Solver_ ## m = (m).colPivHouseholderQr();
226 #define TMV_QRisSingular(m) QR_Solver_ ## m .isInjective()
227 #define TMV_QR_Solve(m,x,b) (x) = QR_Solver_ ## m .solve(b);
228 #define TMV_throwSingular throw std::runtime_error("Singular")
229 #define TMV_QR_InverseATA(m,cov) \
231 (cov).setIdentity(); \
232 QR_Solver_ ## m .matrixQR().triangularView<Eigen::Upper>().transpose().solveInPlace(cov); \
233 QR_Solver_ ## m .matrixQR().triangularView<Eigen::Upper>().solveInPlace(cov); \
Eigen::VectorXcd CDVector
Eigen::Block< DVector, Eigen::Dynamic, 1 > DVectorView
Eigen::VectorXcf CFVector
Eigen::Block< CFVector, Eigen::Dynamic, 1 > CFVectorView
const CFMatrixView CFConstMatrixView
Eigen::Matrix< float, 2, 2 > FSmallMatrix22
const DVectorView DConstVectorView
Eigen::Block< CDVector, Eigen::Dynamic, 1 > CDVectorView
Eigen::MatrixXcd CDMatrix
Eigen::Block< FMatrix > FMatrixView
const FMatrixView FConstMatrixView
Eigen::Block< FVector, Eigen::Dynamic, 1 > FVectorView
const CFVectorView CFConstVectorView
Eigen::Block< DMatrix > DMatrixView
const CDVectorView CDConstVectorView
const FVectorView FConstVectorView
Eigen::MatrixXd DBandMatrix
Eigen::RowVectorXd DRowVector
const DMatrixView DConstMatrixView
const CDMatrixView CDConstMatrixView
Eigen::Matrix< double, 2, 2 > DSmallMatrix22
Eigen::MatrixXcf CFMatrix
Eigen::Block< CDMatrix > CDMatrixView
Eigen::Block< CFMatrix > CFMatrixView