Mathc matrices/Fichiers h : vi err


Bibliothèque


Installer ce fichier dans votre répertoire de travail.

vi_err.h
/* ------------------------------------ */
/*  Save as :   vi_err.h                */
/* ------------------------------------ */

/* ------------------------------------ */   
void 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 Matrix must be square. %s \n",matrices);
     stop();
     exit(EXIT_FAILURE);
    }
}
/* ------------------------------------ */   
void dif_sizes_mR(
double **A,
double **B,
char function[],
char matrices[]
)
{
  if( A[R_SIZE][C0]!=B[R_SIZE][C0]
                    ||
       A[C_SIZE][C0]!=B[C_SIZE][C0] )
    {
     printf("\n Error : %s\n",function);
     printf("\n matrices different sizes. %s \n",matrices);
     stop();
     exit(EXIT_FAILURE);
    }
}
/* ------------------------------------ */   
void canItranspose_mR(
double **A,
double **A_t,
char function[],
char matrices[]
)
{
  if ((A[R_SIZE][C0] != A_t[C_SIZE][C0])
                        ||
       (A_t[R_SIZE][C0] !=   A[C_SIZE][C0]))
    {
     printf("\n Error : %s\n",function);
     printf("\n Verify the sizes of the matrices. %s \n",matrices);
     stop();
     exit(EXIT_FAILURE);
    }
}
/* ------------------------------------ */   
void canImul_mR(
double **A,
double **B,
double **AB,
char function[],
char matrices[]
)
{
  if (         ( A[C_SIZE][C0] != B[R_SIZE][C0] )
                               ||
               ( A[R_SIZE][C0] != AB[R_SIZE][C0] )
                               ||
               ( B[C_SIZE][C0] != AB[C_SIZE][C0] ) )
    {
     printf("\n Error : %s\n",function);
     printf("\n Verify the size of the matrices. %s \n",matrices);
     stop();
     exit(EXIT_FAILURE);
    }
}
/* ------------------------------------ */
/* ------------------------------------ */

Dans ce fichier se trouvent des fonctions qui permettront de vérifier si le calcul sur les matrices est possible.