Mathc complexes/a63
Installer et compiler ces fichiers dans votre répertoire de travail.
c02a.c |
---|
/* ------------------------------------ */
/* Xave as : c02a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r,int c)
{
double **A = r_mZ(i_mZ(r,c),99);
double **A_T = ctranspose_mZ(A,i_mZ(c,r));
double **V = i_mZ(r,c);
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
clrscrn();
printf(" A :");
p_mZ(A, S10,P2, S8,P2, 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);
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
p_mZ(X, S10,P4, S9,P4, C3);
f_mZ(A);
f_mZ(A_T);
f_mZ(V);
f_mZ(U);
f_mZ(U_T);
f_mZ(U_TA);
f_mZ(U_TAr);
f_mZ(X);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R3,C2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
-45.00 +16.00i -23.00 -36.00i
+30.00 +70.00i +14.00 +60.00i
-83.00 -4.00i +53.00 +6.00i
U :
+0.3850 -0.2686i -0.2489 -0.1329i
-0.5146 -0.4037i +0.5684 +0.2165i
+0.5931 -0.0000i +0.7419 +0.0000i
V :
+0.2376 +0.9133i -0.0833 -0.3202i
+0.3308 +0.0000i +0.9437 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i
X = U_T * A * V :
+2.4775-126.0690i +0.0000 +0.0000i
+0.0000 -0.0000i +75.0029 +43.8979i
Press return to continue
Press X return to stop