31 void ftfInvertMatrix (
int n,
double *h ) {
32 static double detm, dmax_, temp;
33 static int i, j, k, l;
34 static int ik[3], jk[3];
38 for (k = 0 ; k < n ; ++k) {
45 for (i = k; i < n; ++i) {
47 for (j = k; j < n; ++j) {
48 if (fabs(dmax_) <= fabs(h[i+j*3]))
56 if (dmax_ == (
double)0.) {
64 for (j = 0 ; j < n; ++j) {
66 h[k + j * 3] = h[i + j * 3];
67 h[i + j * 3] = -(double)temp;
74 for (i = 0 ; i < n; ++i) {
76 h[i + k * 3] = h[i + j * 3];
77 h[i + j * 3] = -(double)temp;
81 for (i = 0 ; i < n; ++i) {
83 h[i + k * 3] = -(double)h[i + k * 3] / dmax_;
87 for (i = 0; i < n; ++i) {
89 for (j = 0; j < n; ++j) {
90 if (i != k && j != k) {
91 h[i + j * 3] += h[i + k * 3] * h[k + j * 3];
95 for (j = 0; j < n; ++j) {
97 h[k + j * 3] /= dmax_;
100 h[k + k * 3] = 1.F / dmax_;
103 for (l = 0; l < n; ++l) {
107 for (i = 0; i < n; ++i) {
109 h[i + k * 3] = -(double)h[i + j * 3];
115 for (j = 0; j < n; ++j) {
117 h[k + j * 3] = -(double)h[i + j * 3];
130 void ftfMatrixDiagonal (
double *h,
double &h11,
double &h22,
double &h33 ){
133 f1 = h[5]*h[6]-h[8]*h[1] ;
134 f2 = h[4]*h[8]-h[5]*h[5] ;
135 f3 = h[8]*h[0]-h[2]*h[2] ;
136 h11 = double(h[8] / ( f3 - f1 * f1 / f2 )) ;
138 f1 = h[2]*h[1]-h[0]*h[5] ;
139 f2 = h[8]*h[0]-h[2]*h[2] ;
140 f3 = h[0]*h[4]-h[1]*h[1] ;
141 h22 = double(h[0] / ( f3 - f1 * f1 / f2 )) ;
143 f1 = h[1]*h[5]-h[4]*h[2] ;
144 f2 = h[0]*h[4]-h[1]*h[1] ;
145 f3 = h[4]*h[8]-h[7]*h[7] ;
146 h33 = double(h[4] / ( f3 - f1 * f1 / f2 )) ;