Mathc matrices/a89
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);
int c;
for(c=C0; c<TAB; c++)
{
A[c] = i_mR(RCA,RCA);
P[c] = r_mR(i_mR(RCA,RCA),99);
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] : \t\t\t trace = %+.4f ",c,trace_R(A[c]));
p_mR(A[c],S9,P2,C6);
}
for(c=C0; c<TAB; c++)
{
f_mR(A[c]);
f_mR(P[c]);
f_mR(InvP[c]);
}
f_mR(T);
}
/* ------------------------------------ */
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] : trace = +7.0000
-58.00 -9.00 -78.00
-9.00 +78.00 +74.00
-78.00 +74.00 -13.00
A[1] : trace = +7.0000
+92.03 +70.31 -22.98
+90.61 -29.27 +50.45
-84.91 +37.85 -55.76
A[2] : trace = +7.0000
+61.76 -103.32 +130.80
-61.35 +102.40 -132.76
-15.76 +55.18 -157.16
A[3] : trace = +7.0000
+211.20 +361.85 -230.24
+60.72 -88.06 -46.65
+77.66 +440.79 -116.14
Press return to continue
Press X return to stop