Mathc matrices/h10c
Installer ce fichier dans votre répertoire de travail.
vgconsit.h |
---|
/* ------------------------------------ */
/* Save as : vgconsit.h */
/* ------------------------------------ */
double add_coef_r_Ab_mR(
double **Ab,
int r
)
{
double x;
int c;
x=0.;
for ( c=C1; c<Ab[C_SIZE][C0]; c++)
x+=fabs(Ab[r][c]);
return(x);
}
/* ------------------------------------ */
double add_coef_r_A_mR(
double **Ab,
int r
)
{
double x;
int c;
x=0.;
for ( c=C1; c<Ab[C_SIZE_A][C0]; c++)
x+=fabs(Ab[r][c]);
return(x);
}
/* ------------------------------------ */
int is_system_consistent_mR(
double **Ab,
double **c_Ab
)
{
double **Ab_T;
int r;
int r_T;
int consistent;
consistent = 1;
Ab_T = i_duplicateR0_mR(Ab[R_SIZE][C0],Ab[C_SIZE][C0]);
r_T=R1;
for ( r=R1; r<Ab[R_SIZE][C0]; r++)
if(add_coef_r_A_mR(c_Ab,r)>ERROR_E)
{
c_r_mR(Ab,r,Ab_T,r_T);
r_T++;
}
else if((add_coef_r_A_mR(c_Ab,r)<ERROR_E) &&
(add_coef_r_Ab_mR(c_Ab,r)>ERROR_E))
{
if(consistent)printf(" This(ese) row(s) are incompatible.\n");
printf(" row %d; ",r);
consistent=0;
/* DEBUG:
printf(" row %d (%e,%e)\n",r,add_coef_r_A_mR(c_Ab,r),
add_coef_r_Ab_mR(c_Ab,r));
if(add_coef_r_A_mR(c_Ab,r)<ERROR_E)
printf(" add_coef_r_A_mR(c_Ab,r)<ERROR_E %e \n",
add_coef_r_A_mR(c_Ab,r));
if(add_coef_r_Ab_mR(c_Ab,r)>ERROR_E)
printf(" add_coef_r_Ab_mR(c_Ab,r)<ERROR_E %e \n",
add_coef_r_Ab_mR(c_Ab,r));
*/
}
c_mR(Ab_T,Ab);
f_mR(Ab_T);
if(!consistent)
{
printf("\n\n This(ese) equation(s) was (were)already \n");
printf(" defined with an other value(s)\n");
printf("\n The system is inconsistent. \n");
printf(" I prefer to close the program.\n");
printf(" Press return to continue. \n");
fflush(stdout);
getchar();
exit(EXIT_FAILURE);
}
return(r_T);
}
/* ------------------------------------ */
/* ------------------------------------ */
Les fichiers h.