Mathc complexes/a87
Installer et compiler ces fichiers dans votre répertoire de travail.
c03a.c |
---|
/* ------------------------------------ */
/* Xave as : c03a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RA R3
#define CA C2
#define FACTOR_E +1.E-2
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
int r = RA;
int c = CA;
double a[RA*(CA*C2)] ={ 1,2, 3,4,
5,4, 1,3,
7,2, 5,1};
double **A = ca_A_mZ(a, i_mZ(r,c));
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);
stop();
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);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Diagonaliser une matrice avec un nombre de lignes supérieur ou égal aux nombres de colonnes Exemple de sortie écran :
A :
+1.00 +2.00i +3.00 +4.00i
+5.00 +4.00i +1.00 +3.00i
+7.00 +2.00i +5.00 +1.00i
U :
+0.2940 +0.2567i -0.6119 +0.4960i
+0.4702 +0.3112i +0.1304 -0.5579i
+0.7278 +0.0000i +0.2265 -0.0000i
V :
+0.7964 +0.0735i -0.5977 -0.0552i
+0.6002 -0.0000i +0.7998 +0.0000i
+0.0000 +0.0000i +0.0000 +0.0000i
X = U_T * A * V :
+11.5820 +3.7205i +0.0000 -0.0000i
-0.0000 +0.0000i -0.3277 -3.4507i
Press return to continue.