Linear Algebra and the C Language/a0kc
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_gj_TP_mR(
double **Ab
)
{
gj1_T_mR(Ab); /* Best pivot */
sort_c_mR(Ab); /* Sort the columns */
sort_r_mR(Ab); /* Sort the rows */
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR( i_mR(r,r ),999.);
double **b = r_mR( i_mR(r,C1),999.);
double **Ab = c_A_b_Ab_mR(A,b, i_Abr_Ac_bc_mR(r, r, C1));
/* i_Abr_Ac_bc_mR(RAb, CA, Cb)); */
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(Ab,"Ab",P0);
printf("\n rref(Ab,.00000000001)\n\n");
stop();
clrscrn();
X_gj_TP_mR(Ab);
printf(" See above for the function code:\n\n gj_TP_mR(Ab); ");
p_mR(Ab, S10,P4,C7);
f_mR(Ab);
f_mR(b);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(RC5);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Copy/Paste into the octave window.
Ab=[
-327,+406,+622,-53,-91,-761;
-384,+609,-594,+400,-431,-499;
-398,-382,-988,+593,+559,+137;
-593,-339,+616,-390,-333,-910;
+840,-475,-17,-369,-686,+962]
rref(Ab,.00000000001)
Press return to continue.
See above for the function code:
gj_TP_mR(Ab);
+1.0000 +0.0000 +0.0000 +0.0000 +0.0000 +1.1624
+0.0000 +1.0000 +0.0000 +0.0000 +0.0000 -0.2555
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 -0.4157
-0.0000 +0.0000 +0.0000 +1.0000 +0.0000 -0.0858
+0.0000 -0.0000 -0.0000 +0.0000 +1.0000 +0.2544
Press return to continue
Press X return to stop