Application


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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **B    = rsymmetric_mR(   i_mR(r,r),9.);
double **B_T  =  transpose_mR(B, i_mR(r,r));

double **S    =                 i_mR(r,r);
double **U    =                 i_mR(r,r);
double **U_T  =                 i_mR(r,r);
double **V    =                 i_mR(r,r);

double **T  =                   i_mR(r,r);

  clrscrn();  
  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mR(B,"b",P0);
  printf(" [V, E] = eigs (b,%d) \n\n",r);
  printf(" [U, S, V] = svd (b,%d)\n\n\n",r);
  stop();
  
  printf(" U :");
  svd_U_Rn_mR(B_T,U);
         p_mR(U,S10,P5,C10);   

  printf(" V:");
  svd_V_Rn_mR(B_T,V);
         p_mR(V, S10,P5,C10);
      
  printf(" S : U_T * B * V");
  transpose_mR(U,U_T);
        mul_mR(U_T,B,T);
        mul_mR(T,V,S);  
          p_mR(S, S10,P5,C10);
 
  f_mR(B);
  f_mR(B_T);  
  f_mR(V);
  f_mR(U); 
  f_mR(U_T);  
  f_mR(S);
  f_mR(T);  
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  
  fun(rp_I(R2)+R1);

} while(stop_w());

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


Comparer la SVD d'une matrice symétrique est le calcul des vecteurs propres et valeurs propres.


Exemple de sortie écran :

 Copy/Past into the octave windows 

 b=[
-1,-1,+1;
-1,+2,-9;
+1,-9,+8]

 [V, E] = eigs (b,3) 

 [U, S, V] = svd (b,3)


 Press return to continue. 
 U :
  +0.08908   +0.06649   +0.99380 
  -0.58324   +0.81230   -0.00207 
  +0.80740   +0.57944   -0.11114 

 V:
  +0.08908   +0.06649   +0.99380 
  -0.58324   +0.81230   -0.00207 
  +0.80740   +0.57944   -0.11114 

 S : U_T * B * V
 +14.61168   +0.00000   +0.00000 
  +0.00000   -4.50193   -0.00000 
  +0.00000   -0.00000   -1.10975 


 Press   return to continue
 Press X return to stop