Mathc matrices/a100
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A = r_mR( i_mR(rc,rc),9);
double **A_t = transpose_mR(A,i_mR(rc,rc) );
clrscrn();
printf(" A\n");
p_mR(A,S3,P0,C6);
printf(" A_t\n");
p_mR(A_t,S3,P0,C6);
printf("\n"
" Trace(A ) = %+.0f\n"
" Trace(A_t) = %+.0f\n", trace_R(A), trace_R(A_t));
f_mR(A);
f_mR(A_t);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(RC5));
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La fonction trace se contente d'additionner tous les coefficients sur la diagonale.
Exemple de sortie écran :
A
+2 +8 +2 +3 -4
-8 -8 +2 +4 -9
-7 -5 +5 -5 -8
+1 +2 -2 -8 -1
+2 +2 +9 +7 +7
A_t
+2 -8 -7 +1 +2
+8 -8 -5 +2 +2
+2 +2 +5 -2 +9
+3 +4 -5 -8 +7
-4 -9 -8 -1 +7
Trace(A ) = -2
Trace(A_t) = -2
Press return to continue
Press X return to stop