49 #include "Riostream.h" 79 if (x_in .GetNrows() > 0)
fX. Use(x_in .GetNrows(),x_in .GetMatrixArray());
80 if (s_in .GetNrows() > 0)
fS. Use(s_in .GetNrows(),s_in .GetMatrixArray());
81 if (y_in .GetNrows() > 0)
fY. Use(y_in .GetNrows(),y_in .GetMatrixArray());
82 if (z_in .GetNrows() > 0)
fZ. Use(z_in .GetNrows(),z_in .GetMatrixArray());
83 if (v_in .GetNrows() > 0)
fV. Use(v_in .GetNrows(),v_in .GetMatrixArray());
84 if (phi_in .GetNrows() > 0)
fPhi. Use(phi_in .GetNrows(),phi_in .GetMatrixArray());
85 if (w_in .GetNrows() > 0)
fW. Use(w_in .GetNrows(),w_in .GetMatrixArray());
86 if (gamma_in .GetNrows() > 0)
fGamma. Use(gamma_in .GetNrows(),gamma_in .GetMatrixArray());
87 if (t_in .GetNrows() > 0)
fT. Use(t_in .GetNrows(),t_in .GetMatrixArray());
112 R__ASSERT(
fNx ==
fV .GetNrows() || (0 ==
fV .GetNrows() && fNxlo == 0));
113 R__ASSERT(
fNx ==
fGamma .GetNrows() || (0 ==
fGamma .GetNrows() && fNxlo == 0));
115 R__ASSERT(
fNx ==
fW .GetNrows() || (0 ==
fW .GetNrows() && fNxup == 0));
116 R__ASSERT(
fNx ==
fPhi .GetNrows() || (0 ==
fPhi .GetNrows() && fNxup == 0));
118 R__ASSERT(
fMz ==
fT .GetNrows() || (0 ==
fT .GetNrows() &&
fMclo == 0));
121 R__ASSERT(
fMz ==
fU .GetNrows() || (0 ==
fU .GetNrows() &&
fMcup == 0));
122 R__ASSERT(
fMz ==
fPi .GetNrows() || (0 ==
fPi .GetNrows() &&
fMcup == 0));
217 mu += (
fU+alpha*step->
fU)*(
fPi+alpha*step->
fPi);
238 R__ASSERT((b->
fT) .MatchesNonZeroPattern(
fCloIndex) &&
245 R__ASSERT((b->
fU) .MatchesNonZeroPattern(
fCupIndex) &&
252 R__ASSERT((b->
fV) .MatchesNonZeroPattern(
fXloIndex) &&
259 R__ASSERT((b->
fW) .MatchesNonZeroPattern(
fXupIndex) &&
305 Double_t maxStep = 1.0;
350 ::Error(
"StepBound(TVectorD &,TVectorD &,Double_t)",
"vector's not compatible");
358 Double_t bound = maxStep;
359 for (Int_t i = 0; i < n; i++) {
360 Double_t tmp = pD[i];
361 if ( pV[i] >= 0 && tmp < 0 ) {
376 Bool_t interior = kTRUE;
378 interior = interior &&
382 interior = interior &&
386 interior = interior &&
390 interior = interior &&
414 Double_t &primalValue,
415 Double_t &primalStep,
418 Int_t &fIrstOrSecond)
421 Double_t alpha = 1.0;
424 primalValue,primalStep,dualValue,dualStep,fIrstOrSecond);
428 primalValue,primalStep,dualValue,dualStep,fIrstOrSecond);
432 primalValue,primalStep,dualValue,dualStep,fIrstOrSecond);
436 primalValue,primalStep,dualValue,dualStep,fIrstOrSecond);
446 Double_t maxStep,Double_t &w_elt,Double_t &wstep_elt,Double_t &u_elt,
447 Double_t &ustep_elt,
int& fIrst_or_second)
465 Double_t *w, Int_t incw,
466 Double_t *wstep,Int_t incwstep,
467 Double_t *u, Int_t incu,
468 Double_t *ustep,Int_t incustep,
470 Double_t &w_elt,Double_t &wstep_elt,
471 Double_t &u_elt,Double_t &ustep_elt,
472 Int_t &fIrst_or_second)
474 Double_t bound = maxStep;
477 Int_t lastBlocking = -1;
484 Double_t *pw = w +(n-1)*incw;
485 Double_t *pwstep = wstep+(n-1)*incwstep;
486 Double_t *pu = u +(n-1)*incu;
487 Double_t *pustep = ustep+(n-1)*incustep;
490 Double_t tmp = *pwstep;
491 if (*pw > 0 && tmp < 0) {
500 if (*pu > 0 && tmp < 0) {
519 if (lastBlocking > -1) {
521 w_elt = w[lastBlocking];
522 wstep_elt = wstep[lastBlocking];
523 u_elt = u[lastBlocking];
524 ustep_elt = ustep[lastBlocking];
580 if (cmin < viol) viol = cmin;
583 if (cmin < viol) viol = cmin;
587 if (cmin < viol) viol = cmin;
590 if (cmin < viol) viol = cmin;
594 if (cmin < viol) viol = cmin;
597 if (cmin < viol) viol = cmin;
601 if (cmin < viol) viol = cmin;
604 if (cmin < viol) viol = cmin;
640 std::cout <<
"fNx : " <<
fNx << std::endl;
641 std::cout <<
"fMy : " <<
fMy << std::endl;
642 std::cout <<
"fMz : " <<
fMz << std::endl;
643 std::cout <<
"fNxup: " <<
fNxup << std::endl;
644 std::cout <<
"fNxlo: " <<
fNxlo << std::endl;
645 std::cout <<
"fMcup: " <<
fMcup << std::endl;
646 std::cout <<
"fMclo: " <<
fMclo << std::endl;
704 if (tmp > norm) norm = tmp;
706 if (tmp > norm) norm = tmp;
708 if (tmp > norm) norm = tmp;
710 if (tmp > norm) norm = tmp;
713 if (tmp > norm) norm = tmp;
715 if (tmp > norm) norm = tmp;
718 if (tmp > norm) norm = tmp;
720 if (tmp > norm) norm = tmp;
723 if (tmp > norm) norm = tmp;
725 if (tmp > norm) norm = tmp;
728 if (tmp > norm) norm = tmp;
730 if (tmp > norm) norm = tmp;
773 if (
this != &source) {
774 TObject::operator=(source);
static Double_t FindBlockingSub(Int_t n, Double_t *w, Int_t incw, Double_t *wstep, Int_t incwstep, Double_t *u, Int_t incu, Double_t *ustep, Int_t incustep, Double_t maxStep, Double_t &w_elt, Double_t &wstep_elt, Double_t &u_elt, Double_t &ustep_elt, Int_t &first_or_second)
See FindBlocking function.
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
virtual Double_t MuStep(TQpVar *step, Double_t alpha)
Compute the complementarity gap resulting from a step of length "alpha" along direction "step"...
Element NormInf() const
Compute the infinity-norm of the vector MAX{ |v[i]| }.
void Print(Option_t *option="") const
Print the vector as a list of elements.
double beta(double x, double y)
Calculates the beta function.
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
virtual Double_t Violation()
The amount by which the current variables violate the non-negativity constraints. ...
virtual Double_t GetMu()
compute complementarity gap, obtained by taking the inner product of the complementary vectors and di...
static Double_t StepBound(TVectorD &v, TVectorD &dir, Double_t maxStep)
Find the maximum stepsize of v in direction dir before violating the nonnegativity constraints...
Bool_t AreCompatible(const TMatrixTBase< Element1 > &m1, const TMatrixTBase< Element2 > &m2, Int_t verbose=0)
Check that matrice sm1 and m2 areboth valid and have identical shapes .
Element Min() const
return minimum vector element value
Element * GetMatrixArray()
virtual void ShiftBoundVariables(Double_t alpha, Double_t beta)
Add alpha to components of (u,t,v,w) and beta to components of (lambda,pi,phi,gamma) ...
virtual Bool_t ValidNonZeroPattern()
Check that the variables conform to the non-zero indices.
TVectorT< Element > & Zero()
Set vector elements to zero.
virtual void Negate()
Perform a "negate" operation on all data vectors : x = -x.
Element Norm1() const
Compute the 1-norm of the vector SUM{ |v[i]| }.
virtual Bool_t IsInteriorPoint()
Is the current position an interior point ?
Int_t NonZeros() const
Compute the number of elements != 0.0.
TVectorT< Element > & SelectNonZeros(const TVectorT< Element > &select)
Keep only element as selected through array select non-zero.
static Double_t FindBlocking(TVectorD &w, TVectorD &wstep, TVectorD &u, TVectorD &ustep, Double_t maxStep, Double_t &w_elt, Double_t &wstep_elt, Double_t &u_elt, Double_t &ustep_elt, int &first_or_second)
See other FindBlocking function.
virtual void Saxpy(TQpVar *b, Double_t alpha)
Perform a "saxpy" operation on all data vectors : x += alpha*y.
virtual void InteriorPoint(Double_t alpha, Double_t beta)
Sets components of (u,t,v,w) to alpha and of (lambda,pi,phi,gamma) to beta.
virtual Double_t Norm1()
Return the sum of the vector-norm1's.
TQpVar()
Default constructor.
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
virtual void Print(Option_t *option="") const
Print class members.
virtual Double_t NormInf()
Return the sum of the vector-normInf's.
Bool_t MatchesNonZeroPattern(const TVectorT< Element > &select)
Check if vector elements as selected through array select are non-zero.
TQpVar & operator=(const TQpVar &source)
Assignment operator.
Int_t fNComplementaryVariables
void AddSomeConstant(Element val, const TVectorT< Element > &select)
Add to vector elements as selected through array select the value val.
Bool_t SomePositive(const TVectorT< Element > &select)
Check if vector elements as selected through array select are all positive.