Aller au contenu

Mathc complexes/041

Un livre de Wikilivres.


X Value Decomposition


X_U_mZ(A, U, FACTOR_E); X_V_mZ(A, V, FACTOR_E);
/* ---------------------------------- */
/* ---------------------------------- */
double **X_U_mZ(
double **A_T,
double **U,
double factor
)
{
int r = rsize_Z(A_T);
int c = csize_Z(A_T);
int i;

/* ------------------------------------ */
double **sA_T    = smul_mZ(factor,A_T,i_mZ(r,c));
double **sA      = ctranspose_mZ(sA_T,i_mZ(c,r));
double **sA_TsA  =                    i_mZ(r,r);
double **sAsA_T  =                    i_mZ(c,c);
double **M_Ualue =                    i_mZ(r,C1);
/* ------------------------------------ */
double **Ide       =  eye_mZ(i_mZ(c,c));
double **zIde      =         i_mZ(c,c);
double **AmnszIde  =         i_mZ(c,c);
/* ------------------------------------ */
double **Ab  ;
double **b  =           i_mZ(c,  C1 );
/* ------------------------------------ */
double **Ab_free = i_Abr_Ac_bc_mZ(c,c,C2);
double  **b_free = i_mZ(          c,  C2);
/* ------------------------------------ */

/* ------------------------------------ */
  mul_mZ(sA_T,sA,sA_TsA);
  eigs_mZ(sA_TsA,M_Ualue);
/* ------------------------------------ */

/* ------------------------------------ */
  mul_mZ(sA,sA_T,sAsA_T);
/* ------------------------------------ */  

/* ------------------------------------ */
for(i = R1; i <= csize_Z(U); i++)
  {      
 /* ------------------------------------ */ 
    zmul_mZ(i_Z(M_Ualue[i][C1],M_Ualue[i][C2]),Ide,zIde);  
    MmnsD_mZ(sAsA_T,zIde,AmnszIde);
/* ------------------------------------ */
   
/* ------------------------------------ */     
    Ab = c_A_b_Ab_mZ(AmnszIde, b, i_Abr_Ac_bc_mZ(c,c,C1));
 /* ------------------------------------ */
  
/* ------------------------------------ */       
    GJ_PP_FreeV_mZ(Ab,Ab_free,b_free);    
    c_c_mZ(b_free,C2,U,i); 
/* ------------------------------------ */
  }  
  
  Normalize_mZ(U);

  f_mZ(sA_T);
  f_mZ(sA);
  f_mZ(sA_TsA);
  f_mZ(sAsA_T);
  f_mZ(M_Ualue);
  f_mZ(Ide);
  f_mZ(zIde);
  f_mZ(AmnszIde);
  f_mZ(Ab);
  f_mZ(b);
  f_mZ(Ab_free);
  f_mZ(b_free);
                        
 return(U);
}
/* ---------------------------------- */
/* ---------------------------------- */
/* ---------------------------------- */
/* ---------------------------------- */
double **X_V_mZ(
double **A_T,
double **V,
double factor
)
{
int r = rsize_Z(A_T);
int c = csize_Z(A_T);
int i;

/* ------------------------------------ */
double **sA_T   =  smul_mZ(factor,A_T,i_mZ(r,c));
double **sA     = ctranspose_mZ(sA_T, i_mZ(c,r));
double **sA_TsA =                     i_mZ(r,r);

double **M_Value =                    i_mZ(r,C1);
/* ------------------------------------ */
double **Ide       =  eye_mZ(i_mZ(r,r));
double **zIde      =         i_mZ(r,r);
double **AmnszIde  =         i_mZ(r,r);
/* ------------------------------------ */
double **Ab ;
double **b  =           i_mZ(r,  C1 );
/* ------------------------------------ */
double **Ab_free = i_Abr_Ac_bc_mZ(r,r,C2);
double  **b_free = i_mZ(          r,  C2);
/* ------------------------------------ */

/* ------------------------------------ */
  mul_mZ(sA_T,sA,sA_TsA);
  eigs_mZ(sA_TsA,M_Value);
/* ------------------------------------ */





/* ------------------------------------ */  
for(i = R1; i <= csize_Z(V); i++)
  {        
/* ------------------------------------ */
    zmul_mZ(i_Z(M_Value[i][C1],M_Value[i][C2]),Ide,zIde);    
    MmnsD_mZ(sA_TsA,zIde,AmnszIde);
/* ------------------------------------ */

/* ------------------------------------ */     
    Ab = c_A_b_Ab_mZ(AmnszIde, b, i_Abr_Ac_bc_mZ(r,r,C1)); 
/* ------------------------------------ */
  
/* ------------------------------------ */    
    GJ_PP_FreeV_mZ(Ab,Ab_free,b_free);           
    c_c_mZ(b_free,C2,V,i);
/* ------------------------------------ */ 
  }  
  
  Normalize_mZ(V);

  f_mZ(sA_T);
  f_mZ(sA);
  f_mZ(sA_TsA);

  f_mZ(M_Value);
  f_mZ(Ide);
  f_mZ(zIde);
  f_mZ(AmnszIde);
  f_mZ(Ab);
  f_mZ(b);
  f_mZ(Ab_free);
  f_mZ(b_free);
                             
 return(V);
}
/* ---------------------------------- */
/* ---------------------------------- */