Linear Algebra and the C Language/a0kx
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00e.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_clean_eye_mR(
double **ID
)
{
int r;
int c;
isquare_mR(ID,"clean_eye_mR();","(ID)");
for ( r=R1; r<ID[R_SIZE][C0]; r++)
for ( c=C1; c<ID[C_SIZE][C0]; c++)
if(r!=c) ID[r][c] = 0.;
return(ID);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **A = r_mR(i_mR(R5,C5), 9);
clrscrn();
printf(" A:");
p_mR(A, S4,P0,C6);
printf(" clean_eye_mR(A);");
p_mR(clean_eye_mR(A), S4,P0,C6);
stop();
f_mR(A);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
A:
+2 -1 -6 +2 -7
-6 -6 +6 +7 +8
+9 -7 +9 -9 -2
+6 +1 -6 +2 +5
-7 -1 -6 +6 +3
clean_eye_mR(A);
+2 +0 +0 +0 +0
+0 -6 +0 +0 +0
+0 +0 +9 +0 +0
+0 +0 +0 +2 +0
+0 +0 +0 +0 +3
Press return to continue.