Linear Algebra and the C Language/a039
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00e.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r,int c)
{
double **A = i_mR(r,c);
double **sA = i_mR(r,c);
double s = r_I(9);
clrscrn();
printf("\n s = %+.2f \n\n",s);
printf(" A : ");
p_mR(r_mR(A,9),S6,P0,C6);
printf(" sA : ");
p_mR(smul_mR(s,A,sA),S6,P0,C6);
stop();
clrscrn();
printf(" Copy/Paste into the octave window.\n\n");
p_Octave_mR(A,"A", P0);
printf("%.0f*A\n",s);
p_mR(sA,S6,P0,C6);
f_mR(A);
f_mR(sA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
fun(rp_I(R4),rp_I(C6));
while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
s = +7.00
A :
+4 +3 +2 -4
sA :
+28 +21 +14 -28
Press return to continue.
Copy/Paste into the octave window.
A=[
+4,+3,+2,-4]
7*A
+28 +21 +14 -28
Press return to continue
Press X return to stop