Linear Algebra and the C Language/a0f5
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00e.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **p5_mR(
double **A, // R3xC8
int er, // S4
int dr, // P0
int n_cMAX // C3
)
{
int r;
int c;
int c_LAST;
int c_FIRST;
int THE_LAST_c_TO_WRITE = C1;
// C8
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
{
c_FIRST = THE_LAST_c_TO_WRITE;
// C3 : Three columns by three
THE_LAST_c_TO_WRITE += n_cMAX;
if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
c_LAST = THE_LAST_c_TO_WRITE; // Print C3
// columns
else
c_LAST = A[C_SIZE][C0]; // Print the
// last columns
for(r=R1; r<A[R_SIZE][C0]; r++)
{
printf("\n");
for (c=c_FIRST; c<c_LAST; c++)
printf("%+*.*f ",er,dr,A[r][c]);
}
printf("\n");
}
printf("\n");
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **A = r_mR(i_mR(R3,C8),99.);
clrscrn();
printf(" A: p5_mR(A, S4,P0, C3);");
p5_mR( A, S4,P0, C3);
stop();
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Control the number of columns displayed per row:
Screen output example:
A: p5_mR(A, S4,P0, C3);
+29 -73 -24
+43 +80 +99
+55 -96 +74
+56 -70 -42
-61 +27 -45
+14 -52 -82
-6 +96
-92 +33
-78 +60
Press return to continue.