--- rpl/src/algebre_lineaire2.c 2013/02/27 17:11:39 1.41 +++ rpl/src/algebre_lineaire2.c 2013/03/20 17:11:42 1.42 @@ -51,12 +51,11 @@ factorisation_lu(struct_processus *s_eta integer4 nombre_lignes_a; integer4 *pivot; - long n; - - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; + integer8 i; + integer8 j; + integer8 k; + integer8 n; + integer8 taille_matrice_f77; void *matrice_f77; void *tampon; @@ -71,7 +70,7 @@ factorisation_lu(struct_processus *s_eta { case 'I' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -82,7 +81,7 @@ factorisation_lu(struct_processus *s_eta { for(j = 0; j < (*s_matrice).nombre_lignes; j++) { - ((real8 *) matrice_f77)[k++] = ((integer8 **) + ((real8 *) matrice_f77)[k++] = (real8) ((integer8 **) (*s_matrice).tableau)[j][i]; } } @@ -94,8 +93,8 @@ factorisation_lu(struct_processus *s_eta free((integer8 **) (*s_matrice).tableau); - if (((*s_matrice).tableau = (void **) malloc((*s_matrice) - .nombre_lignes * sizeof(real8 *))) == NULL) + if (((*s_matrice).tableau = malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -104,8 +103,8 @@ factorisation_lu(struct_processus *s_eta for(i = 0; i < (*s_matrice).nombre_lignes; i++) { if ((((*s_matrice).tableau)[i] = - (real8 *) malloc((*s_matrice) - .nombre_colonnes * sizeof(real8))) == NULL) + (real8 *) malloc(((size_t) (*s_matrice) + .nombre_colonnes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -115,8 +114,8 @@ factorisation_lu(struct_processus *s_eta (*s_matrice).type = 'R'; - if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) + * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -150,8 +149,8 @@ factorisation_lu(struct_processus *s_eta (**s_permutation).nombre_lignes = dimension_vecteur_pivot; (**s_permutation).nombre_colonnes = dimension_vecteur_pivot; - if (((**s_permutation).tableau = malloc((**s_permutation) - .nombre_lignes * sizeof(integer8 *))) == NULL) + if (((**s_permutation).tableau = malloc(((size_t) (**s_permutation) + .nombre_lignes) * sizeof(integer8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -160,8 +159,8 @@ factorisation_lu(struct_processus *s_eta for(i = 0; i < (**s_permutation).nombre_lignes; i++) { if ((((integer8 **) (**s_permutation).tableau)[i] = - (integer8 *) malloc((**s_permutation).nombre_colonnes * - sizeof(integer8))) == NULL) + (integer8 *) malloc(((size_t) (**s_permutation) + .nombre_colonnes) * sizeof(integer8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -195,7 +194,7 @@ factorisation_lu(struct_processus *s_eta case 'R' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -211,8 +210,8 @@ factorisation_lu(struct_processus *s_eta } } - if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) + * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -246,8 +245,8 @@ factorisation_lu(struct_processus *s_eta (**s_permutation).nombre_lignes = dimension_vecteur_pivot; (**s_permutation).nombre_colonnes = dimension_vecteur_pivot; - if (((**s_permutation).tableau = malloc((**s_permutation) - .nombre_lignes * sizeof(integer8 *))) == NULL) + if (((**s_permutation).tableau = malloc(((size_t) (**s_permutation) + .nombre_lignes) * sizeof(integer8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -256,8 +255,8 @@ factorisation_lu(struct_processus *s_eta for(i = 0; i < (**s_permutation).nombre_lignes; i++) { if ((((integer8 **) (**s_permutation).tableau)[i] = - (integer8 *) malloc((**s_permutation).nombre_colonnes * - sizeof(integer8))) == NULL) + (integer8 *) malloc(((size_t) (**s_permutation) + .nombre_colonnes) * sizeof(integer8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -291,7 +290,7 @@ factorisation_lu(struct_processus *s_eta case 'C' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -307,8 +306,8 @@ factorisation_lu(struct_processus *s_eta } } - if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) + * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -341,8 +340,8 @@ factorisation_lu(struct_processus *s_eta (**s_permutation).nombre_lignes = dimension_vecteur_pivot; (**s_permutation).nombre_colonnes = dimension_vecteur_pivot; - if (((**s_permutation).tableau = malloc((**s_permutation) - .nombre_lignes * sizeof(integer8 *))) == NULL) + if (((**s_permutation).tableau = malloc(((size_t) (**s_permutation) + .nombre_lignes) * sizeof(integer8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -351,8 +350,8 @@ factorisation_lu(struct_processus *s_eta for(i = 0; i < (**s_permutation).nombre_lignes; i++) { if ((((integer8 **) (**s_permutation).tableau)[i] = - (integer8 *) malloc((**s_permutation).nombre_colonnes * - sizeof(integer8))) == NULL) + (integer8 *) malloc(((size_t) (**s_permutation) + .nombre_colonnes) * sizeof(integer8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -413,7 +412,7 @@ factorisation_cholesky(struct_processus integer4 nombre_colonnes_a; integer4 nombre_lignes_a; - unsigned long taille_matrice_f77; + integer8 taille_matrice_f77; void *matrice_f77; @@ -436,7 +435,7 @@ factorisation_cholesky(struct_processus * Allocation du vecteur représentant la matrice triangulaire */ - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -495,8 +494,8 @@ factorisation_cholesky(struct_processus free((integer8 **) (*s_matrice).tableau); - if (((*s_matrice).tableau = (void **) malloc((*s_matrice) - .nombre_lignes * sizeof(real8 *))) == NULL) + if (((*s_matrice).tableau = malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -505,8 +504,8 @@ factorisation_cholesky(struct_processus for(i = 0; i < (integer4) (*s_matrice).nombre_lignes; i++) { if ((((*s_matrice).tableau)[i] = - (real8 *) malloc((*s_matrice) - .nombre_colonnes * sizeof(real8))) == NULL) + (real8 *) malloc(((size_t) (*s_matrice) + .nombre_colonnes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -567,7 +566,7 @@ factorisation_cholesky(struct_processus * Allocation du vecteur représentant la matrice triangulaire */ - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -668,7 +667,7 @@ factorisation_cholesky(struct_processus * Allocation du vecteur représentant la matrice triangulaire */ - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;