38 const Int_t nRows = a.GetNrows();
39 const Int_t rowLwb = a.GetRowLwb();
41 fEigenValues.ResizeTo(rowLwb,rowLwb+nRows-1);
42 fEigenVectors.ResizeTo(a);
48 if (nRows > kWorkMax) offDiag.
ResizeTo(nRows);
49 else offDiag.
Use(nRows,work);
52 MakeTridiagonal(fEigenVectors,fEigenValues,offDiag);
55 MakeEigenVectors(fEigenVectors,fEigenValues,offDiag);
80 Int_t off_n1 = (n-1)*n;
81 for (j = 0; j <
n; j++)
86 for (i = n-1; i > 0; i--) {
87 const Int_t off_i1 = (i-1)*n;
94 for (k = 0; k < i; k++)
98 for (j = 0; j < i; j++) {
100 pD[j] = pV[off_i1+j];
108 for (k = 0; k < i; k++) {
119 for (j = 0; j < i; j++)
124 for (j = 0; j < i; j++) {
128 g = pE[j]+pV[off_j+j]*
f;
129 for (k = j+1; k <= i-1; k++) {
131 g += pV[off_k+j]*pD[k];
132 pE[k] += pV[off_k+j]*
f;
137 for (j = 0; j < i; j++) {
142 for (j = 0; j < i; j++)
144 for (j = 0; j < i; j++) {
147 for (k = j; k <= i-1; k++) {
149 pV[off_k+j] -= (f*pE[k]+g*pD[k]);
151 pD[j] = pV[off_i1+j];
160 for (i = 0; i < n-1; i++) {
162 pV[off_n1+i] = pV[off_i+i];
166 for (k = 0; k <= i; k++) {
168 pD[k] = pV[off_k+i+1]/
h;
170 for (j = 0; j <= i; j++) {
172 for (k = 0; k <= i; k++) {
174 g += pV[off_k+i+1]*pV[off_k+j];
176 for (k = 0; k <= i; k++) {
178 pV[off_k+j] -= g*pD[k];
182 for (k = 0; k <= i; k++) {
187 for (j = 0; j <
n; j++) {
188 pD[j] = pV[off_n1+j];
191 pV[off_n1+n-1] = 1.0;
210 for (i = 1; i <
n; i++)
217 for (l = 0; l <
n; l++) {
239 Error(
"MakeEigenVectors",
"too many iterations");
246 Double_t p = (pD[l+1]-g)/(2.0*pE[l]);
251 pD[l+1] = pE[
l]*(p+
r);
254 for (i = l+2; i <
n; i++)
267 for (i = m-1; i >=
l; i--) {
278 pD[i+1] = h+s*(c*g+s*pD[i]);
282 for (k = 0; k <
n; k++) {
285 pV[off_k+i+1] = s*pV[off_k+i]+c*
h;
286 pV[off_k+i] = c*pV[off_k+i]-s*
h;
289 p = -s*s2*c3*el1*pE[
l]/dl1;
303 for (i = 0; i < n-1; i++) {
306 for (j = i+1; j <
n; j++) {
315 for (j = 0; j <
n; j++) {
318 pV[off_j+i] = pV[off_j+k];
330 if (
this != &source) {
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
static void MakeEigenVectors(TMatrixD &v, TVectorD &d, TVectorD &e)
Symmetric tridiagonal QL algorithm.
virtual const Element * GetMatrixArray() const
TMatrixDSymEigen & operator=(const TMatrixDSymEigen &source)
Assignment operator.
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...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
void Error(const char *location, const char *msgfmt,...)
Element * GetMatrixArray()
static void MakeTridiagonal(TMatrixD &v, TVectorD &d, TVectorD &e)
This is derived from the Algol procedures tred2 by Bowdler, Martin, Reinsch, and Wilkinson, Handbook for Auto.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Double_t Hypot(Double_t x, Double_t y)
Short_t Max(Short_t a, Short_t b)
Double_t Sqrt(Double_t x)