Linear Algebra and the C Language/a0em
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **x_i_RC_mR(
int R, /* A[R_SIZE][C0] */
int C /* A[C_SIZE][C0] */
)
{
return(i_mR(--R,--C)); /* I subtract row and column zero */
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **A = i_mR( R3, C5 );
double **B = i_mR( rsize_R(A), csize_R(A) );
double **C = i_RC_mR( A[R_SIZE][C0],A[C_SIZE][C0] );
clrscrn();
r_mR(A,9);
printf(" A:");
p_mR(A, S8,P0,C7);
printf(" B:");
c_mR(A,B);
p_mR(B, S8,P0,C7);
printf(" C:");
c_mR(A,C);
p_mR(C, S8,P0,C7);
stop();
f_mR(A);
f_mR(B);
f_mR(C);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A:
+2 -1 -6 +2 -7
-6 -6 +6 +7 +8
+9 -7 +9 -9 -2
B:
+2 -1 -6 +2 -7
-6 -6 +6 +7 +8
+9 -7 +9 -9 -2
C:
+2 -1 -6 +2 -7
-6 -6 +6 +7 +8
+9 -7 +9 -9 -2
Press return to continue.