Linear Algebra and the C Language/a0em


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */   
double **x_i_RC_mR(
int      R,            /* A[R_SIZE][C0] */ 
int      C             /* A[C_SIZE][C0] */ 
)
{
return(i_mR(--R,--C)); /* I subtract row and column zero */  
}
/* ------------------------------------ */ 
/* ------------------------------------ */
int main(void)
{
 double **A     =   i_mR(               R3,          C5  );
 double **B     =   i_mR(       rsize_R(A),   csize_R(A) );
 double **C     =   i_RC_mR( A[R_SIZE][C0],A[C_SIZE][C0] );
 
 double **FUN   =   i_RC_mR(    rsize_R(A),csize_R(A)    );
  
   clrscrn();

   printf(" A:");
   p_mR(A, S8,P0,C7);
   	
   printf(" B:");
   p_mR(B, S8,P0,C7);

   printf(" C:");
   p_mR(C, S8,P0,C7);
   
   printf(" FUN:");
   p_mR(FUN, S8,P0,C7);
   
   stop();
   
   f_mR(A);
   f_mR(B);
   f_mR(C);    
   f_mR(FUN);  
     
   return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
The function i_RC_mR(); allows you to copy the size of a matrix using the values ​​in memory, instead of calling the functions rsize_R(); and csize_R();.

The function i_RC_mR(); starts by subtracting row zero and column zero, then it calls the function i_mR();

The FUN matrix lost one row and one column due to the use of functions rsize_R(); and csize_R();

Screen output example:

                                                                                       
 A:
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 

 B:
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 

 C:
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 
      +0       +0       +0       +0       +0 

 FUN:
      +0       +0       +0       +0 
      +0       +0       +0       +0 

 Press return to continue.