Mathc complexes/a270
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* ------------------------------------ */
/* Save as : c00b.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);
printf(" det(A) \t= ");
p_Z(det_Z(A), S4,P1, S5,P1);printf("\n");
printf(" det(Q) det(P)\t= ");
p_Z(mul_Z(det_Z(P),det_Z(Q)), S4,P1, S5,P1);printf("\n\n");
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(R3,C3); // R*=C*
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
-37.0 -61.0i -90.0 -3.0i -22.0 -17.0i
+29.0 +59.0i -66.0 +29.0i -33.0 -56.0i
-74.0 +28.0i -88.0 +86.0i -40.0 +28.0i
U :
+0.2990+0.4785i +0.0758+0.2901i -0.3877-0.6644i
+0.3032+0.0561i -0.8806-0.3294i -0.1440+0.0166i
+0.7658+0.0000i +0.1619-0.0000i +0.6223-0.0000i
V :
+0.4542+0.0990i -0.6681-0.4189i +0.3048+0.2629i
+0.6809+0.4802i +0.0888+0.2450i -0.3271-0.3618i
+0.2995-0.0000i +0.5570+0.0000i +0.7746+0.0000i
X = U_T * A * V :
-195.3102 +39.2749i +0.0000 +0.0000i +0.0000 -0.0000i
-0.0000 -0.0000i +61.8142 +86.2957i +0.0000 -0.0000i
+0.0000 +0.0000i -0.0000 -0.0000i -1.6099 +23.2567i
Press return to continue.
Q = U * V_T
-0.28 -0.07i +0.88 +0.27i -0.17 -0.21i
+0.83 -0.11i +0.12 +0.02i -0.51 -0.15i
+0.43 -0.17i +0.33 -0.18i +0.80 -0.00i
P = V * X * V_T
-4.03 +65.92i -84.94 +32.72i -35.72 -41.82i
-73.83 -41.71i -131.77 +38.66i -47.27 -12.82i
-64.19 -0.74i -25.46 +25.59i +0.69 +44.25i
Press return to continue.
A :
-37.0 -61.0i -90.0 -3.0i -22.0 -17.0i
+29.0 +59.0i -66.0 +29.0i -33.0 -56.0i
-74.0 +28.0i -88.0 +86.0i -40.0 +28.0i
A = Q P = (U * V_T) (V * X * V_T)
-37.0 -61.0i -90.0 -3.0i -22.0 -17.0i
+29.0 +59.0i -66.0 +29.0i -33.0 -56.0i
-74.0 +28.0i -88.0 +86.0i -40.0 +28.0i
det(A) = -413262.0+268806.0i
det(Q) det(P) = -413262.0+268806.0i
Press return to continue
Press X return to stop