Linear Algebra and the C Language/a03g
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double a[R3*C3]={ 1,2,3,
4,5,6,
7,8,9};
int n = 3;
double **A = ca_A_mR(a,i_mR(R3,C3));
double **A_n = i_mR(R3,C3);
clrscrn();
printf(" A : ");
p_mR(A,S4,P0,C6);
printf(" A^%d :",n);
p_mR(pow_mR(n,A,A_n),
S3+n, /* Try 3 without */
P0,
C6);
stop();
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(A,"A", P0);
printf("A^%d\n",n);
p_mR(A_n,S3+n,P0,C6);
stop();
f_mR(A);
f_mR(A_n);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
+1 +2 +3
+4 +5 +6
+7 +8 +9
A^3 :
+468 +576 +684
+1062 +1305 +1548
+1656 +2034 +2412
Press return to continue.
Copy/Paste into the octave window.
A=[
+1,+2,+3;
+4,+5,+6;
+7,+8,+9]
A^3
+468 +576 +684
+1062 +1305 +1548
+1656 +2034 +2412
Press return to continue.