Mathc matrices/Fichiers h : vpm


Bibliothèque


Installer ce fichier dans votre répertoire de travail.

vpm.h
/* ------------------------------------ */
/*  Save as :   vpm.h                   */
/* ------------------------------------ */
double **p_mR(
double **A,  // R3xC8
int er,
int dr,
int n_cMAX   // C3
)
{
int r;
int c;

int c_LAST;
int c_FIRST;

int THE_LAST_c_TO_WRITE = C1;

      //        C1        <    C9
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
     {
		 
	               c_FIRST = THE_LAST_c_TO_WRITE; //C1	 
	 
      THE_LAST_c_TO_WRITE += n_cMAX;  //C1+C3=C4
                            
            //       C4      <     C9               
      if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])       
                              c_LAST  = THE_LAST_c_TO_WRITE; //C4
      else                             //    C9
                              c_LAST  = A[C_SIZE][C0];
              
      //           R1<R4
 	  for(r=R1; r<A[R_SIZE][C0]; r++)
         {
          printf("\n");
          //             C1<C9
 	      for (c=c_FIRST; c<c_LAST; c++)
 	           //                      Rr Rc
               printf("%+*.*f ",er,dr,A[r][c]);
          }
          
      printf("\n");
     }

  printf("\n");
           
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **pE_mR(
double **A,  // R3xC8
int er,
int dr,
int n_cMAX   // C3
)
{
int r;
int c;

int c_LAST;
int c_FIRST;

int THE_LAST_c_TO_WRITE = C1;

      //        C1        <    C9
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
     {
		 
	               c_FIRST = THE_LAST_c_TO_WRITE; //C1	 
	 
      THE_LAST_c_TO_WRITE += n_cMAX;  //C1+C3=C4
                            
            //       C4      <     C9               
      if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])       
                              c_LAST  = THE_LAST_c_TO_WRITE; //C4
      else                             //    C9
                              c_LAST  = A[C_SIZE][C0];
              
      //           R1<R4
 	  for(r=R1; r<A[R_SIZE][C0]; r++)
         {
          printf("\n");
          //             C1<C9
 	      for (c=c_FIRST; c<c_LAST; c++)
 	           //                      Rr Rc
               printf("%+*.*e ",er,dr,A[r][c]);
          }
          
      printf("\n");
     }
     
  printf("\n");
       
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **P_mR(
double **A,  // R3xC8
int er,
int dr,
int n_cMAX   // C3
)
{
int r;
int c;

int c_LAST;
int c_FIRST;

int THE_LAST_c_TO_WRITE = C1;

      //        C1        <    C9
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
     {
		 
	               c_FIRST = THE_LAST_c_TO_WRITE; //C1	 
	 
      THE_LAST_c_TO_WRITE += n_cMAX;  //C1+C3=C4
                            
            //       C4      <     C9               
      if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])       
                              c_LAST  = THE_LAST_c_TO_WRITE; //C4
      else                             //    C9
                              c_LAST  = A[C_SIZE][C0];
              
      //           R1<R4
 	  for(r=R1; r<A[R_SIZE][C0]; r++)
         {
          printf("\n");
          //             C1<C9
 	      for (c=c_FIRST; c<c_LAST; c++)
 	           //                      Rr Rc
               printf("%+*.*f, ",er,dr,A[r][c]);
          }
          
      printf("\b\b \n");
     }

  printf("\n");
           
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
double **PE_mR(
double **A,  // R3xC8
int er,
int dr,
int n_cMAX   // C3
)
{
int r;
int c;

int c_LAST;
int c_FIRST;

int THE_LAST_c_TO_WRITE = C1;

      //        C1        <    C9
while(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])
     {
		 
	               c_FIRST = THE_LAST_c_TO_WRITE; //C1	 
	 
      THE_LAST_c_TO_WRITE += n_cMAX;  //C1+C3=C4
                            
            //       C4      <     C9               
      if(THE_LAST_c_TO_WRITE < A[C_SIZE][C0])       
                              c_LAST  = THE_LAST_c_TO_WRITE; //C4
      else                             //    C9
                              c_LAST  = A[C_SIZE][C0];
              
      //           R1<R4
 	  for(r=R1; r<A[R_SIZE][C0]; r++)
         {
          printf("\n");
          //             C1<C9
 	      for (c=c_FIRST; c<c_LAST; c++)
 	           //                      Rr Rc
               printf("%+*.*e, ",er,dr,A[r][c]);
          }
          
      printf("\b\b \n");
     }
     
  printf("\n");
       
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */

Ces fonctions permettent d'imprimer une matrice à l'écran.

Les versions P_mR(); et PE_mR(); ajoute une virgule qui sépare les nombres, au lieu d'un simple espace, pour pouvoir facilement réintroduire une matrice dans un fichier c.

On peut contrôler la taille des colonnes, le nombre de chiffres après le point, le nombre de colonnes par ligne.