Mathc complexes/017
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A = rdiag_mZ( i_mZ(r,r),99);
double **A_T = ctranspose_mZ(A,i_mZ(r,r));
double **V = i_mZ(r,r);
double **V_T = i_mZ(r,r);
double **U = i_mZ(r,r);
double **U_T = i_mZ(r,r);
double **X = i_mZ(r,r);
double **T = i_mZ(r,r);
clrscrn();
printf(" A :");
p_mZ(A, S10,P2, S8,P2, C4);
printf(" U :");
X_U_mZ(A_T,U,FACTOR_E);
p_mZ(U, S10,P4, S8,P4, C4);
printf(" V :");
X_V_mZ(A_T,V,FACTOR_E);
p_mZ(V, S10,P4, S8,P4, C4);
ctranspose_mZ(U,U_T);
ctranspose_mZ(V,V_T);
stop();
clrscrn();
printf(" X = U_T * A * V :");
mul_mZ(U_T, A, T);
mul_mZ(T, V, X);
p_mZ(X, S10,P4, S8,P4, C4);
printf(" A :");
p_mZ(A, S10,P2, S8,P2, C4);
printf(" A = U * X * V_T ");
mul_mZ(U, X, T);
mul_mZ(T, V_T, A);
p_mZ(A, S10,P2, S8,P2, C4);
f_mZ(A);
f_mZ(A_T);
f_mZ(V);
f_mZ(V_T);
f_mZ(U);
f_mZ(U_T);
f_mZ(X);
f_mZ(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La X décomposition d'une matrice diagonale
Exemple de sortie écran :
A :
-72.00 +38.00i +0.00 +0.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i -83.00 -52.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i -52.00 -5.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i +0.00 +0.00i -77.00 +82.00i
U :
+1.0000 +0.0000i +0.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 +1.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i
V :
+1.0000 +0.0000i +0.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 +1.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i +1.0000 +0.0000i
Press return to continue.
X = U_T * A * V :
-72.0000+38.0000i +0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i -83.0000-52.0000i +0.0000 +0.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i -52.0000 -5.0000i +0.0000 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i +0.0000 +0.0000i -77.0000+82.0000i
A :
-72.00 +38.00i +0.00 +0.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i -83.00 -52.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i -52.00 -5.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i +0.00 +0.00i -77.00 +82.00i
A = U * X * V_T
-72.00 +38.00i +0.00 +0.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i -83.00 -52.00i +0.00 +0.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i -52.00 -5.00i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i +0.00 +0.00i -77.00 +82.00i
Press return to continue
Press X return to stop