Mathc complexes/a170
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00.c |
---|
/* ------------------------------------ */
/* save as : c00.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = r_mZ(i_mZ(rc,rc),99);
double **b = r_mZ(i_mZ(rc,C1),99);
double **x = i_mZ(rc,C1);
double **A_T = ctranspose_mZ(A, i_mZ(rc,rc));
double **V = X_V_mZ(A_T, i_mZ(rc,rc),FACTOR_E);
double **V_T = ctranspose_mZ(V, i_mZ(rc,rc));
double **U = X_U_mZ(A_T, i_mZ(rc,rc),FACTOR_E);
double **U_T = ctranspose_mZ(U, i_mZ(rc,rc));
double **U_TA = i_mZ(rc,rc);
double **X = mul_mZ(mul_mZ(U_T, A, U_TA), V,i_mZ(rc,rc));
double **invX = X_inv_mZ(X, i_mZ(rc,rc));
double **VinvX = mul_mZ(V, invX, i_mZ(rc,rc));
double **Pinv = mul_mZ(VinvX, U_T, i_mZ(rc,rc));
clrscrn();
printf(" A :");
p_mZ(A, S8,P2, S6,P2, C4);
printf(" b :");
p_mZ(b, S8,P2, S6,P2, C4);
stop();
clrscrn();
printf(" x = inv b ");
mul_mZ(Pinv, b, x);
pE_mZ(x, S12,P4, S12,P4, C4);
printf(" B :");
p_mZ(b, S8,P2, S8,P2, C4);
printf(" Ax :");
p_mZ(mul_mZ(A,x,b), S8,P2, S8,P2, C4);
f_mZ(A);
f_mZ(A_T);
f_mZ(b);
f_mZ(x);
f_mZ(V);
f_mZ(V_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(X);
f_mZ(invX);
f_mZ(VinvX);
f_mZ(Pinv);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+24.00-63.00i -8.00+35.00i -98.00+70.00i -45.00 +5.00i
+19.00 -7.00i +73.00-29.00i +77.00-22.00i +79.00-97.00i
-76.00+21.00i +81.00-28.00i +14.00-91.00i +7.00+59.00i
-33.00+60.00i +60.00 +2.00i -79.00+16.00i -1.00+58.00i
b :
+74.00+58.00i
+31.00-35.00i
+79.00 -1.00i
-17.00 -6.00i
Press return to continue.
x = inv b
-4.3632e-01 +1.8349e+00i
+2.3251e-01 +6.9972e-01i
-4.6561e-01 +1.3836e-01i
+9.6727e-01 -5.6109e-01i
B :
+74.00 +58.00i
+31.00 -35.00i
+79.00 -1.00i
-17.00 -6.00i
Ax :
+74.00 +58.00i
+31.00 -35.00i
+79.00 -1.00i
-17.00 -6.00i
Press return to continue
Press X return to stop