Mathc matrices/e1503


Sommaire


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


Crystal Clear mimetype source c.png gj03.c
'
/* ------------------------------------ */
/*  Save as :   gj03.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **xx_sort_c_mR(
double **Ab
)
{
double **T = i_RC_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]);
int c;

  for(c=C1; c<Ab[C_SIZE][C0]; c++)
  {
clrscrn(); 
printf("/* --------- DEBUG 1 ---------- */\n\n");	           
printf(" Copy  C[%d] of Ab into C[%.0f] of T",c,Ab[R0][c]);
pall_mR(Ab,S8,P4,C8);

           c_c_withR0_mR(  Ab,        c,
                            T, Ab[R0][c]);
                            
printf(" T[R0][%.0f]",Ab[R0][c]);
pall_mR(T,S8,P4,C8);
stop();
clrscrn(); 
/* --------- DEBUG 1 ---------- */
   }
   
 c_withR0_mR(T,Ab);
 
   printf(" Ab : The work of sort_c_mR(); ");
   p_mR(T,S8,P4,C8);
   stop();
   clrscrn();  
  
 f_mR(T);
 
 return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **XX_gj_TP_mR(
double **Ab
)
{
   gj1_T_mR(Ab);
   
   xx_sort_c_mR(Ab);
  
   sort_r_mR(Ab);
  
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A  = i_mR(r,r);
double **b  = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,r,C1);
/*            i_Abr_Ac_bc_mR(R_Ab,C_A,C_b));  */

 do
  {
   r_mR(A,999.);
   printf(".");
  }while(!det_R(A));

  r_mR(b,999.);
  c_A_b_Ab_mR(A,b,Ab);
  
  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf("\n rref(Ab,.00000000001)\n\n");
  stop();

  clrscrn();
  XX_gj_TP_mR(Ab);
  printf("  gj_TP_mR(Ab) :");
  p_mR(Ab,S10,P5,C7);

  f_mR(Ab);
  f_mR(b);
  f_mR(A);
}
/* -----------fun(rp_I(R2)+R2);------------------------- */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  
  fun(R5);

} while(stop_w());

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


Nous utilisons la fonction pall_mR(); au lieu de p_mR(); pour voir l'index des colonnes. Nous pouvons voir comment les colonnes sont triées. On copie la matrice Ab colonne par colonne dans la matrice T. On met simplement l'index de la matrice Ab dans le bon ordre.


Exemple de sortie écran :
 ------------------------------------ 
 Copy/Past into the octave window.

 Ab=[
+422,+390,-715,+340,+868,-505;
+30,+188,-867,-723,-319,+406;
-807,+220,+390,+254,+104,-325;
-29,+828,+514,+704,-421,-193;
-399,+140,+298,-47,+750,-415]


 rref(Ab,.00000000001)

 Press return to continue. 



/* --------- DEBUG 1 ---------- */

 Copy  C[1] of Ab into C[5] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][5]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.0000  +0.0000 

 Press return to continue. 



/* --------- DEBUG 1 ---------- */

 Copy  C[2] of Ab into C[3] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][3]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  -0.0000  +0.0000  -0.0000  +0.0000 

 Press return to continue. 



/* --------- DEBUG 1 ---------- */

 Copy  C[3] of Ab into C[2] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][2]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  -0.0000  -0.0000  +0.0000  -0.0000  +0.0000 

 Press return to continue. 


/* --------- DEBUG 1 ---------- */

 Copy  C[4] of Ab into C[4] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][4]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +0.0000 

 Press return to continue. 


/* --------- DEBUG 1 ---------- */

 Copy  C[5] of Ab into C[1] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][1]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000 
 +0.0000  +1.0000  -0.0000  -0.0000  -0.0000  -0.0000  +0.0000 

 Press return to continue. 



/* --------- DEBUG 1 ---------- */

 Copy  C[6] of Ab into C[6] of T
 +6.0000  +5.0000  +3.0000  +2.0000  +4.0000  +1.0000  +6.0000 

 +7.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0000  -0.4564 
 +6.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  -0.0000  -0.0000  -0.0000  -0.0000  +1.0000  +0.1883 

 T[R0][6]
 +6.0000  +1.0000  +2.0000  +3.0000  +4.0000  +5.0000  +6.0000 

 +7.0000  +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  -0.4564 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +0.0000  +1.0000  -0.0000  -0.0000  -0.0000  -0.0000  +0.1883 

 Press return to continue. 



 Ab : The work of sort_c_mR(); 
 +0.0000  +0.0000  +0.0000  +0.0000  +1.0000  -0.4564 
 +0.0000  +0.0000  +1.0000  +0.0000  +0.0000  +0.0064 
 +0.0000  +1.0000  +0.0000  +0.0000  +0.0000  -0.1281 
 +0.0000  +0.0000  +0.0000  +1.0000  +0.0000  -0.3933 
 +1.0000  -0.0000  -0.0000  -0.0000  -0.0000  +0.1883 

 Press return to continue. 




  gj_TP_mR(Ab) :
  +1.00000   -0.00000   -0.00000   -0.00000   -0.00000   +0.18826 
  +0.00000   +1.00000   +0.00000   +0.00000   +0.00000   -0.12813 
  +0.00000   +0.00000   +1.00000   +0.00000   +0.00000   +0.00638 
  +0.00000   +0.00000   +0.00000   +1.00000   +0.00000   -0.39331 
  +0.00000   +0.00000   +0.00000   +0.00000   +1.00000   -0.45644 


 Press return to continue
 Press X      to stop