Linear Algebra and the C Language/a0fq


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
#define ARRAY  A3
/* ------------------------------------ */
#define    RA  R2
#define    CA  R5
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A[ARRAY];
int i;

  for(i=A0; i<ARRAY; i++)
 
      A[i] = r_mR(i_mR(RA,CA),99);           
 
  clrscrn();

  for(i=A0; i<ARRAY; i++)
     {
	  printf(" A[%d]:",i);      
      p_mR(A[i], S5,P0,C6); 
     } 
     
  for(i=A0; i<ARRAY; i++)
  
       f_mR(A[i]); 
   
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Create and initialize an array of matrices with the "for" loop:

Screen output example:

                                                                                       
 A[0] :
  +81   +93   +46   +63   +89 
   +2   -89   -10   -36   +31 

 A[1] :
  -16   -99   -49   +96   +55 
  -77   -54   +15   +91   -72 

 A[2] :
  +80   -68    -5   +40   -75 
  -83   -78   +46    +7   +74 


 Press   return to continue
 Press X return to stop