Linear Algebra and the C Language/a0l0


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as:   c00c.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void X_gj3_T_mR(
double **Ab,
int above
)
{
int r= R1;
int c= C1;

   while( (r<Ab[R_SIZE][C0]) &&
           (c<Ab[C_SIZE_A][C0]) )
       {
		printf(" Ab:");
        p_mR(Ab,S12,P4,C8);	
        
        if(pivotbest_gj3Ab_mR(Ab,r,c)>ERROR_E) 
        {
	      printf(" Ab: pivot[%d][[%d]" 
	             "     pivotbest_gj3Ab_mR_mR(Ab,r);",r,r);
          p_mR(Ab,S12,P4,C8);
          				
           zero_under_pivot_gj3Ab_mR(Ab,r,c);
           
         printf(" Ab: pivot[%d][[%d]"
                "     zero_under_pivot_gj1Ab_mR();",r,r); 
         p_mR(Ab,S12,P4,C8);	
         stop();
         clrscrn();
                      
         }  
        else r--;
        
        r++;
        c++;
       }

 r = Ab[R_SIZE][C0];
/* 
 if(above)
 
 while(r>R1)
  {
   r--;
   c=C1;
   
   while(fabs(Ab[r][c])<ERROR_E  &&  c<(Ab[C_SIZE_A][C0]-C1) ) c++;
         
   if(fabs(Ab[r][c])>ERROR_E)
   
      zero_above_pivot_gj3Ab_mR(Ab,r,c);
  }*/
}
/* ------------------------------------ */
double **X_gj_PP_mR(
double **Ab,
int above
)
{
   X_gj3_T_mR(Ab,above);
  
return(Ab);
}
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r)
{
double **A  =        r_mR(     i_mR(r,r),999.);
double **b  =        r_mR(     i_mR(r,C1),999.);
double **Ab = c_A_b_Ab_mR(A,b, i_Abr_Ac_bc_mR(  r,  r, C1));;
/*                             i_Abr_Ac_bc_mR(RAb, CA, Cb)); */
  
  clrscrn();
  
  X_gj_PP_mR(Ab,NO);
  
  printf("  gj_PP_mR(Ab,NO);");
  p_mR(Ab,S10,P4,C7);
  
  
  f_mR(Ab);
  f_mR(b);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(R5);


} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:

                                                                                       
 Ab:
   +327.0000    -155.0000    -511.0000    -507.0000    +473.0000    +633.0000 
   -514.0000    -180.0000    -176.0000    -453.0000    -618.0000    -466.0000 
   -903.0000    +335.0000    +302.0000    +746.0000    -508.0000    -251.0000 
   +116.0000    -566.0000    +925.0000    -528.0000    +940.0000    -986.0000 
   +325.0000    +108.0000    -762.0000    -383.0000    -867.0000    +982.0000 

 Ab: pivot[1][[1]     pivotbest_gj3Ab_mR_mR(Ab,r);
   -903.0000    +335.0000    +302.0000    +746.0000    -508.0000    -251.0000 
   -514.0000    -180.0000    -176.0000    -453.0000    -618.0000    -466.0000 
   +327.0000    -155.0000    -511.0000    -507.0000    +473.0000    +633.0000 
   +116.0000    -566.0000    +925.0000    -528.0000    +940.0000    -986.0000 
   +325.0000    +108.0000    -762.0000    -383.0000    -867.0000    +982.0000 

 Ab: pivot[1][[1]     zero_under_pivot_gj1Ab_mR();
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     +0.0000    -370.6866    -347.9025    -877.6334    -328.8394    -323.1274 
     +0.0000     -33.6877    -401.6379    -236.8538    +289.0399    +542.1063 
     +0.0000    -522.9657    +963.7951    -432.1683    +874.7420   -1018.2436 
     +0.0000    +228.5703    -653.3068    -114.5061   -1049.8350    +891.6622 

 Press return to continue. 


 Ab:
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     +0.0000    -370.6866    -347.9025    -877.6334    -328.8394    -323.1274 
     +0.0000     -33.6877    -401.6379    -236.8538    +289.0399    +542.1063 
     +0.0000    -522.9657    +963.7951    -432.1683    +874.7420   -1018.2436 
     +0.0000    +228.5703    -653.3068    -114.5061   -1049.8350    +891.6622 

 Ab: pivot[2][[2]     pivotbest_gj3Ab_mR_mR(Ab,r);
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     +0.0000    -522.9657    +963.7951    -432.1683    +874.7420   -1018.2436 
     +0.0000     -33.6877    -401.6379    -236.8538    +289.0399    +542.1063 
     +0.0000    -370.6866    -347.9025    -877.6334    -328.8394    -323.1274 
     +0.0000    +228.5703    -653.3068    -114.5061   -1049.8350    +891.6622 

 Ab: pivot[2][[2]     zero_under_pivot_gj1Ab_mR();
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     +0.0000      +0.0000    -463.7223    -209.0150    +232.6919    +607.6982 
     +0.0000      +0.0000   -1031.0563    -571.3055    -948.8708    +398.6203 
     +0.0000      +0.0000    -232.0650    -303.3920    -667.5153    +446.6229 

 Press return to continue. 


 Ab:
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     +0.0000      +0.0000    -463.7223    -209.0150    +232.6919    +607.6982 
     +0.0000      +0.0000   -1031.0563    -571.3055    -948.8708    +398.6203 
     +0.0000      +0.0000    -232.0650    -303.3920    -667.5153    +446.6229 

 Ab: pivot[3][[3]     pivotbest_gj3Ab_mR_mR(Ab,r);
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     +0.0000      +0.0000   -1031.0563    -571.3055    -948.8708    +398.6203 
     +0.0000      +0.0000    -463.7223    -209.0150    +232.6919    +607.6982 
     +0.0000      +0.0000    -232.0650    -303.3920    -667.5153    +446.6229 

 Ab: pivot[3][[3]     zero_under_pivot_gj1Ab_mR();
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     +0.0000      +0.0000      +0.0000     +47.9323    +659.4510    +428.4168 
     +0.0000      +0.0000      +0.0000    -174.8054    -453.9482    +356.9034 

 Press return to continue. 


 Ab:
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     +0.0000      +0.0000      +0.0000     +47.9323    +659.4510    +428.4168 
     +0.0000      +0.0000      +0.0000    -174.8054    -453.9482    +356.9034 

 Ab: pivot[4][[4]     pivotbest_gj3Ab_mR_mR(Ab,r);
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     +0.0000      +0.0000      +0.0000    -174.8054    -453.9482    +356.9034 
     +0.0000      +0.0000      +0.0000     +47.9323    +659.4510    +428.4168 

 Ab: pivot[4][[4]     zero_under_pivot_gj1Ab_mR();
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     -0.0000      -0.0000      -0.0000      +1.0000      +2.5969      -2.0417 
     +0.0000      +0.0000      +0.0000      +0.0000    +534.9766    +526.2811 

 Press return to continue. 


 Ab:
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     -0.0000      -0.0000      -0.0000      +1.0000      +2.5969      -2.0417 
     +0.0000      +0.0000      +0.0000      +0.0000    +534.9766    +526.2811 

 Ab: pivot[5][[5]     pivotbest_gj3Ab_mR_mR(Ab,r);
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     -0.0000      -0.0000      -0.0000      +1.0000      +2.5969      -2.0417 
     +0.0000      +0.0000      +0.0000      +0.0000    +534.9766    +526.2811 

 Ab: pivot[5][[5]     zero_under_pivot_gj1Ab_mR();
     +1.0000      -0.3710      -0.3344      -0.8261      +0.5626      +0.2780 
     -0.0000      +1.0000      -1.8429      +0.8264      -1.6727      +1.9471 
     -0.0000      -0.0000      +1.0000      +0.5541      +0.9203      -0.3866 
     -0.0000      -0.0000      -0.0000      +1.0000      +2.5969      -2.0417 
     +0.0000      +0.0000      +0.0000      +0.0000      +1.0000      +0.9837 

 Press return to continue. 


  gj_PP_mR(Ab,NO);
   +1.0000    -0.3710    -0.3344    -0.8261    +0.5626    +0.2780 
   -0.0000    +1.0000    -1.8429    +0.8264    -1.6727    +1.9471 
   -0.0000    -0.0000    +1.0000    +0.5541    +0.9203    -0.3866 
   -0.0000    -0.0000    -0.0000    +1.0000    +2.5969    -2.0417 
   +0.0000    +0.0000    +0.0000    +0.0000    +1.0000    +0.9837 


 Press   return to continue
 Press X return to stop