Linear Algebra and the C Language/a059
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : zerop.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR(i_mR(r,r),99.);
clrscrn();
printf(" A :");
p_mR(A,S5,P0,C6);
pivotbest_mR(A,RC1);
printf(" A : The best pivot");
p_mR(A,S5,P0,C6);
zero_under_pivot_mR(A,RC1);
printf(" A : Put zero under the pivot");
p_mR(A,S8,P2,C6);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(R3)+R2);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Puts zero under the pivot:
Screen output example:
A :
+59 -57 +35
-41 +15 +72
+9 -25 -98
A : The best pivot
-98 -25 +9
+72 +15 -41
+35 -57 +59
A : Put zero under the pivot
+1.00 +0.26 -0.09
+0.00 -3.37 -34.39
+0.00 -65.93 +62.21
Press return to continue
Press X return to stop