169 Double_t inv_norm1 = 0.0;
170 Bool_t stop = kFALSE;
175 const Double_t ynorm1 = y.
Norm1();
176 if ( ynorm1 <= inv_norm1 ) {
181 for (i = 0; i < n; i++)
182 z(i) = (
y(i) >= 0.0 ? 1.0 : -1.0 );
186 Double_t maxz = TMath::Abs(
z(0));
187 for (i = 1; i < n; i++) {
188 const Double_t absz = TMath::Abs(
z(i));
194 stop = (maxz <= b*
z);
201 }
while (!stop && iter);
216 const Double_t zero = 0.0;
217 const Double_t one = 1.0;
218 const Double_t four = 4.0;
219 const Double_t sixteen = 16.0;
220 const Double_t sixteenth = 0.0625;
228 for (Int_t i = 0; (((i < n) && (t1 !=zero ))); i++) {
229 if (TMath::Abs(diag(i)) > tol) {
230 t1 *= (Double_t) diag(i);
231 while ( TMath::Abs(t1) < one) {
235 if ( niter2>100)
break;
237 while ( TMath::Abs(t1) < sixteenth) {
241 if (niter3>100)
break;
271 Error(
"Condition()",
"Hager procedure did NOT converge");
287 Bool_t status = kTRUE;
288 for (Int_t icol = colLwb; icol <= colUpb && status; icol++) {
311 for (Int_t i = 0; i < diagv.GetNrows(); i++)
326 printf(
"fTol = %.4e\n",
fTol);
327 printf(
"fDet1 = %.4e\n",
fDet1);
328 printf(
"fDet2 = %.4e\n",
fDet2);
330 printf(
"fRowLwb = %d\n",
fRowLwb);
331 printf(
"fColLwb = %d\n",
fColLwb);
339 if (
this != &source) {
340 TObject::operator=(source);
360 Double_t c = TMath::Abs(vp[lp]);
362 for (i = l; i < n; i++)
363 c = TMath::Max(TMath::Abs(vp[i]),c);
372 Double_t sd = vp[lp]/c; sd *= sd;
373 for (i = l; i < n; i++) {
374 const Double_t tmp = vp[i]/c;
379 if (vp[lp] > 0.) vpprim = -vpprim;
381 beta = 1./(vpprim*up);
396 Error(
"ApplyHouseHolder(const TVectorD &,..,TMatrixDRow &)",
"matrix row too short");
400 const Int_t inc_c = cr.
GetInc();
402 Double_t * cp = cr.
GetPtr();
404 Double_t s = cp[lp*inc_c]*up;
406 for (i = l; i < nv; i++)
407 s += cp[i*inc_c]*vp[i];
410 cp[lp*inc_c] += s*up;
411 for (i = l; i < nv; i++)
412 cp[i*inc_c] += s*vp[i];
425 Error(
"ApplyHouseHolder(const TVectorD &,..,TMatrixDRow &)",
"matrix column too short");
429 const Int_t inc_c = cc.
GetInc();
431 Double_t * cp = cc.
GetPtr();
433 Double_t s = cp[lp*inc_c]*up;
435 for (i = l; i < nv; i++)
436 s += cp[i*inc_c]*vp[i];
439 cp[lp*inc_c] += s*up;
440 for (i = l; i < nv; i++)
441 cp[i*inc_c] += s*vp[i];
454 Error(
"ApplyHouseHolder(const TVectorD &,..,TVectorD &)",
"vector too short");
461 Double_t s = cp[lp]*up;
463 for (i = l; i < nv; i++)
468 for (i = l; i < nv; i++)
476 void DefGivens(Double_t v1,Double_t v2,Double_t &c,Double_t &s)
478 const Double_t a1 = TMath::Abs(v1);
479 const Double_t a2 = TMath::Abs(v2);
481 const Double_t w = v2/v1;
488 const Double_t w = v1/v2;
507 const Double_t a1 = TMath::Abs(v1);
508 const Double_t a2 = TMath::Abs(v2);
510 const Double_t w = v2/v1;
519 const Double_t w = v1/v2;
539 const Double_t w = z1*c+z2*s;
virtual Bool_t MultiSolve(TMatrixD &B)
Solve set of equations with RHS in columns of B.
virtual Bool_t TransSolve(TVectorD &b)=0
Int_t Hager(Double_t &est, Int_t iter=5)
void DefAplGivens(Double_t &v1, Double_t &v2, Double_t &c, Double_t &s)
Define and apply a Givens-rotation by calculating 2 rotation parameters c and s.
void ApplyHouseHolder(const TVectorD &vc, Double_t up, Double_t beta, Int_t lp, Int_t l, TMatrixDRow &cr)
Apply Householder-transformation.
virtual Bool_t Decompose()=0
Decomposition Base class.
TDecompBase()
Default constructor.
virtual const TMatrixDBase & GetDecompMatrix() const =0
you should not use this method at all Int_t y
double beta(double x, double y)
Calculates the beta function.
Bool_t DefHouseHolder(const TVectorD &vc, Int_t lp, Int_t l, Double_t &up, Double_t &beta, Double_t tol)
Define a Householder-transformation through the parameters up and b .
TDecompBase & operator=(const TDecompBase &source)
Assignment operator.
static void DiagProd(const TVectorD &diag, Double_t tol, Double_t &d1, Double_t &d2)
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 Int_t m
Element * GetMatrixArray()
virtual Int_t GetNcols() const =0
virtual Bool_t Solve(TVectorD &b)=0
void Print(Option_t *opt="") const
Print class members.
void ApplyGivens(Double_t &z1, Double_t &z2, Double_t c, Double_t s)
Apply a Givens transformation as defined by c and s to the vector components v1 and v2 ...
void DefGivens(Double_t v1, Double_t v2, Double_t &c, Double_t &s)
Defines a Givens-rotation by calculating 2 rotation parameters c and s.
Element Norm1() const
Compute the 1-norm of the vector SUM{ |v[i]| }.
virtual Int_t GetNrows() const =0
const TMatrixTBase< Element > * GetMatrix() const
Double_t Hypot(Double_t x, Double_t y)
virtual void Det(Double_t &d1, Double_t &d2)
Matrix determinant det = d1*TMath::Power(2.,d2)
const TMatrixTBase< Element > * GetMatrix() const
you should not use this method at all Int_t Int_t z
virtual Double_t Condition()
Matrix condition number.
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
Double_t Sqrt(Double_t x)