Aller au contenu

Mathc matrices/a258

Un livre de Wikilivres.


Application

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

c00b.c
/* ------------------------------------ */
/*  Save as :  c00b.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define  ARRAY  A7 
#define    RCA  R4  
/* ------------------------------------ */
void fun(void)
{
double **A[ARRAY];
double **P[ARRAY];
double **InvP[ARRAY];

double **T = i_mR(RCA,RCA);
int i;

  for(i=A0; i<ARRAY; i++)
     {   
         A[i] =              i_mR(RCA,RCA); 
         P[i] =   r_mR(      i_mR(RCA,RCA),99); 
      InvP[i] = inv_mR(P[i], i_mR(RCA,RCA));       
	   } 

  rsymmetric_mR(A[0],99);
  
    for(i=A0; i<(ARRAY-C1); i++)
     {   
        mul_mR(InvP[i],A[i],T); 
        mul_mR(T,P[i],A[i+C1]);
	   } 
	   
  clrscrn();
  printf(" Similar matrices have the same trace.\n\n");
  
  for(i=A0; i<ARRAY; i++)
     {
      printf(" A[%d] : \t\t\t trace = %+.4f ",i,trace_R(A[i]));      
      p_mR(A[i], S9,P2,C6); 
     } 

  for(i=A0; i<ARRAY; i++)
     { 
	   f_mR(A[i]);
	   f_mR(P[i]);		 
	   f_mR(InvP[i]); 
	   }
	   
  f_mR(T);       
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
  do{
        fun();
        
  }while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
 Similar matrices have the same trace.

 A[0] : 			 trace = -119.0000 
   -61.00    +62.00    +68.00    +14.00 
   +62.00    -13.00    +51.00    -55.00 
   +68.00    +51.00    -62.00    +26.00 
   +14.00    -55.00    +26.00    +17.00 

 A[1] : 			 trace = -119.0000 
  -166.25    -94.28   +214.51   -148.92 
  -106.58    -81.36    -27.69    -80.86 
   -33.38    -41.45    -39.84    -65.67 
  +189.95    +65.55   -250.06   +168.44 

 A[2] : 			 trace = -119.0000 
  -288.98   +709.69   -456.26    -69.03 
  -263.76   +713.47   -503.03    +30.98 
  -252.25   +628.90   -471.03   +115.91 
  -167.16   +398.65   -226.82    -72.46 

 A[3] : 			 trace = -119.0000 
  -556.54   +747.17   -267.08   -363.59 
  -211.93   +271.48   -103.61   -241.53 
  +221.19   -339.05   +166.22    -42.58 
  +235.17   -367.09   +174.17     -0.16 

 A[4] : 			 trace = -119.0000 
 -1419.95  +5068.36  -3695.48  +4139.99 
  -884.00  +3348.78  -2544.51  +2846.19 
 +2226.90  -7054.05  +4960.18  -5472.40 
 +2513.06  -8667.07  +6291.44  -7008.01 

 A[5] : 			 trace = -119.0000 
-40308.72 +29511.99 +118197.13  +3012.54 
+47888.48 -34969.74 -140221.83  -3565.93 
-28185.80 +20666.75 +82717.79  +2111.30 
+98539.81 -72756.34 -290660.91  -7558.34 

 A[6] : 			 trace = -119.0000 
-32207.35 -44417.14 +21113.88 +81197.10 
+74582.48 +102817.09 -48899.19 -187970.93 
-66768.92 -91430.68 +43194.21 +166414.21 
+45351.01 +62399.53 -29612.09 -113922.96 


 Press   return to continue
 Press X return to stop