Linear Algebra and the C Language/a0f6
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_ca_A_mR(
double a[],
double **A
)
{
int r;
int c;
int i=0;
for (r=R1; r<A[R_SIZE][C0]; r++)
for (c=C1; c<A[C_SIZE][C0]; c++)
A[r][c] = a[i++];
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double a[R2*C3]={ 1,2,3,
4,5,6};
double **A = ca_A_mR(a,i_mR(R2,C3));
clrscrn();
printf(" A : double **A = ca_A_mR(a,i_mR(R2,C3)); ");
p_mR(A, S5,P0,C6);
stop();
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Copy an array of numbers into a matrix:
Screen output example:
A : double **A = ca_A_mR(a,i_mR(R2,C3));
+1 +2 +3
+4 +5 +6
Press return to continue.