Mathc matrices/a84
Apparence
Fonctions matricielles ex : cos(A)
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
|---|
/* ------------------------------------ */
/* Save as: c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC5
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rEsymmetric_mR( i_mR(RCA,RCA),555.,1E-3);
double **cosA = i_mR(RCA,RCA);
double **cosA_EValue = i_mR(RCA,RCA);
double **EVector = i_mR(RCA,RCA);
double **EVectorT = i_mR(RCA,RCA);
double **EValue = i_mR(RCA,RCA);
double **cos_EValue = i_mR(RCA,RCA);
double **T1 = i_mR(RCA,RCA);
clrscrn();
printf(" A:");
p_mR(A,S10,P4,C6);
/* ================================================================== */
eigs_V_mR(A,EVector);
transpose_mR(EVector,EVectorT);
/* EValue = EVectorT A EVector */
mul_mR(EVectorT,A,T1);
mul_mR(T1,EVector,EValue);
printf(" cos(A):");
f_eigs_mR(cos,EValue,cos_EValue);
/* cosA = EVector cos_EValue EVectorT */
mul_mR(EVector,cos_EValue,T1);
mul_mR(T1,EVectorT, cosA);
p_mR(cosA,S10,P4,C6);
/* ================================================================== */
eigs_V_mR(cosA,EVector);
transpose_mR(EVector,EVectorT);
/* cosA_EValue = EVectorT cosA EVector */
mul_mR(EVectorT, cosA,T1);
mul_mR(T1,EVector,cosA_EValue);
printf(" acos(cos(A)) = A:");
f_eigs_mR(acos,cosA_EValue,EValue);
/* A = EVector EValue EVectorT */
mul_mR(EVector,EValue,T1);
mul_mR(T1,EVectorT,A);
p_mR(A,S10,P4,C6);
f_mR(A);
f_mR(cosA);
f_mR(cosA_EValue);
f_mR(EVector);
f_mR(EVectorT);
f_mR(EValue);
f_mR(cos_EValue);
f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
A :
+1.2225 +0.0339 -0.4158 +0.1573 -0.0851
+0.0339 +0.5625 -0.1019 +0.0654 +0.2680
-0.4158 -0.1019 +0.6113 -0.3534 +0.3801
+0.1573 +0.0654 -0.3534 +0.3669 -0.3120
-0.0851 +0.2680 +0.3801 -0.3120 +0.7082
cos(A) :
+0.3005 -0.0394 +0.3277 -0.1555 +0.1205
-0.0394 +0.8082 +0.0281 -0.0111 -0.1286
+0.3277 +0.0281 +0.6664 +0.2185 -0.2502
-0.1555 -0.0111 +0.2185 +0.8390 +0.1928
+0.1205 -0.1286 -0.2502 +0.1928 +0.6463
acos(cos(A)) = A :
+1.2225 +0.0339 -0.4158 +0.1573 -0.0851
+0.0339 +0.5625 -0.1019 +0.0654 +0.2680
-0.4158 -0.1019 +0.6113 -0.3534 +0.3801
+0.1573 +0.0654 -0.3534 +0.3669 -0.3120
-0.0851 +0.2680 +0.3801 -0.3120 +0.7082
Press return to continue
Press X return to stop