Mathc complexes/044
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-12
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r,int c)
{
double **A = rE_mZ( i_mZ(r,c), 999999999, 1E+3 );
double **Acc = i_mZ(c,c);
double **V = i_mZ(c,r);
double **U = i_mZ(c,r);
double **V_T = i_mZ(r,c);
double **V_TAcc = i_mZ(r,c);
double **X = i_mZ(r,r);
double **invX = i_mZ(r,r);
double **UinvX = i_mZ(c,r);
double **Pinv = i_mZ(c,c);
double **APinv = i_mZ(r,c);
clrscrn();
printf(" A :");
p_mZ(A, S18,P2, S17,P2, C2);
stop();
clrscrn();
printf(" A :");
pE_mZ(A, S12,P3, S11,P3, C3);
printf(" U :");
X_U_mZ(A,U,FACTOR_E);
p_mZ(U, S10,P4, S8,P4, C3);
printf(" V :");
X_V_mZ(A,V,FACTOR_E);
p_mZ(V, S10,P4, S8,P4, C3);
ctranspose_mZ(V,V_T);
stop();
clrscrn();
printf(" X = V_T * A * U :");
c_mZ(A, Acc);
mul_mZ(V_T, Acc, V_TAcc);
mul_mZ(V_TAcc, U, X);
pE_mZ(X, S10,P4, S9,P4, C3);
printf(" invX :");
X_inv_mZ(X, invX);
pE_mZ(invX, S10,P4, S8,P4, C3);
stop();
clrscrn();
printf(" Pinv = U * invX * V_T:");
mul_mZ(U,invX,UinvX);
mul_mZ(UinvX,V_T,Pinv);
pE_mZ(Pinv, S10,P4, S8,P4, C3);
printf(" Ide = A * Pinv");
mul_mZ(A,Pinv,APinv);
p_mZ(APinv, S8,P3, S5,P3, C6);
f_mZ(A);
f_mZ(Acc);
f_mZ(U);
f_mZ(V);
f_mZ(V_T);
f_mZ(V_TAcc);
f_mZ(X);
f_mZ(APinv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R3,C5);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+186765322000.00 -70820385000.00i +331285289000.00 -826818995000.00i
-214763435000.00 -702522264000.00i -477864586000.00 +254841326000.00i
-165348475000.00 +432166791000.00i +638343874000.00 +981126259000.00i
-727051807000.00 +985130048000.00i +907658252000.00 +443901584000.00i
+558710533000.00 +19762688000.00i +193036260000.00 -530535344000.00i
-832477543000.00 -644235252000.00i -571407465000.00 -99183198000.00i
+647370769000.00 +529101291000.00i
-664511076000.00 +543284822000.00i
-253187876000.00 -916425447000.00i
Press return to continue.
A :
+1.868e+11 -7.082e+10i +3.313e+11 -8.268e+11i -7.271e+11 +9.851e+11i
-2.148e+11 -7.025e+11i -4.779e+11 +2.548e+11i +5.587e+11 +1.976e+10i
-1.653e+11 +4.322e+11i +6.383e+11 +9.811e+11i -8.325e+11 -6.442e+11i
+9.077e+11 +4.439e+11i +6.474e+11 +5.291e+11i
+1.930e+11 -5.305e+11i -6.645e+11 +5.433e+11i
-5.714e+11 -9.918e+10i -2.532e+11 -9.164e+11i
U :
-0.0604 +0.2405i -0.1934 -0.2585i +0.2153 -0.3676i
-0.5525 +0.1377i +0.0384 +0.0188i -0.0466 +0.4260i
+0.5775 -0.1744i -0.2208 +0.0808i +0.4938 +0.1628i
+0.2624 +0.3608i +0.1055 -0.0629i -0.4791 -0.3604i
+0.2267 +0.0000i +0.9075 +0.0000i +0.0707 +0.0000i
V :
-0.4205 -0.5256i -0.0249 +0.5029i +0.5050 +0.1959i
-0.1697 +0.2725i -0.4947 -0.5288i +0.5990 +0.1172i
+0.6662 +0.0000i +0.4713 +0.0000i +0.5779 -0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
Press return to continue.
X = V_T * A * U :
-2.0208e+12-1.7814e+12i +1.2207e-04+6.1035e-04i +3.9291e-04+2.0981e-04i
+6.1035e-05-4.8828e-04i +1.8958e+11-1.5326e+12i -1.1444e-04-1.3733e-04i
+4.2915e-04-1.3494e-04i -1.9073e-04+7.3433e-04i -7.1022e+11+1.9905e+11i
invX :
-2.7846e-13+2.4547e-13i +0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +7.9496e-14+6.4266e-13i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i -1.3055e-12-3.6588e-13i
Press return to continue.
Pinv = U * invX * V_T:
-1.4714e-13+2.2397e-13i -2.1503e-13+4.6580e-13i -1.9724e-13+1.0909e-13i
+5.8193e-14-1.7451e-13i -1.0483e-14-3.6921e-13i +2.0094e-13-4.1510e-13i
-4.8936e-13-1.8772e-13i -2.1869e-13-1.3687e-13i -4.4951e-13-1.6434e-13i
+4.9306e-13+1.3357e-13i +3.3163e-13+3.7397e-13i +2.0060e-13+3.7881e-13i
+2.3712e-13-1.0238e-13i -3.7653e-13-2.4727e-13i -6.1388e-14+2.9699e-13i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
Ide = A * Pinv
+1.000+0.000i +0.000+0.000i -0.000+0.000i +0.000+0.000i +0.000+0.000i
-0.000-0.000i +1.000-0.000i +0.000-0.000i +0.000+0.000i +0.000+0.000i
-0.000+0.000i +0.000-0.000i +1.000+0.000i +0.000+0.000i +0.000+0.000i
Press return to continue
Press X return to stop