Mathc complexes/Fichiers c : add r2


Application

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

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

int r1 = R0;
int r2 = R0;

 clrscrn();

 r1 = R1;
 r2 = R2;
 
 z = sym_Z(i_Z(2,3));
 
 printf(" A : \n");
 p_mZ(A, S5,P0, S4,P0, C6);
 
 printf(" Multiply the row R%d by ",r1); 
 p_Z(z, S5,P0, S3,P0);printf("\n");
 printf(" then add the row R%d and the row R%d \n",r1,r2);
 printf(" put the result into the row R%d   \n\n",r2);
 printf(" A : \n");
 
 p_mZ(addR_mZ(A,z,r1,r2), S5,P0, S4,P0, C6);
 
 stop(); 
 
 
 clrscrn();

 r1 = R1;
 r2 = R3;
 
 z = sym_Z(i_Z(3,6));
 
 printf(" A : \n");
 p_mZ(A, S5,P0, S4,P0, C6);
 
 printf(" Multiply the row R%d by ",r1); 
 p_Z(z, S5,P0, S3,P0);printf("\n");
 printf(" then add the row R%d and the row R%d \n",r1,r2);
 printf(" put the result into the row R%d   \n\n",r2);
 printf(" A : \n");
 
 p_mZ(addR_mZ(A,z,r1,r2), S5,P0, S4,P0, C6);
 
 stop();  
 
 f_mZ(A);

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


La fonction addR_mZ(); multiplie la ligne r1 par un complexe z sans la modifier et l'ajoute à la ligne r2 et remplace la ligne r2 par le résultat de cette opération .

Cette opération permet de poser des zéros sous le pivot. Voir le résultat dans la dernière matrice.


Exemple de sortie écran :

  A : 

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

 Multiply the row R1 by    -2 -3i 
 then add the row R1 and the row R2 
 put the result into the row R2   

 A : 

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

 Press return to continue. 


 A : 

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

 Multiply the row R1 by    -3 -6i 
 then add the row 1 and the row R3 
 put the result into the row R3   

 A : 

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

 Press return to continue.