Linear Algebra and the C Language/a0eg


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */   
void x_isquare_mR(
double **A,
char function[],
char matrices[]
)
{
   if ( A[R_SIZE][C0] != A[C_SIZE][C0] )
    {
     printf("\n Error : %s\n",function);
     printf("\n The matrix must be square. %s \n",matrices);
     stop();
     exit(EXIT_FAILURE);
    }
}
/* ------------------------------------ */
int main(void)
{  
double **A     = i_mR(R5,R6);

  clrscrn();
  
  printf(" A[R%d,C%d]:",rsize_R(A),csize_R(A));
  p_mR(A, S4,P0,C6);

  isquare_mR(A,"det_R();","(A)");
  
  f_mR(A);
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Screen output example:

                                                                                       
 A[R5,C6]: 
  +0   +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0   +0 
  +0   +0   +0   +0   +0   +0 


 Error : det_R();

 The matrix must be square. (A) 
 Press return to continue.