Mathc complexes/a269
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00a.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 **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 **VX = i_mZ(r,c);
double **Q = i_mZ(r,r); // (U * V_T)
double **P = i_mZ(r,r); // (V * S * V_T)
double **QP = i_mZ(r,r);
clrscrn();
printf(" A :");
p_mZ(A, S7,P1, S6,P1, C4);
printf(" U :");
X_U_mZ(A_T,U,FACTOR_E);
p_mZ(U, S8,P4, S7,P4, C4);
printf(" V :");
X_V_mZ(A_T,V,FACTOR_E);
p_mZ(V, S8,P4, S7,P4, C4);
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, S9,P4, S9,P4, C4);
stop();
clrscrn();
ctranspose_mZ(V,V_T);
printf(" Q = U * V_T");
mul_mZ(U,V_T, Q);
p_mZ(Q, S8,P2, S7,P2, C4);
printf(" P = V * X * V_T");
mul_mZ(V,X,VX);
mul_mZ(VX,V_T, P);
p_mZ(P, S8,P2, S7,P2, C4);
stop();
clrscrn();
printf(" A :");
p_mZ(A, S7,P1, S6,P1, C4);
printf(" A = Q P = (U * V_T) (V * X * V_T)");
mul_mZ(Q,P, QP);
p_mZ(QP, S7,P1, S6,P1, C4);
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(VX);
f_mZ(P);
f_mZ(Q);
f_mZ(QP);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(R4,C3); // R*>=C*
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+53.0 +5.0i -77.0 +17.0i +85.0 +18.0i
-43.0 +76.0i -30.0 +20.0i -84.0 +67.0i
-87.0 -82.0i -83.0 -13.0i +99.0 -25.0i
-25.0 -8.0i -57.0 -49.0i +59.0 +42.0i
U :
+0.4086-0.0635i +0.0219-0.5143i -0.1989-0.5305i
-0.3457+0.2263i +0.6124-0.1779i -0.6393+0.0871i
+0.4958-0.5234i +0.3446+0.2127i -0.1639+0.4046i
+0.3721+0.0000i +0.4054+0.0000i +0.2686+0.0000i
V :
+0.0181+0.4798i +0.5054-0.4926i -0.3925-0.3425i
-0.4050+0.1527i -0.0707-0.5942i +0.6414+0.2078i
+0.7630+0.0000i +0.3792+0.0000i +0.5235+0.0000i
+0.0000+0.0000i +0.0000+0.0000i +0.0000+0.0000i
X = U_T * A * V :
+212.2161 +83.4293i +0.0000 -0.0000i +0.0000 -0.0000i
+0.0000 -0.0000i -47.5933+151.7789i -0.0000 +0.0000i
-0.0000 +0.0000i -0.0000 -0.0000i +43.1407 -35.6765i
Press return to continue.
Q = U * V_T
+0.50 -0.31i -0.11 -0.29i +0.22 -0.52i +0.00 +0.00i
+0.72 +0.13i -0.15 +0.53i -0.37 +0.15i +0.00 +0.00i
-0.25 -0.19i -0.45 +0.62i +0.42 -0.11i +0.00 +0.00i
+0.11 +0.11i -0.01 +0.13i +0.58 +0.00i +0.00 +0.00i
P = V * X * V_T
+36.92 +85.16i -51.53 -7.71i -23.64+116.42i +0.00 +0.00i
+27.18+119.76i +42.32 +53.77i -21.45 -1.68i +0.00 +0.00i
-6.46 -41.27i -78.17 -81.97i +128.52 +60.61i +0.00 +0.00i
+0.00 +0.00i +0.00 +0.00i +0.00 +0.00i +0.00 +0.00i
Press return to continue.
A :
+53.0 +5.0i -77.0 +17.0i +85.0 +18.0i
-43.0 +76.0i -30.0 +20.0i -84.0 +67.0i
-87.0 -82.0i -83.0 -13.0i +99.0 -25.0i
-25.0 -8.0i -57.0 -49.0i +59.0 +42.0i
A = Q P = (U * V_T) (V * X * V_T)
+53.0 +5.0i -77.0 +17.0i +85.0 +18.0i +0.0 +0.0i
-43.0 +76.0i -30.0 +20.0i -84.0 +67.0i +0.0 +0.0i
-87.0 -82.0i -83.0 -13.0i +99.0 -25.0i +0.0 +0.0i
-25.0 -8.0i -57.0 -49.0i +59.0 +42.0i +0.0 +0.0i
Press return to continue
Press X return to stop