Mathc matrices/c20y
Installer et compiler ces fichiers dans votre répertoire de travail.
c00f.c |
---|
/* ------------------------------------ */
/* Save as : c00f.c */
/* ------------------------------------ */
#include "v_a.h"
#include "dot_trac.h"
/* ------------------------------------ */
void fun(void)
{
double a[R2*C2]={ 1,2,
3,4};
double b[R2*C2]={-1,0,
3,2};
double k = 3;
double **A = ca_A_mR(a,i_mR(R2,C2));
double **B = ca_A_mR(b,i_mR(R2,C2));
double **kB = smul_mR(k,B,ca_A_mR(b,i_mR(R2,C2)));
double **AmnskB = sub_mR(A,kB, i_mR(R2,C2));
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" B :");
p_mR(B,S3,P0,C6);
printf(" %.0f B :",k);
p_mR(kB,S3,P0,C6);
printf(" A-kB :");
p_mR(AmnskB,S3,P0,C6);
printf(" ||A-kB|| = %.0f \n\n", norm_TR_R(AmnskB));
f_mR(A);
f_mR(B);
f_mR(kB);
}
/* ------------------------------------ */
int main(void)
{
fun();
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
------------------------------------
A :
+1 +2
+3 +4
B :
-1 +0
+3 +2
3 B :
-3 +0
+9 +6
A-kB :
+4 +2
-6 -2
||A-kB|| = 8
Press return to continue.