Linear Algebra and the C Language/a009
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_mR( i_mR(r,r),9.);
double **Aadjoint = adjoint_mR(A, i_mR(r,r) );
double **AAadjoint = mul_mR(A, Aadjoint, i_mR(r,r) );
clrscrn();
printf(" A :");
p_mR(A,S3,P0,C6);
printf(" adjoint(A) :");
p_mR(Aadjoint,S6,P0,C6);
printf(" A * adjoint(A) = det(A) * ID\t\t\tdet(A) = %+.0f", det_R(A));
p_mR(AAadjoint,S6,P0,C6);
f_mR(A);
f_mR(Aadjoint);
f_mR(AAadjoint);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun(rp_I(RC4)+C1);
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
-1 -9 -2
-7 +9 +3
-7 -7 +6
adjoint(A) :
+75 +68 -9
+21 -20 +17
+112 +56 -72
A * adjoint(A) = det(A) * ID det(A) = -488
-488 +0 +0
+0 -488 +0
+0 +0 -488
Press return to continue
Press X return to stop