Étude du code


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


c01c.c
/* ------------------------------------ */
/*  Save as :  c01c.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double Xdet_R(
double **A
)
{
double **T = c_mR(A,
                i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]));
                
double   SIGN = 1;
double  PIVOT = 1;

double deter=1;
int rc;
/* ------------------------------------ */
    for( rc=C1; rc<T[C_SIZE][C0]; rc++)
       { 
        SIGN   = pivotbest_mR(T,rc);
        deter *= SIGN;       
/* ------------------------------------ */
		clrscrn();
		printf(" deter *= pivotbest_mR(T,rc);\n\n" 
		       "  SIGN = %+0.4f \n deter = %+0.4f\n\n\n",SIGN,deter); 
		p_mR(T,S10,P4,C6);
		stop();
/* ------------------------------------ */
        PIVOT  = zero_under_pivot_mR(T,rc);
        deter *= PIVOT;        
/* ------------------------------------ */
		clrscrn();
		printf(" deter *= zero_under_pivot_mR(T,rc);\n\n"  
		       " PIVOT  = %+0.4f\n" 
		       " deter *= PIVOT \n" 	
		       " deter  = %+0.4f\n",PIVOT,deter);		  
		p_mR(T,S10,P4,C6);
		if(rc+C1<T[C_SIZE][C0]) stop();
/* ------------------------------------ */          
       }

   f_mR(T);

return(deter);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = r_mR(i_mR(R4,R4),999);

  clrscrn();
  printf(" Copy/Past into the octave window.       \n\n");
  p_Octave_mR(A,"A",P1);
  printf(" det(A)\n\n\n");
  stop();

  printf(" det(A) = %.4e\n",Xdet_R(A));
  
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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




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

 A=[
-371.0,+380.0,+569.0,-320.0;
+424.0,-915.0,-201.0,-76.0;
-939.0,-571.0,+985.0,-110.0;
+785.0,+834.0,-901.0,-651.0]

 det(A)


 Press return to continue. 

/*********************************/

 deter *= pivotbest_mR(T,rc);

  SIGN = +1.0000 
 deter = +1.0000



 +985.0000  -571.0000  -939.0000  -110.0000 
 -201.0000  -915.0000  +424.0000   -76.0000 
 +569.0000  +380.0000  -371.0000  -320.0000 
 -901.0000  +834.0000  +785.0000  -651.0000 

 Press return to continue. 

/*********************************/

 deter *= zero_under_pivot_mR(T,rc);

 PIVOT  = +985.0000
 deter *= PIVOT 
 deter  = +985.0000

   +1.0000    -0.5797    -0.9533    -0.1117 
   +0.0000 -1031.5188  +232.3868   -98.4467 
   +0.0000  +709.8467  +171.4274  -256.4569 
   +0.0000  +311.6944   -73.9228  -751.6193 

 Press return to continue. 

/*********************************/

 deter *= pivotbest_mR(T,rc);

  SIGN = +1.0000 
 deter = +985.0000



   +1.0000    -0.5797    -0.9533    -0.1117 
   +0.0000 -1031.5188  +232.3868   -98.4467 
   +0.0000  +709.8467  +171.4274  -256.4569 
   +0.0000  +311.6944   -73.9228  -751.6193 

 Press return to continue. 

/*********************************/

 deter *= zero_under_pivot_mR(T,rc);

 PIVOT  = -1031.5188
 deter *= PIVOT 
 deter  = -1016046.0000

   +1.0000    -0.5797    -0.9533    -0.1117 
   -0.0000    +1.0000    -0.2253    +0.0954 
   +0.0000    +0.0000  +331.3460  -324.2036 
   +0.0000    +0.0000    -3.7024  -781.3670 

 Press return to continue. 

/*********************************/

 deter *= pivotbest_mR(T,rc);

  SIGN = +1.0000 
 deter = -1016046.0000



   +1.0000    -0.5797    -0.1117    -0.9533 
   -0.0000    +1.0000    +0.0954    -0.2253 
   +0.0000    +0.0000  -781.3670    -3.7024 
   +0.0000    +0.0000  -324.2036  +331.3460 

 Press return to continue. 

/*********************************/

 deter *= zero_under_pivot_mR(T,rc);

 PIVOT  = -781.3670
 deter *= PIVOT 
 deter  = +793904780.0000

   +1.0000    -0.5797    -0.1117    -0.9533 
   -0.0000    +1.0000    +0.0954    -0.2253 
   -0.0000    -0.0000    +1.0000    +0.0047 
   +0.0000    +0.0000    +0.0000  +332.8822 

 Press return to continue. 

/*********************************/

 deter *= pivotbest_mR(T,rc);

  SIGN = +1.0000 
 deter = +793904780.0000



   +1.0000    -0.5797    -0.1117    -0.9533 
   -0.0000    +1.0000    +0.0954    -0.2253 
   -0.0000    -0.0000    +1.0000    +0.0047 
   +0.0000    +0.0000    +0.0000  +332.8822 

 Press return to continue. 

/*********************************/

 deter *= zero_under_pivot_mR(T,rc);

 PIVOT  = +332.8822
 deter *= PIVOT 
 deter  = +264276759105.0000

   +1.0000    -0.5797    -0.1117    -0.9533 
   -0.0000    +1.0000    +0.0954    -0.2253 
   -0.0000    -0.0000    +1.0000    +0.0047 
   +0.0000    +0.0000    +0.0000    +1.0000 

 det(A) = 2.6428e+11

 Press return to continue
 Press X      to stop