Linear Algebra and the C Language/a0fl


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
double **X_rlower_mR(
double **A,
int      n
)
{
int      r;
int      c;

  isquare_mR(A,"rlower_mR;","(A)");
  
  m0_mR(A);

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

             if(r>=c) A[r][c] = r_I(n);
 return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A = rlower_mR(i_mR(rc,rc),9);

  clrscrn();

  printf(" rlower_mR(): Lower triangular matrix\n\n" 
         " A[R%d,C%d] :",rsize_R(A),csize_R(A));
  p_mR(A,S4,P0,C8);
   
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
  do
        fun(rp_I(RC8));

  while(stop_w());       

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Lower triangular matrix:

Screen output example:

                                                                                       
 rlower_mR(): Lower triangular matrix

 A[R3,C3] :
  -7   +0   +0 
  -8   +1   +0 
  -7   -8   -6 


 Press   return to continue
 Press X return to stop