Linear Algebra and the C Language/a09u
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR( i_mR(r,r),9999);
double **InvA = invgj_mR(A, i_mR(r,r));
clrscrn();
printf(" A:");
p_mR(A,S8,P0,C6);
printf(" invgj_mR(A,invA):");
pE_mR(InvA,S12,P4,C6);
stop();
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(A,"A",P0);
printf(" inv(A):");
pE_mR(InvA,S12,P4,C6);
f_mR(InvA);
f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(C2)+C4);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A:
-314 +5787 -635 -2437 +5590 -7613
+7653 +5862 -6150 -9246 +6018 -1737
+9862 -803 -7178 +6318 +485 -8361
+6166 -8009 +5799 -1846 -3464 -1034
-4697 -7557 +8893 +5762 +4152 -27
+1323 -1986 +33 -6089 +2727 -1119
Press return to continue.
invgj_mR(A,invA):
-1.7841e-05 +1.0638e-04 +4.3955e-06 +7.4680e-05 +2.7690e-05 -1.4628e-04
+6.4354e-05 +6.3918e-05 -4.9703e-05 +3.5495e-05 -1.3730e-05 -1.9814e-04
+6.8603e-05 +5.3403e-05 -6.3510e-05 +1.0324e-04 +3.6332e-05 -1.7136e-04
-1.7651e-05 +2.4517e-05 +2.8044e-05 -1.4670e-05 +4.8323e-05 -1.1512e-04
-2.6153e-05 +8.8911e-05 +1.1405e-05 -5.1790e-05 +1.0260e-04 +7.8937e-08
-1.0098e-04 +9.7182e-05 -3.3268e-05 -1.8041e-05 +4.5255e-05 -9.3379e-05
Press return to continue.
Copy/Paste into the octave window.
A=[
-314,+5787,-635,-2437,+5590,-7613;
+7653,+5862,-6150,-9246,+6018,-1737;
+9862,-803,-7178,+6318,+485,-8361;
+6166,-8009,+5799,-1846,-3464,-1034;
-4697,-7557,+8893,+5762,+4152,-27;
+1323,-1986,+33,-6089,+2727,-1119]
inv(A)
-1.7841e-05 +1.0638e-04 +4.3955e-06 +7.4680e-05 +2.7690e-05 -1.4628e-04
+6.4354e-05 +6.3918e-05 -4.9703e-05 +3.5495e-05 -1.3730e-05 -1.9814e-04
+6.8603e-05 +5.3403e-05 -6.3510e-05 +1.0324e-04 +3.6332e-05 -1.7136e-04
-1.7651e-05 +2.4517e-05 +2.8044e-05 -1.4670e-05 +4.8323e-05 -1.1512e-04
-2.6153e-05 +8.8911e-05 +1.1405e-05 -5.1790e-05 +1.0260e-04 +7.8937e-08
-1.0098e-04 +9.7182e-05 -3.3268e-05 -1.8041e-05 +4.5255e-05 -9.3379e-05
Press return to continue
Press X return to stop