Linear Algebra and the C Language/a038
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
int n = 3;
double **A = r_mR(i_mR(rc,rc),9);
double **A_n = i_mR(rc,rc);
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);
f_mR(A);
f_mR(A_n);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do{
fun(rp_I(R3)+C1);
}while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A :
+8 -4 +9
-3 -9 +7
+9 +7 +7
A^3 :
+2018 -482 +2631
-267 -1829 +1301
+2673 +1247 +1929
Press return to continue.
Copy/Paste into the octave window.
A=[
+8,-4,+9;
-3,-9,+7;
+9,+7,+7]
A^3
+2018 -482 +2631
-267 -1829 +1301
+2673 +1247 +1929
Press return to continue
Press X return to stop