Linear Algebra and the C Language/a0ku
Install and compile this file in your working directory.
/* ------------------------------------ */
/* Save as : c00b.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_eye_mR(
double **ID
)
{
int r;
int c;
isquare_mR(ID,"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] = 1.;
else ID[r][c] = 0.;
return(ID);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **ID = eye_mR(i_mR(R5,C5));
clrscrn();
printf(" ID:");
p_mR(ID, S4,P0,C6);
stop();
f_mR(ID);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Screen output example:
ID:
+1 +0 +0 +0 +0
+0 +1 +0 +0 +0
+0 +0 +1 +0 +0
+0 +0 +0 +1 +0
+0 +0 +0 +0 +1
Press return to continue.