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,
double **U,
double FACTOR
)
{
int r = rsize_Z(a);
int c = csize_Z(a);
int i;

double **A          = smul_mZ(FACTOR,a,
                      i_mZ(r,c));
double **ctA        = ctranspose_mZ(A,
                      i_mZ(c,r));
double **ActA       = i_mZ(r,r);
double **ctAA       = i_mZ(c,c);
double **X_Value    = i_mZ(r,C1);

double **Ide        = eye_mZ(i_mZ(c,c));
double **zIde       = i_mZ(c,c);
double **ctAmnszIde = i_mZ(c,c);

double **ctAb;
double **b          = i_mZ(c,C1 );

double **ctAb_free  = i_Abr_Ac_bc_mZ(
                        c,c,C2);
double  **b_free    = i_mZ(c,C2);

   mul_mZ(A,ctA,ActA);
  eigs_mZ(      ActA,X_Value);

  mul_mZ(ctA,A,ctAA);
  
for(i = R1; i <= csize_Z(U); i++)
  {      
     zmul_mZ(i_Z(X_Value[i][C1],
                 X_Value[i][C2]),Ide,zIde);
      sub_mZ(ctAA,zIde,ctAmnszIde);
    
    ctAb = c_A_b_Ab_mZ(ctAmnszIde, b,
                      i_Abr_Ac_bc_mZ(c,c,C1));

        GJ_PP_FreeV_mZ(ctAb,ctAb_free,b_free);

                c_c_mZ(b_free,C2,U,i); 
  }  
  
  Normalize_mZ(U);

  f_mZ(A);
  f_mZ(ctA);
  f_mZ(ActA);
  f_mZ(ctAA);
  f_mZ(X_Value);
  f_mZ(Ide);
  f_mZ(zIde);
  f_mZ(ctAmnszIde);
  f_mZ(ctAb);
  f_mZ(b);
  f_mZ(ctAb_free);
  f_mZ(b_free);
                        
 return(U);
}
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
/* ------------------------------------ */
double **X_V_mZ(
double **a,
double **V,
double FACTOR
)
{
int r = rsize_Z(a);
int c = csize_Z(a);
int i;

double **A          = smul_mZ(FACTOR,a, 
                      i_mZ(r,c));
double **ctA        = ctranspose_mZ(A,
                      i_mZ(c,r));
double **ActA       = i_mZ(r,r);

double **X_Value    = i_mZ(r,C1);

double **Ide        = eye_mZ(i_mZ(r,r));
double **zIde       = i_mZ(r,r);
double **ctAmnszIde = i_mZ(r,r);

double **ctAb ;
double **b          = i_mZ(r,C1);

double **ctAb_free  = i_Abr_Ac_bc_mZ(
                        r,r,C2);
double  **b_free    = i_mZ(r,C2);

   mul_mZ(A,ctA,ActA);
  eigs_mZ(      ActA,X_Value);



for(i = R1; i <= csize_Z(V); i++)
  {        
     zmul_mZ(i_Z(X_Value[i][C1],
                 X_Value[i][C2]),Ide,zIde);
      sub_mZ(ActA,zIde,ctAmnszIde);
   
    ctAb = c_A_b_Ab_mZ(ctAmnszIde, b, 
                       i_Abr_Ac_bc_mZ(r,r,C1));

        GJ_PP_FreeV_mZ(ctAb,ctAb_free,b_free);
      
                c_c_mZ(b_free,C2,V,i); 
  }   
  
  Normalize_mZ(V);

  f_mZ(A);
  f_mZ(ctA);
  f_mZ(ActA);

  f_mZ(X_Value);
  f_mZ(Ide);
  f_mZ(zIde);
  f_mZ(ctAmnszIde);
  f_mZ(ctAb);
  f_mZ(b);
  f_mZ(ctAb_free);
  f_mZ(b_free);
                             
 return(V);
}
/* ------------------------------------ */
/* ------------------------------------ */