Linear Algebra and the C Language/a0ee


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
 double **A =    i_mR(  R3,           C5         );
 double **B = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]); 
 
   clrscrn();
   printf("A[%d][%d]:",rsize_R(A),csize_R(A));
   p_mR(A, S4,P0,C7);

   printf("B[%d][%d]:",rsize_R(B),csize_R(B));
   p_mR(B, S4,P0,C7);
   stop();

   f_mR(A);
  
   return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


You can use the function i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);, if you want a new matrix with the same size than A. You read the size of A directly into memory.


Screen output example:

                                                                                       
  A[3][5]:
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 

  B[3][5]:
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0 

 Press return to continue.