Linear Algebra and the C Language/a06f
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A = r_mR( i_mR(rc,rc),9999.);
double **Inv = inv_mR(A, i_mR(rc,rc));
double **ID = mul_mR(Inv,A, i_mR(rc,rc));
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(A,"A",P0);
printf(" inv(A)\n");
pE_mR(Inv, S12,P4,C5);
printf(" inv(A) A:");
p_mR(ID, S0,P4,C8);
f_mR(ID);
f_mR(Inv);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(RC4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
Copy/Paste into the octave window.
A=[
+6031,-7292,-9751;
+293,+7592,+7835;
+4201,-4220,-7824]
inv(A)
+2.8469e-04 +1.7191e-04 -1.8265e-04
-3.8058e-04 +6.7264e-05 +5.4167e-04
+3.5813e-04 +5.6025e-05 -5.1804e-04
Press return to continue.
inv(A)*A
+1.0000 -0.0000 -0.0000
-0.0000 +1.0000 +0.0000
+0.0000 +0.0000 +1.0000
Press return to continue
Press X return to stop