Linear Algebra and the C Language/a0f7


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_c_s_mR(
double  s,
double **A,
int r,
int c
)
{
int Rmax = (A[R_SIZE][C0]-R1);
int Cmax = (A[C_SIZE][C0]-C1);

    if( r<R1 ||
        c<C1 ||
        r> Rmax||
        c> Cmax)
    {
     printf("\n Error : c_coef_R(); \n\n");
     printf("\n R = %d;  C = %d; \n",r,c);
     printf("\n R and C must be : \n");
     printf("\n R>=1; C>=1;\n R=<%d; C=<%d;\n",
              Rmax,
              Cmax);
     printf("\n Press return to continue. \n");
     fflush(stdout);
     getchar();
     exit(EXIT_FAILURE);
    }
         A[r][c] = s;
         
  return(A);         
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double **A     = i_mR(R3,C3);

  clrscrn(); 
  
  printf(" A :");
  p_mR(A,S5,P0,C10);   

  c_s_mR(100,A,R2,C2);
  
  printf(" A :  c_s_mR(100,A,R2,C2);");
  p_mR(A, S5,P0,C10);  
  
  stop();
  
  f_mR(A);

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

Screen output example:

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

 A :  c_s_mR(100,A,R2,C2);
   +0    +0    +0 
   +0  +100    +0 
   +0    +0    +0 

 Press return to continue.