Linear Algebra and the C Language/a0fd


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_c_r1r2_mR(
double **A,
int r1,
int r2)
{
int c;

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

             A[r2][c] = A[r1][c];

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

  clrscrn(); 
  
  printf(" A :");
  p_mR(A, S5,P0,C10);   
    
  printf(" A : c_r1r2_mR(A,R1,R2);");
  p_mR(c_r1r2_mR(A,R1,R2), S5,P0,C10);
  
  f_mR(A);
}
/* ------------------------------------ */
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 row R1 into a row R2 of a matrix:

Screen output example:

                                                                                       
 A :
   +7   -59    +2 
  -65   +89   +68 

 A : c_r1r2_mR(A,R1,R2);
   +7   -59    +2 
   +7   -59    +2 


 Press   return to continue
 Press X return to stop