Mathc initiation/Fichiers h : x 18a3


Sommaire

Installer ce fichier dans votre répertoire de travail.

x_hinit.h
utilitaire
/* ---------------------------------- */
/* save as x_hinit.h                  */
/* ---------------------------------- */
double *I_Px(
int     coeff_nb)
{
int     coeff_nb_pls_Px0 = ++coeff_nb;
int     i  = 1;

double *Px = (double*) malloc( coeff_nb_pls_Px0 * sizeof(double));

   
    if(!Px) {
            printf(" I was unable to allocate "
                   "the memory you requested.\n\n"
                   " double *I_Px();\n\n"
                   " P = malloc(col * sizeof(*P));\n\n");
            fflush(stdout);
            getchar();
            exit(EXIT_FAILURE);
            }

    Px[0] = coeff_nb_pls_Px0;
    
    for(i = 1; i < coeff_nb_pls_Px0; i++) 
    
          Px[i] = 0;

 return(Px);
}
/* ----------------------------------------------------- */
void c_a_Px(
double  *a,
double  *Pa
)
{
int i=1;

 	for (i=1; i<Pa[0]; i++)

 	         Pa[i]=a[i-1];
}
/* ---------------------------------- */
/* ---------------------------------- */


La première fonction nous permet de créer et d'initialiser notre polynôme.

La deuxième fonction copie un tableau dans notre polynôme.