Linear Algebra and the C Language/a0f2


Install and compile this file in your working directory.

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

 	for     (r = R1; r < A[R_SIZE][C0]; r++)
 	   {
 	    for (c = C1; c < A[C_SIZE][C0]; c++)
            {
             printf("%+.*f ",dr,A[r][c]);
             }
         printf("\n");
        }
}

/* ------------------------------------ */
void fun(int r,int c)
{
double **A = r_mR(i_mR(r,c),9);

  clrscrn();

  printf(" A: p_mR(A, S4,P0,C8);");
  p_mR(A, S4,P0,C8);

  printf(" A: p2_mR(A,   P3   );\n");
  p2_mR(A,   P3);

  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
        fun(rp_I(R2)+R2, rp_I(C4)+C2);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Control the number of digits to display after the decimal point:

Screen output example:

                                                                                       
 A: p_mR(A, S4,P0,C8);
  -4   +6   +3   -8 
  -3   +8   +4   -1 
  -5   -5   +2   -4 
  +2   +2   +6   +6 

 A: p2_mR(A,   P3   );
-4.000 +6.000 +3.000 -8.000 
-3.000 +8.000 +4.000 -1.000 
-5.000 -5.000 +2.000 -4.000 
+2.000 +2.000 +6.000 +6.000 

 Press   return to continue
 Press X return to stop