Linear Algebra and the C Language/a09j
Code study: gj_PP_mR(Ab,above);
- You select the good pivot.
- You put zero under the pivot.
- If above is TRUE (1), you put zero above the pivot.
- If above is FALSE (0), you do nothing.
.
- gj3_T_mR(); I use this name when I call the function into a function.
- gj_PP_mR(); I use this name when I call the function into a C file.
/* ------------------------------------ */
/* ------------------------------------ */
void gj3_T_mR(
double **Ab,
int above
)
{
int r= R1;
int c= C1;
while( (r<Ab[R_SIZE][C0]) &&
(c<Ab[C_SIZE_A][C0]) )
{
if(pivotbest_gj3Ab_mR(Ab,r,c)>ERROR_E)
zero_under_pivot_gj3Ab_mR(Ab,r,c);
else r--;
r++;
c++;
}
r = Ab[R_SIZE][C0];
if(above)
while(r>R1)
{
r--;
c=C1;
while(fabs(Ab[r][c])<ERROR_E && c<(Ab[C_SIZE_A][C0]-C1) ) c++;
if(fabs(Ab[r][c])>ERROR_E)
zero_above_pivot_gj3Ab_mR(Ab,r,c);
}
}
/* ------------------------------------ */
/* ------------------------------------ */
double **gj_PP_mR(
double **Ab,
int above
)
{
gj3_T_mR(Ab,above);
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */