Mathc complexes/03y
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RCA RC3
#define CX C1
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **A = eye_mZ( i_mZ(RCA,RCA));
double **b = r_mZ( i_mZ(RCA, CX),99);
double **Ab = i_Abr_Ac_bc_mZ(RCA, RCA, CX);
// Rab CA Cb
double **New_Ab = i_AbR_AbC_AC_mZ( Ab[R_SIZE ][C0], // Rab + R0
Ab[C_SIZE ][C0], // CA+Cb + C0
Ab[C_SIZE_A][C0]); // CA + C0
// This is the order into the memory. see pall_mZ();
c_A_b_Ab_mZ(A,b,Ab);
c_A_b_Ab_mZ(A,b,New_Ab);
clrscrn();
printf(" A :");
p_mZ(A, S5,P0, S4,P0, C6);
printf(" b :");
p_mZ(b, S5,P0, S4,P0, C6);
printf(" Ab : i_Abr_Ac_bc_mZ();");
p_mZ(Ab, S5,P0, S4,P0, C6);
printf(" New_Ab : i_AbR_AbC_AC_mZ();");
p_mZ(New_Ab, S5,P0, S4,P0, C6);
stop();
clrscrn();
printf(" Ab : i_Abr_Ac_bc_mZ();");
pall_mZ(Ab, S5,P0, S4,P0 );
printf(" New_Ab : i_AbR_AbC_AC_mZ();");
pall_mZ(New_Ab, S5,P0, S4,P0 );
stop();
f_mZ(Ab);
f_mZ(New_Ab);
f_mZ(b);
f_mZ(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Création d'une matrice New_Ab en copiant la taille en mémoire de la matrice Ab.
- Ab[R_SIZE....][C0] = Rab......+ R0
- Ab[C_SIZE....][C0] = CA+Cb + C0
- Ab[C_SIZE_A][C0] = CA......+ C0
'R0 et C0 correspondent à l'ajout de la ligne zéro et la colonne zéro lors de la création de la matrice dans le code C. En mémoire la taille de la matrice est incrémenté de 1 pour tenir compte de la ligne zéro et de la colonne zéro.'
Exemple de sortie écran :
A :
+1 +0i +0 +0i +0 +0i
+0 +0i +1 +0i +0 +0i
+0 +0i +0 +0i +1 +0i
b :
+29 -73i
-24 +56i
-70 -42i
Ab : i_Abr_Ac_bc_mZ();
+1 +0i +0 +0i +0 +0i +29 -73i
+0 +0i +1 +0i +0 +0i -24 +56i
+0 +0i +0 +0i +1 +0i -70 -42i
New_Ab : i_AbR_AbC_AC_mZ();
+1 +0i +0 +0i +0 +0i +29 -73i
+0 +0i +1 +0i +0 +0i -24 +56i
+0 +0i +0 +0i +1 +0i -70 -42i
Press return to continue.
Ab : i_Abr_Ac_bc_mZ();
+4 +1 0 +2 0 +3 0 +4 0
+9 +1 +0i +0 +0i +0 +0i +29 -73i
+7 +0 +0i +1 +0i +0 +0i -24 +56i
+0 +0 +0i +0 +0i +1 +0i -70 -42i
New_Ab : i_AbR_AbC_AC_mZ();
+4 +1 0 +2 0 +3 0 +4 0
+9 +1 +0i +0 +0i +0 +0i +29 -73i
+7 +0 +0i +1 +0i +0 +0i -24 +56i
+0 +0 +0i +0 +0i +1 +0i -70 -42i
Press return to continue.