Linear Algebra and the C Language/a0f8


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00c.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double ** X_c_mR(
double **A,
double **B
)
{
int r;
int c;

 	for    (r=R1; r<A[R_SIZE][C0]; r++)
 	   for (c=C1; c<A[C_SIZE][C0]; c++)

            B[r][c] = A[r][c];

return(B);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r,int c)
{
double **A     = r_mR(i_mR(r,c),99.);
double **B     =      i_mR(r,c);

  clrscrn(); 
  
  printf(" A :");
  p_mR(A, S5,P0,C10);   
    
  printf(" B : c_mR(A,B);");
  c_mR(A,B);
  p_mR(B, S5,P0,C10);
   
  f_mR(A);
  f_mR(B); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

int i;

do
{
  i = rp_I(R3)+R1;
  
  fun(i,i+C1);

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Copy a matrix A into a matrix B:

Screen output example:

                                                                                       
 A :
   +8   +26    +5   -41 
  +90   -18   -98   +13 
  -58   -70   +83   -98 

 B : c_mR(A,B);
   +8   +26    +5   -41 
  +90   -18   -98   +13 
  -58   -70   +83   -98 


 Press   return to continue
 Press X return to stop