Logo ROOT   6.14/05
Reference Guide
TDecompQRH.cxx
Go to the documentation of this file.
1 // @(#)root/matrix:$Id$
2 // Authors: Fons Rademakers, Eddy Offermann Dec 2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TDecompQRH
13  \ingroup Matrix
14 
15  QR Decomposition class
16 
17  Decompose a general (m x n) matrix A into A = fQ fR H where
18 
19 ~~~
20  fQ : (m x n) - orthogonal matrix
21  fR : (n x n) - upper triangular matrix
22  H : HouseHolder matrix which is stored through
23  fUp: (n) - vector with Householder up's
24  fW : (n) - vector with Householder beta's
25 ~~~
26 
27  If row/column index of A starts at (rowLwb,colLwb) then
28  the decomposed matrices start from :
29 ~~~
30  fQ : (rowLwb,0)
31  fR : (0,colLwb)
32  and the decomposed vectors start from :
33  fUp : (0)
34  fW : (0)
35 ~~~
36 
37  Errors arise from formation of reflectors i.e. singularity .
38  Note it attempts to handle the cases where the nRow <= nCol .
39 */
40 
41 #include "TDecompQRH.h"
42 #include "TError.h" // For R__ASSERT
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Constructor for (nrows x ncols) matrix
47 
49 {
50  if (nrows < ncols) {
51  Error("TDecompQRH(Int_t,Int_t","matrix rows should be >= columns");
52  return;
53  }
54 
55  fQ.ResizeTo(nrows,ncols);
56  fR.ResizeTo(ncols,ncols);
57  if (nrows <= ncols) {
58  fW.ResizeTo(nrows);
59  fUp.ResizeTo(nrows);
60  } else {
61  fW.ResizeTo(ncols);
62  fUp.ResizeTo(ncols);
63  }
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// Constructor for ([row_lwb..row_upb] x [col_lwb..col_upb]) matrix
68 
69 TDecompQRH::TDecompQRH(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)
70 {
71  const Int_t nrows = row_upb-row_lwb+1;
72  const Int_t ncols = col_upb-col_lwb+1;
73 
74  if (nrows < ncols) {
75  Error("TDecompQRH(Int_t,Int_t,Int_t,Int_t","matrix rows should be >= columns");
76  return;
77  }
78 
79  fRowLwb = row_lwb;
80  fColLwb = col_lwb;
81 
82  fQ.ResizeTo(nrows,ncols);
83  fR.ResizeTo(ncols,ncols);
84  if (nrows <= ncols) {
85  fW.ResizeTo(nrows);
86  fUp.ResizeTo(nrows);
87  } else {
88  fW.ResizeTo(ncols);
89  fUp.ResizeTo(ncols);
90  }
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Constructor for general matrix A .
95 
97 {
98  R__ASSERT(a.IsValid());
99  if (a.GetNrows() < a.GetNcols()) {
100  Error("TDecompQRH(const TMatrixD &","matrix rows should be >= columns");
101  return;
102  }
103 
105  fCondition = a.Norm1();
106  fTol = a.GetTol();
107  if (tol > 0.0)
108  fTol = tol;
109 
110  fRowLwb = a.GetRowLwb();
111  fColLwb = a.GetColLwb();
112  const Int_t nRow = a.GetNrows();
113  const Int_t nCol = a.GetNcols();
114 
115  fQ.ResizeTo(nRow,nCol);
116  memcpy(fQ.GetMatrixArray(),a.GetMatrixArray(),nRow*nCol*sizeof(Double_t));
117  fR.ResizeTo(nCol,nCol);
118  if (nRow <= nCol) {
119  fW.ResizeTo(nRow);
120  fUp.ResizeTo(nRow);
121  } else {
122  fW.ResizeTo(nCol);
123  fUp.ResizeTo(nCol);
124  }
125 }
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// Copy constructor
129 
131 {
132  *this = another;
133 }
134 
135 ////////////////////////////////////////////////////////////////////////////////
136 /// QR decomposition of matrix a by Householder transformations,
137 /// see Golub & Loan first edition p41 & Sec 6.2.
138 /// First fR is returned in upper triang of fQ and diagR. fQ returned in
139 /// 'u-form' in lower triang of fQ and fW, the latter containing the
140 /// "Householder betas".
141 /// If the decomposition succeeds, bit kDecomposed is set , otherwise kSingular
142 
144 {
145  if (TestBit(kDecomposed)) return kTRUE;
146 
147  if ( !TestBit(kMatrixSet) ) {
148  Error("Decompose()","Matrix has not been set");
149  return kFALSE;
150  }
151 
152  const Int_t nRow = this->GetNrows();
153  const Int_t nCol = this->GetNcols();
154  const Int_t rowLwb = this->GetRowLwb();
155  const Int_t colLwb = this->GetColLwb();
156 
157  TVectorD diagR;
158  Double_t work[kWorkMax];
159  if (nCol > kWorkMax) diagR.ResizeTo(nCol);
160  else diagR.Use(nCol,work);
161 
162  if (QRH(fQ,diagR,fUp,fW,fTol)) {
163  for (Int_t i = 0; i < nRow; i++) {
164  const Int_t ic = (i < nCol) ? i : nCol;
165  for (Int_t j = ic ; j < nCol; j++)
166  fR(i,j) = fQ(i,j);
167  }
168  TMatrixDDiag diag(fR); diag = diagR;
169 
170  fQ.Shift(rowLwb,0);
171  fR.Shift(0,colLwb);
172 
174  }
175 
176  return kTRUE;
177 }
178 
179 ////////////////////////////////////////////////////////////////////////////////
180 /// Decomposition function .
181 
183 {
184  const Int_t nRow = q.GetNrows();
185  const Int_t nCol = q.GetNcols();
186 
187  const Int_t n = (nRow <= nCol) ? nRow-1 : nCol;
188 
189  for (Int_t k = 0 ; k < n ; k++) {
190  const TVectorD qc_k = TMatrixDColumn_const(q,k);
191  if (!DefHouseHolder(qc_k,k,k+1,up(k),w(k),tol))
192  return kFALSE;
193  diagR(k) = qc_k(k)-up(k);
194  if (k < nCol-1) {
195  // Apply HouseHolder to sub-matrix
196  for (Int_t j = k+1; j < nCol; j++) {
197  TMatrixDColumn qc_j = TMatrixDColumn(q,j);
198  ApplyHouseHolder(qc_k,up(k),w(k),k,k+1,qc_j);
199  }
200  }
201  }
202 
203  if (nRow <= nCol) {
204  diagR(nRow-1) = q(nRow-1,nRow-1);
205  up(nRow-1) = 0;
206  w(nRow-1) = 0;
207  }
208 
209  return kTRUE;
210 }
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 /// Set matrix to be decomposed
214 
216 {
217  R__ASSERT(a.IsValid());
218 
219  ResetStatus();
220  if (a.GetNrows() < a.GetNcols()) {
221  Error("TDecompQRH(const TMatrixD &","matrix rows should be >= columns");
222  return;
223  }
224 
226  fCondition = a.Norm1();
227 
228  fRowLwb = a.GetRowLwb();
229  fColLwb = a.GetColLwb();
230  const Int_t nRow = a.GetNrows();
231  const Int_t nCol = a.GetNcols();
232 
233  fQ.ResizeTo(nRow,nCol);
234  memcpy(fQ.GetMatrixArray(),a.GetMatrixArray(),nRow*nCol*sizeof(Double_t));
235  fR.ResizeTo(nCol,nCol);
236  if (nRow <= nCol) {
237  fW.ResizeTo(nRow);
238  fUp.ResizeTo(nRow);
239  } else {
240  fW.ResizeTo(nCol);
241  fUp.ResizeTo(nCol);
242  }
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Solve Ax=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
247 /// has *not* been transformed. Solution returned in b.
248 
250 {
251  R__ASSERT(b.IsValid());
252  if (TestBit(kSingular)) {
253  Error("Solve()","Matrix is singular");
254  return kFALSE;
255  }
256  if ( !TestBit(kDecomposed) ) {
257  if (!Decompose()) {
258  Error("Solve()","Decomposition failed");
259  return kFALSE;
260  }
261  }
262 
263  if (fQ.GetNrows() != b.GetNrows() || fQ.GetRowLwb() != b.GetLwb()) {
264  Error("Solve(TVectorD &","vector and matrix incompatible");
265  return kFALSE;
266  }
267 
268  const Int_t nQRow = fQ.GetNrows();
269  const Int_t nQCol = fQ.GetNcols();
270 
271  // Calculate Q^T.b
272  const Int_t nQ = (nQRow <= nQCol) ? nQRow-1 : nQCol;
273  for (Int_t k = 0; k < nQ; k++) {
274  const TVectorD qc_k = TMatrixDColumn_const(fQ,k);
275  ApplyHouseHolder(qc_k,fUp(k),fW(k),k,k+1,b);
276  }
277 
278  const Int_t nRCol = fR.GetNcols();
279 
280  const Double_t *pR = fR.GetMatrixArray();
281  Double_t *pb = b.GetMatrixArray();
282 
283  // Backward substitution
284  for (Int_t i = nRCol-1; i >= 0; i--) {
285  const Int_t off_i = i*nRCol;
286  Double_t r = pb[i];
287  for (Int_t j = i+1; j < nRCol; j++)
288  r -= pR[off_i+j]*pb[j];
289  if (TMath::Abs(pR[off_i+i]) < fTol)
290  {
291  Error("Solve(TVectorD &)","R[%d,%d]=%.4e < %.4e",i,i,pR[off_i+i],fTol);
292  return kFALSE;
293  }
294  pb[i] = r/pR[off_i+i];
295  }
296 
297  return kTRUE;
298 }
299 
300 ////////////////////////////////////////////////////////////////////////////////
301 /// Solve Ax=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
302 /// has *not* been transformed. Solution returned in b.
303 
305 {
306  TMatrixDBase *b = const_cast<TMatrixDBase *>(cb.GetMatrix());
307  R__ASSERT(b->IsValid());
308  if (TestBit(kSingular)) {
309  Error("Solve()","Matrix is singular");
310  return kFALSE;
311  }
312  if ( !TestBit(kDecomposed) ) {
313  if (!Decompose()) {
314  Error("Solve()","Decomposition failed");
315  return kFALSE;
316  }
317  }
318 
319  if (fQ.GetNrows() != b->GetNrows() || fQ.GetRowLwb() != b->GetRowLwb())
320  {
321  Error("Solve(TMatrixDColumn &","vector and matrix incompatible");
322  return kFALSE;
323  }
324 
325  const Int_t nQRow = fQ.GetNrows();
326  const Int_t nQCol = fQ.GetNcols();
327 
328  // Calculate Q^T.b
329  const Int_t nQ = (nQRow <= nQCol) ? nQRow-1 : nQCol;
330  for (Int_t k = 0; k < nQ; k++) {
331  const TVectorD qc_k = TMatrixDColumn_const(fQ,k);
332  ApplyHouseHolder(qc_k,fUp(k),fW(k),k,k+1,cb);
333  }
334 
335  const Int_t nRCol = fR.GetNcols();
336 
337  const Double_t *pR = fR.GetMatrixArray();
338  Double_t *pcb = cb.GetPtr();
339  const Int_t inc = cb.GetInc();
340 
341  // Backward substitution
342  for (Int_t i = nRCol-1; i >= 0; i--) {
343  const Int_t off_i = i*nRCol;
344  const Int_t off_i2 = i*inc;
345  Double_t r = pcb[off_i2];
346  for (Int_t j = i+1; j < nRCol; j++)
347  r -= pR[off_i+j]*pcb[j*inc];
348  if (TMath::Abs(pR[off_i+i]) < fTol)
349  {
350  Error("Solve(TMatrixDColumn &)","R[%d,%d]=%.4e < %.4e",i,i,pR[off_i+i],fTol);
351  return kFALSE;
352  }
353  pcb[off_i2] = r/pR[off_i+i];
354  }
355 
356  return kTRUE;
357 }
358 
359 ////////////////////////////////////////////////////////////////////////////////
360 /// Solve A^T x=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
361 /// has *not* been transformed. Solution returned in b.
362 
364 {
365  R__ASSERT(b.IsValid());
366  if (TestBit(kSingular)) {
367  Error("TransSolve()","Matrix is singular");
368  return kFALSE;
369  }
370  if ( !TestBit(kDecomposed) ) {
371  if (!Decompose()) {
372  Error("TransSolve()","Decomposition failed");
373  return kFALSE;
374  }
375  }
376 
377  if (fQ.GetNrows() != fQ.GetNcols() || fQ.GetRowLwb() != fQ.GetColLwb()) {
378  Error("TransSolve(TVectorD &","matrix should be square");
379  return kFALSE;
380  }
381 
382  if (fR.GetNrows() != b.GetNrows() || fR.GetRowLwb() != b.GetLwb()) {
383  Error("TransSolve(TVectorD &","vector and matrix incompatible");
384  return kFALSE;
385  }
386 
387  const Double_t *pR = fR.GetMatrixArray();
388  Double_t *pb = b.GetMatrixArray();
389 
390  const Int_t nRCol = fR.GetNcols();
391 
392  // Backward substitution
393  for (Int_t i = 0; i < nRCol; i++) {
394  const Int_t off_i = i*nRCol;
395  Double_t r = pb[i];
396  for (Int_t j = 0; j < i; j++) {
397  const Int_t off_j = j*nRCol;
398  r -= pR[off_j+i]*pb[j];
399  }
400  if (TMath::Abs(pR[off_i+i]) < fTol)
401  {
402  Error("TransSolve(TVectorD &)","R[%d,%d]=%.4e < %.4e",i,i,pR[off_i+i],fTol);
403  return kFALSE;
404  }
405  pb[i] = r/pR[off_i+i];
406  }
407 
408  const Int_t nQRow = fQ.GetNrows();
409 
410  // Calculate Q.b; it was checked nQRow == nQCol
411  for (Int_t k = nQRow-1; k >= 0; k--) {
412  const TVectorD qc_k = TMatrixDColumn_const(fQ,k);
413  ApplyHouseHolder(qc_k,fUp(k),fW(k),k,k+1,b);
414  }
415 
416  return kTRUE;
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 /// Solve A^T x=b assuming the QR form of A is stored in fR,fQ and fW, but assume b
421 /// has *not* been transformed. Solution returned in b.
422 
424 {
425  TMatrixDBase *b = const_cast<TMatrixDBase *>(cb.GetMatrix());
426  R__ASSERT(b->IsValid());
427  if (TestBit(kSingular)) {
428  Error("TransSolve()","Matrix is singular");
429  return kFALSE;
430  }
431  if ( !TestBit(kDecomposed) ) {
432  if (!Decompose()) {
433  Error("TransSolve()","Decomposition failed");
434  return kFALSE;
435  }
436  }
437 
438  if (fQ.GetNrows() != fQ.GetNcols() || fQ.GetRowLwb() != fQ.GetColLwb()) {
439  Error("TransSolve(TMatrixDColumn &","matrix should be square");
440  return kFALSE;
441  }
442 
443  if (fR.GetNrows() != b->GetNrows() || fR.GetRowLwb() != b->GetRowLwb()) {
444  Error("TransSolve(TMatrixDColumn &","vector and matrix incompatible");
445  return kFALSE;
446  }
447 
448  const Double_t *pR = fR.GetMatrixArray();
449  Double_t *pcb = cb.GetPtr();
450  const Int_t inc = cb.GetInc();
451 
452  const Int_t nRCol = fR.GetNcols();
453 
454  // Backward substitution
455  for (Int_t i = 0; i < nRCol; i++) {
456  const Int_t off_i = i*nRCol;
457  const Int_t off_i2 = i*inc;
458  Double_t r = pcb[off_i2];
459  for (Int_t j = 0; j < i; j++) {
460  const Int_t off_j = j*nRCol;
461  r -= pR[off_j+i]*pcb[j*inc];
462  }
463  if (TMath::Abs(pR[off_i+i]) < fTol)
464  {
465  Error("TransSolve(TMatrixDColumn &)","R[%d,%d]=%.4e < %.4e",i,i,pR[off_i+i],fTol);
466  return kFALSE;
467  }
468  pcb[off_i2] = r/pR[off_i+i];
469  }
470 
471  const Int_t nQRow = fQ.GetNrows();
472 
473  // Calculate Q.b; it was checked nQRow == nQCol
474  for (Int_t k = nQRow-1; k >= 0; k--) {
475  const TVectorD qc_k = TMatrixDColumn_const(fQ,k);
476  ApplyHouseHolder(qc_k,fUp(k),fW(k),k,k+1,cb);
477  }
478 
479  return kTRUE;
480 }
481 
482 ////////////////////////////////////////////////////////////////////////////////
483 /// This routine calculates the absolute (!) value of the determinant
484 /// |det| = d1*TMath::Power(2.,d2)
485 
487 {
488  if ( !TestBit(kDetermined) ) {
489  if ( !TestBit(kDecomposed) )
490  Decompose();
491  if (TestBit(kSingular)) {
492  fDet1 = 0.0;
493  fDet2 = 0.0;
494  } else
495  TDecompBase::Det(d1,d2);
497  }
498  d1 = fDet1;
499  d2 = fDet2;
500 }
501 
502 ////////////////////////////////////////////////////////////////////////////////
503 /// For a matrix A(m,n), its inverse A_inv is defined as A * A_inv = A_inv * A = unit
504 /// The user should always supply a matrix of size (m x m) !
505 /// If m > n , only the (n x m) part of the returned (pseudo inverse) matrix
506 /// should be used .
507 
509 {
510  if (inv.GetNrows() != GetNrows() || inv.GetNcols() != GetNrows() ||
511  inv.GetRowLwb() != GetRowLwb() || inv.GetColLwb() != GetColLwb()) {
512  Error("Invert(TMatrixD &","Input matrix has wrong shape");
513  return kFALSE;
514  }
515 
516  inv.UnitMatrix();
517  const Bool_t status = MultiSolve(inv);
518 
519  return status;
520 }
521 
522 ////////////////////////////////////////////////////////////////////////////////
523 /// For a matrix A(m,n), its inverse A_inv is defined as A * A_inv = A_inv * A = unit
524 /// (n x m) Ainv is returned .
525 
527 {
528  const Int_t rowLwb = GetRowLwb();
529  const Int_t colLwb = GetColLwb();
530  const Int_t rowUpb = rowLwb+GetNrows()-1;
531  TMatrixD inv(rowLwb,rowUpb,colLwb,colLwb+GetNrows()-1);
532  inv.UnitMatrix();
533  status = MultiSolve(inv);
534  inv.ResizeTo(rowLwb,rowLwb+GetNcols()-1,colLwb,colLwb+GetNrows()-1);
535 
536  return inv;
537 }
538 
539 ////////////////////////////////////////////////////////////////////////////////
540 /// Print the class members
541 
542 void TDecompQRH::Print(Option_t *opt) const
543 {
544  TDecompBase::Print(opt);
545  fQ.Print("fQ");
546  fR.Print("fR");
547  fUp.Print("fUp");
548  fW.Print("fW");
549 }
550 
551 ////////////////////////////////////////////////////////////////////////////////
552 /// Assignment operator
553 
555 {
556  if (this != &source) {
557  TDecompBase::operator=(source);
558  fQ.ResizeTo(source.fQ);
559  fR.ResizeTo(source.fR);
560  fUp.ResizeTo(source.fUp);
561  fW.ResizeTo(source.fW);
562  fQ = source.fQ;
563  fR = source.fR;
564  fUp = source.fUp;
565  fW = source.fW;
566  }
567  return *this;
568 }
virtual TMatrixTBase< Element > & UnitMatrix()
Make a unit matrix (matrix need not be a square one).
QR Decomposition class.
Definition: TDecompQRH.h:25
virtual TMatrixTBase< Element > & Shift(Int_t row_shift, Int_t col_shift)
Shift the row index by adding row_shift and the column index by adding col_shift, respectively...
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
Definition: TVectorT.cxx:292
virtual Bool_t MultiSolve(TMatrixD &B)
Solve set of equations with RHS in columns of B.
TMatrixD fQ
Definition: TDecompQRH.h:30
TMatrixD fR
Definition: TDecompQRH.h:31
Int_t GetRowLwb() const
Definition: TMatrixTBase.h:120
Int_t GetInc() const
Double_t fCondition
Definition: TDecompBase.h:39
void Print(Option_t *opt="") const
Print the class members.
Definition: TDecompQRH.cxx:542
Int_t GetRowLwb() const
Definition: TDecompBase.h:73
Int_t fRowLwb
Definition: TDecompBase.h:40
const char Option_t
Definition: RtypesCore.h:62
virtual const Element * GetMatrixArray() const
Definition: TMatrixT.h:222
Int_t GetNcols() const
Definition: TMatrixTBase.h:125
Int_t GetLwb() const
Definition: TVectorT.h:73
TVectorD fUp
Definition: TDecompQRH.h:32
Decomposition Base class.
Definition: TDecompBase.h:33
#define R__ASSERT(e)
Definition: TError.h:96
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
Int_t GetNrows() const
Definition: TVectorT.h:75
TMatrixTColumn_const< Double_t > TMatrixDColumn_const
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void Print(Option_t *option="") const
Print the vector as a list of elements.
Definition: TVectorT.cxx:1361
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
Definition: TMatrixT.cxx:1210
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
Bool_t DefHouseHolder(const TVectorD &vc, Int_t lp, Int_t l, Double_t &up, Double_t &b, Double_t tol=0.0)
Define a Householder-transformation through the parameters up and b .
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual Int_t GetNrows() const
Definition: TDecompQRH.h:50
Double_t fTol
Definition: TDecompBase.h:36
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
Definition: TVectorT.cxx:347
Int_t GetColLwb() const
Definition: TMatrixTBase.h:123
Element * GetPtr() const
TDecompBase & operator=(const TDecompBase &source)
Assignment operator.
TDecompQRH & operator=(const TDecompQRH &source)
Assignment operator.
Definition: TDecompQRH.cxx:554
static Bool_t QRH(TMatrixD &q, TVectorD &diagR, TVectorD &up, TVectorD &w, Double_t tol)
Decomposition function .
Definition: TDecompQRH.cxx:182
Int_t fColLwb
Definition: TDecompBase.h:41
TVectorD fW
Definition: TDecompQRH.h:33
Element Norm1() const
Definition: TMatrixTBase.h:176
Element * GetMatrixArray()
Definition: TVectorT.h:78
virtual Bool_t Decompose()
QR decomposition of matrix a by Householder transformations, see Golub & Loan first edition p41 & Sec...
Definition: TDecompQRH.cxx:143
Element GetTol() const
Definition: TMatrixTBase.h:127
virtual Bool_t Solve(TVectorD &b)
Solve Ax=b assuming the QR form of A is stored in fR,fQ and fW, but assume b has not been transformed...
Definition: TDecompQRH.cxx:249
ROOT::R::TRInterface & r
Definition: Object.C:4
TMatrixD Invert()
Definition: TDecompQRH.h:74
void inv(rsa_NUMBER *, rsa_NUMBER *, rsa_NUMBER *)
Definition: rsaaux.cxx:949
void ApplyHouseHolder(const TVectorD &vc, Double_t up, Double_t b, Int_t lp, Int_t l, TMatrixDRow &cr)
Apply Householder-transformation.
auto * a
Definition: textangle.C:12
Bool_t IsValid() const
Definition: TVectorT.h:83
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
void Print(Option_t *opt="") const
Print class members.
void ResetStatus()
Definition: TDecompBase.h:43
virtual void Det(Double_t &d1, Double_t &d2)
This routine calculates the absolute (!) value of the determinant |det| = d1*TMath::Power(2.,d2)
Definition: TDecompQRH.cxx:486
Linear Algebra Package.
Double_t fDet2
Definition: TDecompBase.h:38
Int_t GetNrows() const
Definition: TMatrixTBase.h:122
const Bool_t kFALSE
Definition: RtypesCore.h:88
Double_t fDet1
Definition: TDecompBase.h:37
#define ClassImp(name)
Definition: Rtypes.h:359
virtual Bool_t TransSolve(TVectorD &b)
Solve A^T x=b assuming the QR form of A is stored in fR,fQ and fW, but assume b has not been transfor...
Definition: TDecompQRH.cxx:363
double Double_t
Definition: RtypesCore.h:55
virtual void Det(Double_t &d1, Double_t &d2)
Matrix determinant det = d1*TMath::Power(2.,d2)
void Print(Option_t *name="") const
Print the matrix as a table of elements.
virtual Int_t GetNcols() const
Definition: TDecompQRH.h:51
const TMatrixTBase< Element > * GetMatrix() const
TMatrixTColumn< Double_t > TMatrixDColumn
virtual void SetMatrix(const TMatrixD &a)
Set matrix to be decomposed.
Definition: TDecompQRH.cxx:215
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
float * q
Definition: THbookFile.cxx:87
const Bool_t kTRUE
Definition: RtypesCore.h:87
Int_t GetColLwb() const
Definition: TDecompBase.h:74
const Int_t n
Definition: legend1.C:16
Bool_t IsValid() const
Definition: TMatrixTBase.h:145