< Mathc matrices
Installer ce fichier dans votre répertoire de travail.
![]() |
vgsort.h ' |
---|
/* ------------------------------------ */
/* Save as : vgsort.h */
/* ------------------------------------ */
double **sort_c_mR(
double **Ab
)
{
double **T = i_duplicate_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]);
int c;
for(c=C1; c<Ab[C_SIZE][C0]; c++)
cR0_c_mR(Ab,
c,
T,
c_coefR0_R(Ab,R0,c));
cR0_mR(T,Ab);
f_mR(T);
return(Ab);
}
/* ------------------------------------
The same function as sort_c_mR();
------------------------------------ */
double **sort2_c_mR(
double **Ab
)
{
double **T = i_duplicate_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]);
int r;
int c;
for(c=C1;c<Ab[C_SIZE][C0];c++)
for(r=R0;r<Ab[R_SIZE][C0];r++)
T[r][c_index_R(Ab,c)] = Ab[r][c];
cR0_mR(T,Ab);
f_mR(T);
return(Ab);
}
/* ------------------------------------ */
double **sort_r_mR(
double **Ab
)
{
double pivot;
int c;
int r;
int r_pivot;
r_pivot = R1;
r = R1;
for ( c=C1; c<Ab[C_SIZE_A][C0]; c++)
{
r = r_pivot;
pivot = 0.;
while((pivot<ERROR_E) &&
r<Ab[R_SIZE][C0])
{
pivot = fabs(c_coef_R(Ab,r,c));
if(pivot>ERROR_E) {
swapR_mR(Ab,r,r_pivot);
r_pivot++;
}
r++;
}
}
return(Ab);
}
/* ------------------------------------
The same function as sort_r_mR();
------------------------------------ */
double **sort2_r_mR(
double **Ab
)
{
double pivot;
int c;
int r;
for (c=C1; c<Ab[C_SIZE_A][C0]; c++)
{
r = c;
pivot = 0.;
while((pivot<ERROR_E) &&
r<Ab[R_SIZE][C0])
{
pivot = fabs(c_coef_R(Ab,r,c));
if(pivot>ERROR_E)
swapR_mR(Ab,r,c);
r++;
}
}
return(Ab);
}
/* ------------------------------------
------------------------------------ */
void xx_sort_r_mR(
double **Ab
)
{
double pivot;
int c;
int r;
int r_pivot;
r_pivot=R1;
r=R1;
for ( c=C1; c<Ab[C_SIZE_A][C0]; c++)
{
pivot = 0.;
r = r_pivot =c;
while((pivot<ERROR_E) &&
r<Ab[R_SIZE][C0])
{
pivot = c_coef_R(Ab,r,c);
if(pivot>ERROR_E) swapR_mR(Ab,r,r_pivot);
r++;
}
}
}
/* --------------------------------------------------------------------------
-------------------------------------------------------------------------- */
void sort4_r_coef_r0_mR(
double **Ab
)
{
double **Ab_T = i_duplicateR0_mR(Ab[R_SIZE][C0],
Ab[C_SIZE][C0]);
int c;
int r;
int T;
for ( r=R1; r<Ab[R_SIZE][C0]; r++)
for ( c=C1; c<Ab[C_SIZE][C0]; c++)
{
T= c_coefR0_R(Ab,R0,r);
Ab_T[T][c] = Ab[r][c];
}
cR0_mR(Ab_T,Ab);
f_mR(Ab_T);
}
/* ------------------------------------ */
/* ------------------------------------ */
Déclaration des fichiers h.
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.