6 REAL motion_in[MAXRANK],motion_out[MAXRANK];
9 register unsigned int planetab,planework;
11 REAL v_norm,distance,max_negative_distance,inner_product;
19 v_norm += x[i][j] * x[i][j];
21 v_norm =
sqrt(v_norm);
23 h[i][j][0] = x[i][j] / v_norm;
32 distance += x[i][j] * motion_in[j];
34 if(distance < -
EPS2)
break;
38 for(j=0; j<
MAXRANK; j++) motion_out[j] = motion_in[j];
45 max_negative_distance = 0.0e0;
49 distance += h[i][j][0] * motion_in[j];
51 if(distance < max_negative_distance){
52 max_negative_distance = distance;
57 q[1][j] = motion_in[j] - max_negative_distance * h[l[1]][j][0];
65 distance += h[i][j][0] * q[1][j];
67 if(distance < -
EPS2)
break;
71 for(j=0; j<
MAXRANK; j++) motion_out[j]=q[1][j];
77 for(k=1; k<=MAXRANK-2; k++){
79 inner_product = 0.0e0;
81 inner_product += h[l[k]][j][k-1] * h[i][j][k-1];
84 h[i][j][k] = h[i][j][k-1] - inner_product * h[l[k]][j][k-1];
85 v_norm += h[i][j][k] * h[i][j][k];
88 v_norm =
sqrt(v_norm);
89 for(j=0; j<
MAXRANK; j++) h[i][j][k] = h[i][j][k] / v_norm;
93 max_negative_distance = 0.0e0;
98 distance += h[i][j][k] * q[k][j];
100 if(distance < max_negative_distance){
101 max_negative_distance = distance;
105 distance = 0.0e0; inner_product = 0.0e0;
107 distance += h[l[k+1]][j][0] * q[k][j];
108 inner_product += h[l[k+1]][j][0] * h[l[k+1]][j][k];
111 q[k+1][j] = q[k][j] - distance * h[l[k+1]][j][k] / inner_product;
119 distance += h[i][j][0] * q[k+1][j];
121 if(distance < -
EPS2)
break;
123 if(distance > -
EPS2){
125 for(j=0; j<
MAXRANK; j++) motion_out[j]=q[k+1][j];
133 for(j=0; j<
MAXRANK; j++) motion_out[j]=0.0e0;
projection(x, int n, motion_in, motion_out)