Fonctions matricielles ex : cos(A)


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


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c               */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC4
/* ------------------------------------ */
void fun(void)
{
double **A             = rPsymmetric_mR(i_mR(RCA,RCA),99.);
double **SqrtA          =               i_mR(RCA,RCA);

double **EigsVector    =               i_mR(RCA,RCA);
double **T_EigsVector  =               i_mR(RCA,RCA);

double **EigsValue     =               i_mR(RCA,RCA);
double **f_EigsValue   =               i_mR(RCA,RCA);

double **T1            =               i_mR(RCA,RCA);
  
  clrscrn();
  printf(" A :");
  p_mR(A, S7,P0, C8); 
  
  eigs_V_mR(A,EigsVector); 
  transpose_mR(EigsVector,T_EigsVector);
      
/* EigsValue : T_EigsVector * A * EigsVector */
  mul_mR(T_EigsVector,A,T1);
  mul_mR(T1,EigsVector,EigsValue);     
  
  printf(" sqrt(A) = EigsVector * sqrt(EigsValue) * T_EigsVector\n");
  f_eigs_mR(sqrt,EigsValue,f_EigsValue);      
     mul_mR(EigsVector,f_EigsValue,T1);
     mul_mR(T1,T_EigsVector,SqrtA);
       p_mR(SqrtA,S10,P4,C8);    
  
  printf(" A = sqrt(A) * sqrt(A)");  
  mul_mR(SqrtA,SqrtA,A);
  p_mR(A, S7,P0, C8);   
   
  f_mR(A);
  f_mR(SqrtA);
    
  f_mR(EigsVector);
  f_mR(T_EigsVector);
  
  f_mR(EigsValue);
  f_mR(f_EigsValue);    
     
  f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
                           sqrt(A) = V sqrt(EValue) T_V

Exemple de sortie écran :
/* ------------------------------------ */
 A :
  +7770     +40     -48     -71 
    +40   +8769     +20     -28 
    -48     +20    +555     -39 
    -71     -28     -39   +3663 

 sqrt(A) = EigsVector * sqrt(EigsValue) * T_EigsVector

  +88.1450    +0.2200    -0.4321    -0.4787 
   +0.2200   +93.6424    +0.1708    -0.1804 
   -0.4321    +0.1708   +23.5492    -0.4660 
   -0.4787    -0.1804    -0.4660   +60.5188 

 A = sqrt(A) * sqrt(A)
  +7770     +40     -48     -71 
    +40   +8769     +20     -28 
    -48     +20    +555     -39 
    -71     -28     -39   +3663 


 Press return to continue
 Press X      to stop