Mathc matrices/c22i

Un livre de Wikilivres.


Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double ab[R4*C7]={
     1,     -3,     4,     -2,    5,   +4,    0,
     2,     -6,     9,     -1,    8,    2,    0,
     2,     -6,     9,     -1,    9,    7,    0, 
    -1,      3,    -4,      2,   -5,   -4,    0,  
};

double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(R4,C6,C1));
double **A  = c_Ab_A_mR(Ab,i_mR(R4,C6));
double **b  = c_Ab_b_mR(Ab,i_mR(R4,C1));

double **B  =              i_mR(R3,C6);

  clrscrn();
  printf("Basis for a Row Space by Row Reduction :\n\n");
  printf(" A :");
  p_mR(A,S6,P1,C10);
  printf(" b :");
  p_mR(b,S6,P1,C10);
  printf(" Ab :");
  p_mR(Ab,S6,P1,C10);
  stop();

  clrscrn();
  
  printf(" The nonzero rows vectors  of Ab without b\n"
         " form a basis for the row space of  A \n\n"
         " Ab :");
  p_mR(Ab,S7,P3,C10);
  printf(" gj_PP_mR(Ab,NO) :");
  gj_PP_mR(Ab,NO);
  p_mR(Ab,S7,P3,C10);

  c_Ab_A_mR(Ab,A);
  
  c_r_mR(A,R1,B,R1);
  c_r_mR(A,R2,B,R2);
  c_r_mR(A,R3,B,R3);
  
  printf(" B :  Basis for a Row Space of A by Row Reduction");
  p_mR(B,S7,P3,C10); 
  stop();   
      
  f_mR(Ab);
  f_mR(b);
  f_mR(A);
  f_mR(B);  
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


La position des pivots de Ab donne la position des lignes de A qui forment une base pour l'espace lignes de A.


Exemple de sortie écran :
 ------------------------------------ 
Basis for a Row Space by Row Reduction :

 A :
  +1.0   -3.0   +4.0   -2.0   +5.0   +4.0 
  +2.0   -6.0   +9.0   -1.0   +8.0   +2.0 
  +2.0   -6.0   +9.0   -1.0   +9.0   +7.0 
  -1.0   +3.0   -4.0   +2.0   -5.0   -4.0 

 b :
  +0.0 
  +0.0 
  +0.0 
  +0.0 

 Ab :
  +1.0   -3.0   +4.0   -2.0   +5.0   +4.0   +0.0 
  +2.0   -6.0   +9.0   -1.0   +8.0   +2.0   +0.0 
  +2.0   -6.0   +9.0   -1.0   +9.0   +7.0   +0.0 
  -1.0   +3.0   -4.0   +2.0   -5.0   -4.0   +0.0 

 Press return to continue. 


 ------------------------------------ 
 The nonzero rows vectors  of Ab without b 
 form a basis for the row space of  A 
  Ab : 

 Ab :
 +1.000  -3.000  +4.000  -2.000  +5.000  +4.000  +0.000 
 +2.000  -6.000  +9.000  -1.000  +8.000  +2.000  +0.000 
 +2.000  -6.000  +9.000  -1.000  +9.000  +7.000  +0.000 
 -1.000  +3.000  -4.000  +2.000  -5.000  -4.000  +0.000 

  gj_PP_mR(Ab,NO) :
 +1.000  -3.000  +4.500  -0.500  +4.000  +1.000  +0.000 
 -0.000  -0.000  +1.000  +3.000  -2.000  -6.000  -0.000 
 +0.000  +0.000  +0.000  +0.000  +1.000  +5.000  +0.000 
 +0.000  +0.000  +0.000  +0.000  +0.000  +0.000  +0.000 

 B :  Basis for a Row Space of A by Row Reduction
 +1.000  -3.000  +4.500  -0.500  +4.000  +1.000 
 -0.000  -0.000  +1.000  +3.000  -2.000  -6.000 
 +0.000  +0.000  +0.000  +0.000  +1.000  +5.000 

 Press return to continue.