Mathc complexes/Fichiers c :madd c

Application

Installer et compiler ce fichier dans votre répertoire de travail.

M_addc.c
/* ------------------------------------ */
/*  Save as :  M_addc.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
int main(void)
{                         
double a[R3*(C3*C2)] ={  1,0,   2,3,   3,6,
                         2,0,   2,2,   2,1,
                         3,0,   3,3,   3,1};
                     
double **A = ca_A_mZ(a,i_mZ(R3,C3));

nb_Z z = i_Z(0,0);  

int c1 = C1;
int c2 = C2;  

/* ------------------------- */
/* ------------------------- */
 clrscrn(); 

 c1 = C1;
 c2 = C2;
 
 z = sym_Z(i_Z(2,3));
  
 printf(" A : \n");
 p_mZ(A, S5,P0, S4,P0, C6);
     
 printf(" Multiply the column C%d by ",c1);
 p_Z(z,S1,P0,S1,P0); 
 printf("\n");
 printf(" then add the column %d and the column C%d \n",c1,c2);
 printf(" put the result into the column C%d   \n\n",      c2);
 printf(" A : \n");
 p_mZ(M_addC_mZ(A,z,c1,c2), S5,P0, S4,P0, C6);
 
 stop();
/* ------------------------- */
/* ------------------------- */
 clrscrn();
 
 c1 = C1;
 c2 = C3;

 z = sym_Z(i_Z(3,6));
  
 printf(" A : \n");
 p_mZ(A, S5,P0, S4,P0, C6);
     
 printf(" Multiply the column C%d by ",c1);
 p_Z(z,S1,P0,S1,P0); 
 printf("\n");
 printf(" then add the column C%d and the column C%d \n",c1,c2);
 printf(" put the result into the column C%d   \n\n",       c2);
 printf(" A : \n");
 p_mZ(M_addC_mZ(A,z,c1,c2), S5,P0, S4,P0, C6);
 
 stop();
 f_mZ(A);

 return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


La fonction swapC_mZ(); échange deux colonnes.


Exemple de sortie écran :

 A : 

   +1  +0i    +2  +3i    +3  +6i 
   +2  +0i    +2  +2i    +2  +1i 
   +3  +0i    +3  +3i    +3  +1i 

 Multiply the column C1 by -2-3i 
 then add the column 1 and the column C2 
 put the result into the column C2   

 A : 

   +1  +0i    +0  +0i    +3  +6i 
   +2  +0i    -2  -4i    +2  +1i 
   +3  +0i    -3  -6i    +3  +1i 

 Press return to continue. 



 A : 

   +1  +0i    +0  +0i    +3  +6i            <<<<<
   +2  +0i    -2  -4i    +2  +1i 
   +3  +0i    -3  -6i    +3  +1i 

 Multiply the column C1 by -3-6i 
 then add the column C1 and the column C3 
 put the result into the column C3   

 A : 

   +1  +0i    +0  +0i    +0  +0i             <<<<
   +2  +0i    -2  -4i    -4 -11i 
   +3  +0i    -3  -6i    -6 -17i 

 Press return to continue.