--- trunk/OOPSE-2.0/src/math/SquareMatrix.hpp 2004/10/15 18:18:12 1576 +++ trunk/OOPSE-2.0/src/math/SquareMatrix.hpp 2004/10/17 01:19:11 1586 @@ -193,114 +193,106 @@ bool SquareMatrix::jacobi(const SquareMatri Vector b, z; // initialize - for (ip=0; ip 4 && (fabs(w(ip))+g) == fabs(w(ip)) - && (fabs(w(iq))+g) == fabs(w(iq))) - { - a(ip, iq) = 0.0; - } - else if (fabs(a(ip, iq)) > tresh) - { - h = w(iq) - w(ip); - if ( (fabs(h)+g) == fabs(h)) t = (a(ip, iq)) / h; - else - { - theta = 0.5*h / (a(ip, iq)); - t = 1.0 / (fabs(theta)+sqrt(1.0+theta*theta)); - if (theta < 0.0) t = -t; - } - c = 1.0 / sqrt(1+t*t); - s = t*c; - tau = s/(1.0+c); - h = t*a(ip, iq); - z(ip) -= h; - z(iq) += h; - w(ip) -= h; - w(iq) += h; - a(ip, iq)=0.0; - for (j=0;j 4 && (fabs(w(ip))+g) == fabs(w(ip)) + && (fabs(w(iq))+g) == fabs(w(iq))) { + a(ip, iq) = 0.0; + } else if (fabs(a(ip, iq)) > tresh) { + h = w(iq) - w(ip); + if ( (fabs(h)+g) == fabs(h)) { + t = (a(ip, iq)) / h; + } else { + theta = 0.5*h / (a(ip, iq)); + t = 1.0 / (fabs(theta)+sqrt(1.0+theta*theta)); - for (ip=0; ip= MAX_ROTATIONS ) - return false; + return false; // sort eigenfunctions - for (j=0; j= tmp) - { - k = i; - tmp = w(k); - } - } - if (k != j) - { - w(k) = w(j); - w(j) = tmp; - for (i=0; i= tmp) { + k = i; + tmp = w(k); + } + } + + if (k != j) { + w(k) = w(j); + w(j) = tmp; + for (i=0; i::jacobi(const SquareMatri // hyperstreamline/other stuff. We will select the most // positive eigenvector. int numPos; - for (j=0; j= 0.0 ) numPos++; - if ( numPos < 2 ) for(i=0; i= 0.0 ) numPos++; + if ( numPos < 2 ) for(i=0; i