30 templateClassImp(TMatrixTLazy);
31 templateClassImp(TMatrixTSymLazy);
32 templateClassImp(THaarMatrixT);
33 templateClassImp(THilbertMatrixT);
34 templateClassImp(THilbertMatrixTSym);
39 template<
class Element>
40 THaarMatrixT<Element>::THaarMatrixT(Int_t order,Int_t no_cols)
41 : TMatrixTLazy<Element>(1<<order, no_cols == 0 ? 1<<order : no_cols)
44 Error(
"THaarMatrixT",
"Haar order(%d) should be > 0",order);
46 Error(
"THaarMatrixT",
"#cols(%d) in Haar should be >= 0",no_cols);
59 template<
class Element>
60 void MakeHaarMat(TMatrixT<Element> &m)
62 R__ASSERT(m.IsValid());
63 const Int_t no_rows = m.GetNrows();
64 const Int_t no_cols = m.GetNcols();
66 if (no_rows < no_cols) {
67 Error(
"MakeHaarMat",
"#rows(%d) should be >= #cols(%d)",no_rows,no_cols);
71 Error(
"MakeHaarMat",
"#cols(%d) should be > 0",no_cols);
78 TMatrixT<Element> mtr(no_cols,no_rows);
79 Element *cp = mtr.GetMatrixArray();
80 const Element *m_end = mtr.GetMatrixArray()+no_rows*no_cols;
82 Element norm_factor = 1/TMath::Sqrt((Element)no_rows);
86 for (j = 0; j < no_rows; j++)
93 Int_t step_length = no_rows/2;
94 while (cp < m_end && step_length > 0) {
95 for (Int_t step_position = 0; cp < m_end && step_position < no_rows;
96 step_position += 2*step_length, cp += no_rows) {
97 Element *ccp = cp+step_position;
98 for (j = 0; j < step_length; j++)
100 for (j = 0; j < step_length; j++)
101 *ccp++ = -norm_factor;
104 norm_factor *= TMath::Sqrt(2.0);
107 R__ASSERT(step_length != 0 || cp == m_end);
108 R__ASSERT(no_rows != no_cols || step_length == 0);
115 template<
class Element>
116 void THaarMatrixT<Element>::FillIn(TMatrixT<Element> &m)
const
123 template<
class Element>
124 THilbertMatrixT<Element>::THilbertMatrixT(Int_t no_rows,Int_t no_cols)
125 : TMatrixTLazy<Element>(no_rows,no_cols)
128 Error(
"THilbertMatrixT",
"#rows(%d) in Hilbert should be > 0",no_rows);
130 Error(
"THilbertMatrixT",
"#cols(%d) in Hilbert should be > 0",no_cols);
135 template<
class Element>
136 THilbertMatrixT<Element>::THilbertMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)
137 : TMatrixTLazy<Element>(row_lwb,row_upb,col_lwb,col_upb)
139 if (row_upb < row_lwb)
140 Error(
"THilbertMatrixT",
"row_upb(%d) in Hilbert should be >= row_lwb(%d)",row_upb,row_lwb);
141 if (col_upb < col_lwb)
142 Error(
"THilbertMatrixT",
"col_upb(%d) in Hilbert should be >= col_lwb(%d)",col_upb,col_lwb);
149 template<
class Element>
150 void MakeHilbertMat(TMatrixT<Element> &m)
152 R__ASSERT(m.IsValid());
153 const Int_t no_rows = m.GetNrows();
154 const Int_t no_cols = m.GetNcols();
157 Error(
"MakeHilbertMat",
"#rows(%d) should be > 0",no_rows);
161 Error(
"MakeHilbertMat",
"#cols(%d) should be > 0",no_cols);
165 Element *cp = m.GetMatrixArray();
166 for (Int_t i = 0; i < no_rows; i++)
167 for (Int_t j = 0; j < no_cols; j++)
168 *cp++ = 1.0/(i+j+1.0);
173 template<
class Element>
174 void THilbertMatrixT<Element>::FillIn(TMatrixT<Element> &m)
const
181 template<
class Element>
182 THilbertMatrixTSym<Element>::THilbertMatrixTSym(Int_t no_rows)
183 : TMatrixTSymLazy<Element>(no_rows)
186 Error(
"THilbertMatrixTSym",
"#rows(%d) in Hilbert should be > 0",no_rows);
191 template<
class Element>
192 THilbertMatrixTSym<Element>::THilbertMatrixTSym(Int_t row_lwb,Int_t row_upb)
193 : TMatrixTSymLazy<Element>(row_lwb,row_upb)
195 if (row_upb < row_lwb)
196 Error(
"THilbertMatrixTSym",
"row_upb(%d) in Hilbert should be >= row_lwb(%d)",row_upb,row_lwb);
203 template<
class Element>
204 void MakeHilbertMat(TMatrixTSym<Element> &m)
206 R__ASSERT(m.IsValid());
207 const Int_t no_rows = m.GetNrows();
209 Error(
"MakeHilbertMat",
"#rows(%d) should be > 0",no_rows);
213 Element *cp = m.GetMatrixArray();
214 for (Int_t i = 0; i < no_rows; i++)
215 for (Int_t j = 0; j < no_rows; j++)
216 *cp++ = 1.0/(i+j+1.0);
221 template<
class Element>
222 void THilbertMatrixTSym<Element>::FillIn(TMatrixTSym<Element> &m)
const
227 template class TMatrixTLazy <Float_t>;
228 template class TMatrixTSymLazy <Float_t>;
229 template class THaarMatrixT <Float_t>;
230 template class THilbertMatrixT <Float_t>;
231 template class THilbertMatrixTSym<Float_t>;
233 template class TMatrixTLazy <Double_t>;
234 template class TMatrixTSymLazy <Double_t>;
235 template class THaarMatrixT <Double_t>;
236 template class THilbertMatrixT <Double_t>;
237 template class THilbertMatrixTSym<Double_t>;