Mathc complexes/a274
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00d.c |
---|
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E +1.E-2
#define RCA RC4
/* ------------------------------------ */
void fun(void)
{
double **A = r_mZ( i_mZ(RCA,RCA),99);
double **A_T = ctranspose_mZ(A, i_mZ(RCA,RCA) );
double **A_TA = mul_mZ(A_T,A, i_mZ(RCA,RCA) );
double **P = i_mZ(RCA,RCA);
double **invP = i_mZ(RCA,RCA);
double **U = i_mZ(RCA,RCA);
double **EigsVector = i_mZ(RCA,RCA);
double **EigsVector_T = i_mZ(RCA,RCA);
double **EigsValue = i_mZ(RCA,RCA);
double **SqrtEigsValue = i_mZ(RCA,RCA);
double **T = i_mZ(RCA,RCA);
clrscrn();
printf(" A :");
p_mZ(A, S7,P0, S7,P0, C6);
printf(" A_TA :");
p_mZ(A_TA, S7,P0, S7,P0, C6);
/* EigsVector and EigsVector_T*/
eigs_V_mZ(A_TA,EigsVector,FACTOR_E);
ctranspose_mZ(EigsVector,EigsVector_T);
/* EigsValue = EigsVector_T * A_TA * EigsVector */
mul_mZ(EigsVector_T,A_TA,T);
mul_mZ(T,EigsVector,EigsValue);
f_eigs_mZ(sqrt,EigsValue,SqrtEigsValue);
/* P = EigsVector * sqrt(EigsValue) * EigsVector_T*/
mul_mZ(EigsVector,SqrtEigsValue,T);
mul_mZ(T,EigsVector_T,P);
printf(" P = (A_TA)**(1/2)\n"
" = EigsVector * sqrt(EigsValue) * EigsVector_T");
p_mZ(P, S9,P3, S8,P3, C6);
stop();
clrscrn();
mul_mZ(A,inv_mZ(P,invP),U);
printf(" U = A*invP");
p_mZ(U, S9,P3, S8,P3, C6);
printf(" A :");
p_mZ(A, S7,P1, S7,P1, C6);
printf(" A = U*P");
p_mZ(mul_mZ(U,P,A), S7,P1, S7,P1, C6);
stop();
clrscrn();
/* det(A) = det(U) det(P) */
printf(" det(A) \t= ");
p_Z(det_Z(A), S4,P0, S5,P0);printf("\n");
printf(" det(U) det(P)\t= ");
p_Z(mul_Z(det_Z(U),det_Z(P)), S4,P0, S5,P0);printf("\n\n\n");
f_mZ(A);
f_mZ(A_T);
f_mZ(A_TA);
f_mZ(P);
f_mZ(invP);
f_mZ(U);
f_mZ(EigsVector);
f_mZ(EigsVector_T);
f_mZ(T);
f_mZ(SqrtEigsValue);
f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
A :
+84 -70i -97 -6i -42 -19i -78 +76i
+73 -15i +54 -59i -95 +5i +9 +1i
+85 -18i +51 -65i -90 +93i +24 +26i
-17 -76i -38 +16i +55 -47i -98 -53i
A_TA :
+31124 +0i +2034 -18558i -15895 +5668i -3964 -2773i
+2034 +18558i +24368 +0i -14714 -3945i +9947 -787i
-15895 -5668i -14714 +3945i +33158 +0i -1659 -16907i
-3964 +2773i +9947 +787i -1659 +16907i +25607 +0i
P = (A_TA)**(1/2)
= EigsVector * sqrt(EigsValue) * EigsVector_T
+156.371 +0.000i -1.111 -58.677i -52.415 +10.941i -13.314 -13.549i
-1.111 +58.677i +128.274 -0.000i -53.194 -11.556i +36.583 -12.963i
-52.415 -10.941i -53.194 +11.556i +152.142 +0.000i -1.412 -64.642i
-13.314 +13.549i +36.583 +12.963i -1.412 +64.642i +139.854 +0.000i
Press return to continue.
------------------------------------
U = A*invP
+0.529 -0.223i -0.602 +0.042i -0.138 -0.156i -0.262 +0.441i
+0.150 -0.399i +0.276 -0.510i -0.504 -0.386i +0.266 -0.094i
+0.411 -0.047i +0.485 -0.052i -0.199 +0.681i -0.223 +0.194i
-0.057 -0.561i +0.158 +0.195i +0.166 -0.149i -0.641 -0.399i
A :
+84.0 -70.0i -97.0 -6.0i -42.0 -19.0i -78.0 +76.0i
+73.0 -15.0i +54.0 -59.0i -95.0 +5.0i +9.0 +1.0i
+85.0 -18.0i +51.0 -65.0i -90.0 +93.0i +24.0 +26.0i
-17.0 -76.0i -38.0 +16.0i +55.0 -47.0i -98.0 -53.0i
A = U*P
+84.0 -70.0i -97.0 -6.0i -42.0 -19.0i -78.0 +76.0i
+73.0 -15.0i +54.0 -59.0i -95.0 +5.0i +9.0 +1.0i
+85.0 -18.0i +51.0 -65.0i -90.0 +93.0i +24.0 +26.0i
-17.0 -76.0i -38.0 +16.0i +55.0 -47.0i -98.0 -53.0i
Press return to continue.
------------------------------------
det(A) = -85641915-119518136i
det(U) det(P) = -85641915-119518136i
Press return to continue
Press X return to stop