Mathc matrices/h09l

Un livre de Wikilivres.


Bibliothèque


Installer ce fichier dans votre répertoire de travail.

vgj1piv.h
/* ------------------------------------ */
/*  Save as :   vgj1piv.h                */
/* ------------------------------------ */
double pivotbest_gj1Ab_mR(
double **Ab,
int pv
)
{
double pvbest = fabs(Ab[pv][pv]);
int best_r = pv;
int best_c = pv;
int r;
int c;

  for   ( r=pv; r<Ab[R_SIZE][C0]; r++)
    for ( c=pv; c<Ab[R_SIZE][C0]; c++)

            if(fabs(Ab[r][c])>pvbest)
             {
                  pvbest = fabs(Ab[r][c]);
                  best_r = r;
                  best_c = c;
             }

 if(best_r!=pv)   swapR_mR(Ab,pv,best_r);
 if(best_c!=pv) swapC_withR0_mR(Ab,pv,best_c);

 return(pvbest);
}
/* ------------------------------------ */
double **zero_under_pivot_gj1Ab_mR(
double **Ab,
int pv
)
{
double pivot = Ab[pv][pv];
int r;

  if(fabs(pivot)>ERROR_E)
    {
     mulR_mR( Ab,(1./pivot),pv); 

     for( r=(pv+C1); r<Ab[R_SIZE][C0]; r++)

         addR_mR( Ab,(-Ab[r][pv]),pv,r);
    }
    
return(Ab);
}
/* ------------------------------------ */
double **zero_below_pivot_gj1Ab_mR(
double **Ab,
int pv
)
{
int r;

  if(fabs(Ab[pv][pv])>ERROR_E)

     for( r=(pv-R1); r>=R1; r--)

        addR_mR( Ab,(-Ab[r][pv]),pv,r);
        
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */


Déclaration des fichiers h.