Mathc complexes/042
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 **A_T = ctranspose_mZ(A,i_mZ(c,r));
double **V = i_mZ(r,c);
double **V_T = i_mZ(c,r);
double **U = i_mZ(r,c);
double **U_T = i_mZ(c,r); // :c,r
double **U_TA = i_mZ(c,c); // c,r r,c :c,c
double **U_TAr = i_mZ(c,r); // c,r :c,r
double **X = i_mZ(c,c); // c,r r,c :c,c U_TArV
double **invX = i_mZ(c,c); // c,r r,c :c,c invX
double **VinvX = i_mZ(r,c);
double **Pinv = i_mZ(r,r);
double **PinvA = i_mZ(r,c); // r,c | r,r
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_T,U,FACTOR_E);
p_mZ(U, S10,P4, S8,P4, C3);
printf(" V :");
X_V_mZ(A_T,V,FACTOR_E);
p_mZ(V, S10,P4, S8,P4, C3);
ctranspose_mZ(U,U_T);
ctranspose_mZ(V,V_T);
stop();
clrscrn();
printf(" X = U_T * A * V :");
mul_mZ(U_T, A, U_TA); // U_TA : c,c
c_mZ(U_TA, U_TAr); // U_TAr : c,r
mul_mZ(U_TAr, V, X); // V : r,c
pE_mZ(X, S11,P4, S9,P4, C3);
printf(" invX :");
X_inv_mZ(X, invX);
pE_mZ(invX, S10,P4, S8,P4, C3);
stop();
clrscrn();
printf(" Pinv = V * invX * U_T:");
mul_mZ(V,invX,VinvX);
mul_mZ(VinvX,U_T,Pinv);
pE_mZ(Pinv, S14,P4, S12,P4, C2);
stop();
clrscrn();
printf(" Ide = Pinv * A ");
mul_mZ(Pinv,A,PinvA);
p_mZ(PinvA, S8,P4, S8,P4, C3);
f_mZ(A);
f_mZ(A_T);
f_mZ(V);
f_mZ(V_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(U_TAr);
f_mZ(X);
f_mZ(invX);
f_mZ(VinvX);
f_mZ(Pinv);
f_mZ(PinvA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R5,C3);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
-441907642000.00 -219583600000.00i -643363689000.00 -519685902000.00i
-62205268000.00 -402605882000.00i -107967627000.00 +726151129000.00i
+926323965000.00 -795364532000.00i -354847051000.00 +46262483000.00i
+942053363000.00 +44454405000.00i -489803656000.00 -324979397000.00i
+90302995000.00 -753635832000.00i +993818644000.00 -112893345000.00i
-171584811000.00 -643735437000.00i
+551392121000.00 -301893604000.00i
+339804286000.00 +900350139000.00i
+86740790000.00 +218191284000.00i
-969939024000.00 +678528971000.00i
Press return to continue.
A :
-4.419e+11 -2.196e+11i -6.434e+11 -5.197e+11i -1.716e+11 -6.437e+11i
-6.221e+10 -4.026e+11i -1.080e+11 +7.262e+11i +5.514e+11 -3.019e+11i
+9.263e+11 -7.954e+11i -3.548e+11 +4.626e+10i +3.398e+11 +9.004e+11i
+9.421e+11 +4.445e+10i -4.898e+11 -3.250e+11i +8.674e+10 +2.182e+11i
+9.030e+10 -7.536e+11i +9.938e+11 -1.129e+11i -9.699e+11 +6.785e+11i
U :
-0.2311 +0.0717i -0.2128 -0.1582i +0.8004 +0.3242i
-0.3514 -0.1576i +0.0217 +0.3122i -0.2112 -0.1139i
+0.2922 -0.6415i +0.0294 +0.2422i +0.0302 -0.0242i
+0.3153 -0.2373i -0.3279 +0.1354i +0.0414 +0.3278i
+0.3748 +0.0000i +0.8040 +0.0000i +0.2934 -0.0000i
V :
-0.1985 +0.6040i -0.1311 -0.5695i +0.3001 -0.4052i
-0.2620 -0.1066i -0.5371 +0.5153i +0.5871 -0.1461i
+0.7182 +0.0000i +0.3232 -0.0000i +0.6162 +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 = U_T * A * V :
-1.4187e+12+1.6413e+12i -3.2349e-03+5.0659e-03i +6.1035e-04-3.6621e-04i
+8.8501e-03-6.1340e-03i -1.5301e+12+1.0441e+12i -1.8311e-04-2.1362e-04i
+3.3569e-03+8.5449e-04i +5.7983e-04-2.2125e-04i -1.0533e+12-1.9135e+11i
invX :
-3.0144e-13-3.4872e-13i +0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i -4.4591e-13-3.0428e-13i +0.0000e+00+0.0000e+00i
+0.0000e+00+0.0000e+00i +0.0000e+00+0.0000e+00i -9.1908e-13+1.6697e-13i
Press return to continue.
Pinv = V * invX * U_T:
-1.2229e-13 +3.3170e-13i +7.7967e-15 +1.1518e-14i
-4.1166e-13 +3.9823e-13i +3.6063e-14 -2.6971e-13i
-3.4160e-13 +3.3745e-13i +1.8960e-13 +1.0498e-14i
+0.0000e+00 +0.0000e+00i +0.0000e+00 +0.0000e+00i
+0.0000e+00 +0.0000e+00i +0.0000e+00 +0.0000e+00i
+2.0268e-13 +1.8471e-13i +3.1942e-13 +3.3508e-14i
-9.2629e-14 -4.0480e-14i -1.0022e-13 +1.9543e-13i
+4.9761e-14 -1.9063e-13i +3.5424e-14 +1.1134e-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
-5.2030e-14 +3.1791e-13i
+1.8313e-13 +6.1091e-14i
-3.6317e-13 -1.4275e-13i
+0.0000e+00 +0.0000e+00i
+0.0000e+00 +0.0000e+00i
Press return to continue.
Ide = Pinv * A
+1.0000 -0.0000i +0.0000 -0.0000i -0.0000 +0.0000i
-0.0000 -0.0000i +1.0000 +0.0000i +0.0000 -0.0000i
+0.0000 +0.0000i -0.0000 -0.0000i +1.0000 -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
Press X return to stop