Linear Algebra and the C Language/a056
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : mulc.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double a[R3*C3] = { 1, 2, 3,
1, 2, 3,
1, 2, 3};
double **A = ca_A_mR(a,i_mR(R3,C3));
double s = 10.;
int c = C2;
clrscrn();
printf(" A :");
p_mR(A,S5,P0,C6);
printf(" mulC_mR(A, %+.0f, C%d)\n\n",s,c);
printf(" A :");
p_mR(mulC_mR(A,s,c),S5,P0,C6);
f_mR(A);
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Multiplies the column c by a scalar:
Screen output example:
A :
+1 +2 +3
+1 +2 +3
+1 +2 +3
mulC_mR(A, +10, C2)
A :
+1 +20 +3
+1 +20 +3
+1 +20 +3
Press return to continue.