Mathc matrices/a91
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define TAB R4
#define RCA R3
/* ------------------------------------ */
void fun(void)
{
double **A[TAB];
double **P[TAB];
double **InvP[TAB];
double **T = i_mR(RCA,RCA);
double **EigsValue = i_mR(RCA,C1);
int c;
for(c=C0; c<TAB; c++)
{
A[c] = i_mR(RCA,RCA);
P[c] = r_mR(i_mR(RCA,RCA),999);
InvP[c] = inv_mR(P[c],i_mR(RCA,RCA));
}
rsymmetric_mR(A[0],99);
for(c=C0; c<(TAB-C1); c++)
{
mul_mR(InvP[c],A[c],T);
mul_mR(T,P[c],A[c+C1]);
}
clrscrn();
for(c=C0; c<TAB; c++)
{
printf(" A[%d] : ",c);
p_mR(A[c],S9,P2,C6);
printf(" EigsValue of A[%d] : ",c);
eigs_mR(A[c],EigsValue);
p_mR(EigsValue,S9,P2,C6);
stop();
}
for(c=C0; c<TAB; c++)
{
f_mR(A[c]);
f_mR(P[c]);
f_mR(InvP[c]);
}
f_mR(T);
f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do{
fun();
}while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Je crée une suite de quatre Matrices semblables.
Exemple de sortie écran :
--------------------------------
A[0] :
-17.00 +3.00 +51.00
+3.00 +48.00 +86.00
+51.00 +86.00 +47.00
EigsValue of A[0] :
+142.95
-66.17
+1.22
Press return to continue.
A[1] :
-47.50 -108.52 +135.86
-35.99 -95.63 +63.83
-78.10 -172.95 +221.14
EigsValue of A[1] :
+142.95
-66.17
+1.22
Press return to continue.
A[2] :
-901.12 -1512.56 -1068.96
+225.86 +389.05 +268.46
+495.55 +849.22 +590.07
EigsValue of A[2] :
+142.95
-66.17
+1.22
Press return to continue.
A[3] :
+2675.53 +2494.45 +5815.56
-1963.25 -1833.19 -4264.38
-353.24 -331.18 -764.34
EigsValue of A[3] :
+142.95
-66.17
+1.22
Press return to continue
Press X return to stop