Linear Algebra and the C Language/a0g6


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include      "v_a.h"
/* ------------------------------------ */
int main(void)
{
double  a[R3*C3]={ 1,2,3,
                   1,9,9,
                   1,9,9 };
                   	
double id[R3*C3]={ 1,-2,-3,
                   0, 1, 0,
                   0, 0, 1 };                
              
double **A  = ca_A_mR(a,    i_mR(R3,C3));
double **ID = ca_A_mR(id,   i_mR(R3,C3));

double **AID = mul_mR(A,ID, i_mR(R3,C3));

  clrscrn();
  printf(" Zero on the right of the pivot: [R1,C1]\n\n");
  
  printf(" ID:");
  p_mR(ID, S3,P0,C6);
  
  printf(" A:");
  p_mR(A, S3,P0,C6);
  
  printf("  A ID:");
  p_mR(AID, S3,P1,C6);
  stop();
     
  f_mR(A);
  f_mR(ID);
  f_mR(AID);

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Zero on the right of the pivot:

Screen output example:

                                                                                       
 Zero on the right of the pivot: [R1,C1]

 ID:
 +1  -2  -3 
 +0  +1  +0 
 +0  +0  +1 

 A:
 +1  +2  +3 
 +1  +9  +9 
 +1  +9  +9 

  A ID:
+1.0 +0.0 +0.0 
+1.0 +7.0 +6.0 
+1.0 +7.0 +6.0 

 Press return to continue.