Mathc matrices/c09a00

Un livre de Wikilivres.


Étude du code


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


inv00.c
/* ------------------------------------ */
/*  Save as :   inv00.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A   = r_mR( i_mR(r,r), 9999.);
double **Inv =       i_mR(r,r);
double **AInv =      i_mR(r,r);

  clrscrn();

  printf(" Copy/Past into the octave window.\n\n");
  printf("format short e\n");
  p_Octave_mR(A,"A",P0);
  
  printf(" inv(A)");
  invgj_mR(A,Inv);
  pE_mR(Inv,S12,P4,C6);

  printf(" A * inv(A)");
  mul_mR(A,Inv,AInv);
  p_mR(AInv,S12,P4,C6);
  
  f_mR(AInv);  
  f_mR(Inv);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
do
{
   fun(rp_I(C2)+C2);

} while(stop_w());

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


C'est le fichier de base de travail.


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

format short e
 A=[
-7343,-8617,-813,-5133;
-7209,-8235,-6775,+5820;
-551,-8923,+6312,-9167;
-5693,-5883,-2301,-6689]

 inv(A)
 -4.6279e-04  +1.3133e-04  +1.6836e-04  +2.3867e-04 
 +1.7786e-04  -1.2113e-04  -1.3023e-04  -6.3410e-05 
 +3.7069e-04  -1.1162e-04  -3.5165e-05  -3.3339e-04 
 +1.0994e-04  +3.3161e-05  -1.6659e-05  -1.8218e-04 

 A * inv(A)
     +1.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      +1.0000 


 Press return to continue
 Press X      to stop