Application


Installer et compiler ces fichiers dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"  
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **Ab = r_singular_Ab_mZ(i_Abr_Ac_bc_mZ(r-R2,r,C1),999);
double **Ab_free =             i_Abr_Ac_bc_mZ(r,r,C5);
double **b       =             i_mZ(r,C5);

  clrscrn();
  printf(" Ab :");
  p_mZ(Ab, S8,P2, S8,P2, C4);    
 
  printf(" gj_PP_mZ(Ab) :");
  p_mZ(gj_PP_mZ(Ab), S8,P4, S8,P4, C4); 
  stop(); 
  
  clrscrn();     
  put_zeroR_mZ(Ab,Ab_free); 
  put_freeV_mZ(Ab_free);
  printf(" put_zero_row_mZ(Ab,Ab_free);\n"
         " put_freeV_mZ(Ab_free);\n\n"
         " Ab_free :");
  p_mZ(Ab_free, S8,P4, S8,P4, C4);
  stop(); 
  
  clrscrn();  
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mZ(Ab_free,"Ab_free",P10, P10);
  printf(" rref(Ab_free,.00000000001)\n\n");
  stop(); 
  
  clrscrn(); 
  printf(" gj_mZ(Ab) :");
  p_mZ(gj_mZ(Ab_free), S8,P4, S8,P4, C4);  
  stop(); 
  
  clrscrn(); 
  printf(" new_b : free variables");  
  p_mZ(c_Ab_b_mZ(Ab_free,b), S8,P4, S8,P4, C4);  

  f_mZ(Ab);
  f_mZ(Ab_free);
  f_mZ(b);  
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(R5);

} while(stop_w());

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

J'ai essayé de rendre cet exemple le plus générique possible.

La matrice A a 5 colonnes et 3 lignes. Elle peut donc de manière aléatoire avoir entre 2 et 4 variables libres.

double **Ab = r_singular_Ab_mZ(i_Abr_Ac_bc_mZ(R3,R5,C1),999);

La matrice Ab_free a 5 colonnes réservé pour b. Cela permet de gérer des matrices qui ont entre 2 et 4 variables libres. 5 colonnes c'est à dire 4 pour les variables libres et une pour b. Les colonnes de variables libres non utilisés sont nulles.

 double **Ab_free =             i_Abr_Ac_bc_mZ(R5,R5,C5);


Exemple de sortie écran :
 ------------------------------------ 
 Ab :
 -641.00 +423.00i  -271.00 +102.00i  -679.00 +537.00i  -300.00  -36.00i 
 -641.00 +423.00i  -271.00 +102.00i  -679.00 +537.00i  -300.00  -36.00i 
 +612.00  -47.00i  -973.00 -777.00i  -453.00 -187.00i  +811.00 +887.00i 

 +798.00  +44.00i  -834.00 +836.00i 
 +798.00  +44.00i  -834.00 +836.00i 
 -774.00 -532.00i  +733.00 +193.00i 

 gj_PP_mZ(Ab) :
 +1.0000 -0.0000i  +0.3677 +0.0835i  +1.1231 -0.0966i  +0.3002 +0.2543i 
 -0.0000 -0.0000i  +1.0000 +0.0000i  +0.6784 -0.3952i  -0.6394 -0.1889i 
 +0.0000 -0.0000i  +0.0000 +0.0000i  -0.0000 +0.0000i  +0.0000 -0.0000i 

 -0.8357 -0.6201i  +1.5059 -0.3104i 
 +0.2074 +0.0196i  -0.0755 -0.3266i 
 +0.0000 +0.0000i  +0.0000 -0.0000i 

 Press return to continue. 


 ------------------------------------ 
 put_zero_row_mZ(Ab,Ab_free);
 put_freeV_mZ(Ab_free);

 Ab_free :
 +1.0000 -0.0000i  +0.3677 +0.0835i  +1.1231 -0.0966i  +0.3002 +0.2543i 
 -0.0000 -0.0000i  +1.0000 +0.0000i  +0.6784 -0.3952i  -0.6394 -0.1889i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 

 -0.8357 -0.6201i  +1.5059 -0.3104i  +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.2074 +0.0196i  -0.0755 -0.3266i  +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 
 +1.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 

 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +1.0000 +0.0000i  +0.0000 +0.0000i 

 Press return to continue. 

 ------------------------------------ 
 gj_mZ(Ab) :
 +1.0000 -0.0000i  +0.0000 +0.0000i  +0.0000 -0.0000i  +0.0000 +0.0000i 
 -0.0000 +0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 

 +0.0000 +0.0000i  +1.5064 -0.1840i  -0.8406 +0.0080i  -0.5195 -0.3771i 
 +0.0000 +0.0000i  -0.0755 -0.3266i  -0.6784 +0.3952i  +0.6394 +0.1889i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 -0.0000i  -0.0000 -0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 
 +1.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i 

 +0.9103 +0.6447i  +0.0000 +0.0000i 
 -0.2074 -0.0196i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i 
 +1.0000 +0.0000i  +0.0000 +0.0000i 

 Press return to continue. 

 ------------------------------------ 
 new_b : free variables
 +1.5064 -0.1840i  -0.8406 +0.0080i  -0.5195 -0.3771i  +0.9103 +0.6447i 
 -0.0755 -0.3266i  -0.6784 +0.3952i  +0.6394 +0.1889i  -0.2074 -0.0196i 
 +0.0000 +0.0000i  +1.0000 -0.0000i  -0.0000 -0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 

 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 


 Press return to continue
 Press X      to stop