--- rpl/src/algebre_lineaire3.c 2013/02/27 17:11:39 1.42 +++ rpl/src/algebre_lineaire3.c 2013/03/20 17:11:42 1.43 @@ -59,10 +59,10 @@ factorisation_schur(struct_processus *s_ unsigned char calcul_vecteurs_schur; unsigned char tri_vecteurs_schur; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_f77; void *matrice_a_f77; void *matrice_vs_f77; @@ -82,21 +82,22 @@ factorisation_schur(struct_processus *s_ { /* Conversion de la matrice en matrice réelle */ - for(i = 0; i < (unsigned long) nombre_lignes_a; i++) + for(i = 0; i < nombre_lignes_a; i++) { tampon = (*s_matrice).tableau[i]; if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) - malloc(nombre_colonnes_a * sizeof(real8))) == NULL) + malloc(((size_t) nombre_colonnes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - for(j = 0; j < (unsigned long) nombre_colonnes_a; j++) + for(j = 0; j < nombre_colonnes_a; j++) { - ((real8 **) (*s_matrice).tableau)[i][j] = + ((real8 **) (*s_matrice).tableau)[i][j] = (real8) ((integer8 *) tampon)[j]; } @@ -108,14 +109,14 @@ factorisation_schur(struct_processus *s_ case 'R' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((matrice_vs_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_vs_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -131,15 +132,15 @@ factorisation_schur(struct_processus *s_ } } - if ((wr = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) - == NULL) + if ((wr = (real8 *) malloc(((size_t) nombre_lignes_a) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((wi = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) - == NULL) + if ((wi = (real8 *) malloc(((size_t) nombre_lignes_a) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -159,10 +160,11 @@ factorisation_schur(struct_processus *s_ matrice_vs_f77, &nombre_colonnes_a, work, &lwork, NULL, &info, 1, 1); - lwork = ((real8 *) work)[0]; + lwork = (integer4) ((real8 *) work)[0]; free(work); - if ((work = (real8 *) malloc(lwork * sizeof(real8))) == NULL) + if ((work = (real8 *) malloc(((size_t) lwork) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -208,8 +210,8 @@ factorisation_schur(struct_processus *s_ (**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; (**s_schur).type = 'R'; - if (((**s_schur).tableau = malloc((**s_schur) - .nombre_lignes * sizeof(real8 *))) == NULL) + if (((**s_schur).tableau = malloc(((size_t) (**s_schur) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -218,7 +220,7 @@ factorisation_schur(struct_processus *s_ for(i = 0; i < (**s_schur).nombre_lignes; i++) { if ((((real8 **) (**s_schur).tableau)[i] = (real8 *) - malloc((**s_schur).nombre_colonnes * + malloc(((size_t) (**s_schur).nombre_colonnes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = @@ -244,14 +246,14 @@ factorisation_schur(struct_processus *s_ case 'C' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((matrice_vs_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_vs_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -271,8 +273,8 @@ factorisation_schur(struct_processus *s_ } } - if ((w = (complex16 *) malloc(nombre_lignes_a * sizeof(complex16))) - == NULL) + if ((w = (complex16 *) malloc(((size_t) nombre_lignes_a) * + sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -286,8 +288,8 @@ factorisation_schur(struct_processus *s_ return; } - if ((rwork = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) - == NULL) + if ((rwork = (real8 *) malloc(((size_t) nombre_lignes_a) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -299,11 +301,11 @@ factorisation_schur(struct_processus *s_ matrice_vs_f77, &nombre_colonnes_a, work, &lwork, rwork, NULL, &info, 1, 1); - lwork = ((complex16 *) work)[0].partie_reelle; + lwork = (integer4) ((complex16 *) work)[0].partie_reelle; free(work); - if ((work = (complex16 *) malloc(lwork * sizeof(complex16))) - == NULL) + if ((work = (complex16 *) malloc(((size_t) lwork) * + sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -353,8 +355,8 @@ factorisation_schur(struct_processus *s_ (**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; (**s_schur).type = 'C'; - if (((**s_schur).tableau = malloc((**s_schur) - .nombre_lignes * sizeof(complex16 *))) == NULL) + if (((**s_schur).tableau = malloc(((size_t) (**s_schur) + .nombre_lignes) * sizeof(complex16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -363,7 +365,7 @@ factorisation_schur(struct_processus *s_ for(i = 0; i < (**s_schur).nombre_lignes; i++) { if ((((complex16 **) (**s_schur).tableau)[i] = (complex16 *) - malloc((**s_schur).nombre_colonnes * + malloc(((size_t) (**s_schur).nombre_colonnes) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = @@ -416,10 +418,10 @@ factorisation_lq(struct_processus *s_eta integer4 nombre_lignes_a; integer4 erreur; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_f77; void *matrice_a_f77; void *tampon; @@ -435,21 +437,22 @@ factorisation_lq(struct_processus *s_eta { /* Conversion de la matrice en matrice réelle */ - for(i = 0; i < (unsigned long) nombre_lignes_a; i++) + for(i = 0; i < nombre_lignes_a; i++) { tampon = (*s_matrice).tableau[i]; if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) - malloc(nombre_colonnes_a * sizeof(real8))) == NULL) + malloc(((size_t) nombre_colonnes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - for(j = 0; j < (unsigned long) nombre_colonnes_a; j++) + for(j = 0; j < nombre_colonnes_a; j++) { - ((real8 **) (*s_matrice).tableau)[i][j] = + ((real8 **) (*s_matrice).tableau)[i][j] = (real8) ((integer8 *) tampon)[j]; } @@ -461,22 +464,23 @@ factorisation_lq(struct_processus *s_eta case 'R' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) - ? nombre_colonnes_a : nombre_lignes_a) * sizeof(real8))) - == NULL) + if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < + nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((work = malloc(nombre_lignes_a * sizeof(real8))) == NULL) + if ((work = malloc(((size_t) nombre_lignes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -505,9 +509,9 @@ factorisation_lq(struct_processus *s_eta return; } - for(k = 0, i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(k = 0, i = 0; i < nombre_colonnes_a; i++) { - for(j = 0; j < (unsigned long) nombre_lignes_a; j++) + for(j = 0; j < nombre_lignes_a; j++) { ((real8 **) (*s_matrice).tableau)[j][i] = ((real8 *) matrice_a_f77)[k++]; @@ -522,22 +526,23 @@ factorisation_lq(struct_processus *s_eta case 'C' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) - ? nombre_colonnes_a : nombre_lignes_a) * + if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < + nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((work = malloc(nombre_lignes_a * sizeof(complex16))) == NULL) + if ((work = malloc(((size_t) nombre_lignes_a) * sizeof(complex16))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -570,9 +575,9 @@ factorisation_lq(struct_processus *s_eta return; } - for(k = 0, i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(k = 0, i = 0; i < nombre_colonnes_a; i++) { - for(j = 0; j < (unsigned long) nombre_lignes_a; j++) + for(j = 0; j < nombre_lignes_a; j++) { ((complex16 **) (*s_matrice).tableau)[j][i].partie_reelle = ((complex16 *) matrice_a_f77)[k].partie_reelle; @@ -618,10 +623,10 @@ factorisation_qr(struct_processus *s_eta real8 *rwork; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_f77; void *matrice_a_f77; void *registre; @@ -638,21 +643,22 @@ factorisation_qr(struct_processus *s_eta { /* Conversion de la matrice en matrice réelle */ - for(i = 0; i < (unsigned long) nombre_lignes_a; i++) + for(i = 0; i < nombre_lignes_a; i++) { tampon = (*s_matrice).tableau[i]; if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) - malloc(nombre_colonnes_a * sizeof(real8))) == NULL) + malloc(((size_t) nombre_colonnes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - for(j = 0; j < (unsigned long) nombre_colonnes_a; j++) + for(j = 0; j < nombre_colonnes_a; j++) { - ((real8 **) (*s_matrice).tableau)[i][j] = + ((real8 **) (*s_matrice).tableau)[i][j] = (real8) ((integer8 *) tampon)[j]; } @@ -664,16 +670,16 @@ factorisation_qr(struct_processus *s_eta case 'R' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) - ? nombre_colonnes_a : nombre_lignes_a) * sizeof(real8))) - == NULL) + if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < + nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -688,13 +694,14 @@ factorisation_qr(struct_processus *s_eta } } - if ((pivot = malloc(nombre_colonnes_a * sizeof(integer4))) == NULL) + if ((pivot = malloc(((size_t) nombre_colonnes_a) * + sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - for(i = 0; i < (unsigned long) nombre_colonnes_a; pivot[i++] = 0); + for(i = 0; i < nombre_colonnes_a; pivot[i++] = 0); lwork = -1; @@ -710,11 +717,11 @@ factorisation_qr(struct_processus *s_eta &nombre_lignes_a, pivot, (*((real8 **) tau)), work, &lwork, &erreur); - lwork = ((real8 *) work)[0]; + lwork = (integer4) ((real8 *) work)[0]; free(work); - if ((work = malloc(lwork * sizeof(real8))) == NULL) + if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -722,14 +729,15 @@ factorisation_qr(struct_processus *s_eta // Calcul de la permutation - if ((registre = (void *) malloc(taille_matrice_f77 * + if ((registre = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - memcpy(registre, matrice_a_f77, taille_matrice_f77 * sizeof(real8)); + memcpy(registre, matrice_a_f77, ((size_t) taille_matrice_f77) * + sizeof(real8)); dgeqp3_(&nombre_lignes_a, &nombre_colonnes_a, registre, &nombre_lignes_a, pivot, (*((real8 **) tau)), @@ -767,9 +775,9 @@ factorisation_qr(struct_processus *s_eta return; } - for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(i = 0; i < nombre_colonnes_a; i++) { - if ((i + 1) != (unsigned long) pivot[i]) + if ((i + 1) != pivot[i]) { (*s_etat_processus).erreur_execution = d_ex_routines_mathematiques; @@ -785,9 +793,9 @@ factorisation_qr(struct_processus *s_eta free(pivot); - for(k = 0, i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(k = 0, i = 0; i < nombre_colonnes_a; i++) { - for(j = 0; j < (unsigned long) nombre_lignes_a; j++) + for(j = 0; j < nombre_lignes_a; j++) { ((real8 **) (*s_matrice).tableau)[j][i] = ((real8 *) matrice_a_f77)[k++]; @@ -802,16 +810,16 @@ factorisation_qr(struct_processus *s_eta case 'C' : { - if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) - ? nombre_colonnes_a : nombre_lignes_a) * sizeof(complex16))) - == NULL) + if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < + nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * + sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -830,19 +838,21 @@ factorisation_qr(struct_processus *s_eta } } - if ((pivot = malloc(nombre_colonnes_a * sizeof(integer4))) == NULL) + if ((pivot = malloc(((size_t) nombre_colonnes_a) * + sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((rwork = malloc(2 * nombre_colonnes_a * sizeof(real8))) == NULL) + if ((rwork = malloc(2 * ((size_t) nombre_colonnes_a) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - for(i = 0; i < (unsigned long) nombre_colonnes_a; pivot[i++] = 0); + for(i = 0; i < nombre_colonnes_a; pivot[i++] = 0); lwork = -1; @@ -873,11 +883,11 @@ factorisation_qr(struct_processus *s_eta return; } - lwork = ((complex16 *) work)[0].partie_reelle; + lwork = (integer4) ((complex16 *) work)[0].partie_reelle; free(work); - if ((work = malloc(lwork * sizeof(complex16))) == NULL) + if ((work = malloc(((size_t) lwork) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -885,7 +895,7 @@ factorisation_qr(struct_processus *s_eta // Calcul de la permutation - if ((registre = (void *) malloc(taille_matrice_f77 * + if ((registre = malloc(((size_t) taille_matrice_f77) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -893,7 +903,7 @@ factorisation_qr(struct_processus *s_eta } memcpy(registre, matrice_a_f77, - taille_matrice_f77 * sizeof(complex16)); + ((size_t) taille_matrice_f77) * sizeof(complex16)); zgeqp3_(&nombre_lignes_a, &nombre_colonnes_a, registre, &nombre_lignes_a, pivot, (*((complex16 **) tau)), @@ -939,9 +949,9 @@ factorisation_qr(struct_processus *s_eta free(rwork); - for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(i = 0; i < nombre_colonnes_a; i++) { - if ((i + 1) != (unsigned long) pivot[i]) + if ((i + 1) != pivot[i]) { (*s_etat_processus).erreur_execution = d_ex_routines_mathematiques; @@ -957,9 +967,9 @@ factorisation_qr(struct_processus *s_eta free(pivot); - for(k = 0, i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(k = 0, i = 0; i < nombre_colonnes_a; i++) { - for(j = 0; j < (unsigned long) nombre_lignes_a; j++) + for(j = 0; j < nombre_lignes_a; j++) { ((complex16 **) (*s_matrice).tableau)[j][i].partie_reelle = ((complex16 *) matrice_a_f77)[k].partie_reelle; @@ -1014,7 +1024,7 @@ calcul_rang(struct_processus *s_etat_pro unsigned char norme; - unsigned long i; + integer8 i; void *matrice_b; void *matrice_c; @@ -1024,7 +1034,7 @@ calcul_rang(struct_processus *s_etat_pro #ifdef NORME_I norme = 'I'; - if ((work = malloc(nombre_lignes_a * sizeof(real8))) == NULL) + if ((work = malloc(((size_t) nombre_lignes_a) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); @@ -1045,15 +1055,15 @@ calcul_rang(struct_processus *s_etat_pro free(work); #endif - if ((matrice_c = malloc(nombre_lignes_a * nombre_colonnes_a * - sizeof(real8))) == NULL) + if ((matrice_c = malloc(((size_t) (nombre_lignes_a * nombre_colonnes_a)) + * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - memcpy(matrice_c, matrice_f77, nombre_lignes_a * nombre_colonnes_a * - sizeof(real8)); + memcpy(matrice_c, matrice_f77, ((size_t) (nombre_lignes_a * + nombre_colonnes_a)) * sizeof(real8)); dgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, &nombre_lignes_a, pivot, &erreur); @@ -1067,13 +1077,15 @@ calcul_rang(struct_processus *s_etat_pro return(-1); } - if ((iwork = malloc(nombre_colonnes_a * sizeof(integer4))) == NULL) + if ((iwork = malloc(((size_t) nombre_colonnes_a) * sizeof(integer4))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - if ((work = malloc(4 * nombre_colonnes_a * sizeof(real8))) == NULL) + if ((work = malloc(4 * ((size_t) nombre_colonnes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); @@ -1098,13 +1110,14 @@ calcul_rang(struct_processus *s_etat_pro return(-1); } - if ((jpvt = malloc(nombre_colonnes_a * sizeof(integer4))) == NULL) + if ((jpvt = malloc(((size_t) nombre_colonnes_a) * sizeof(integer4))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(i = 0; i < nombre_colonnes_a; i++) { ((integer4 *) jpvt)[i] = 0; } @@ -1121,13 +1134,14 @@ calcul_rang(struct_processus *s_etat_pro nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) ? nombre_lignes_a : nombre_colonnes_a; - if ((matrice_b = malloc(nombre_lignes_b * sizeof(real8))) == NULL) + if ((matrice_b = malloc(((size_t) nombre_lignes_b) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - for(i = 0; i < (unsigned long) nombre_lignes_b; i++) + for(i = 0; i < nombre_lignes_b; i++) { ((real8 *) matrice_b)[i] = 0; } @@ -1137,10 +1151,10 @@ calcul_rang(struct_processus *s_etat_pro matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, work, &lwork, &erreur); - lwork = ((real8 *) work)[0]; + lwork = (integer4) ((real8 *) work)[0]; free(work); - if ((work = malloc(lwork * sizeof(real8))) == NULL) + if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); @@ -1174,15 +1188,15 @@ calcul_rang(struct_processus *s_etat_pro free(work); #endif - if ((matrice_c = malloc(nombre_lignes_a * nombre_colonnes_a * - sizeof(complex16))) == NULL) + if ((matrice_c = malloc(((size_t) (nombre_lignes_a * nombre_colonnes_a)) + * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - memcpy(matrice_c, matrice_f77, nombre_lignes_a * nombre_colonnes_a * - sizeof(complex16)); + memcpy(matrice_c, matrice_f77, ((size_t) (nombre_lignes_a * + nombre_colonnes_a)) * sizeof(complex16)); zgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, &nombre_lignes_a, pivot, &erreur); @@ -1196,13 +1210,15 @@ calcul_rang(struct_processus *s_etat_pro return(-1); } - if ((rwork = malloc(2 * nombre_colonnes_a * sizeof(real8))) == NULL) + if ((rwork = malloc(2 * ((size_t) nombre_colonnes_a) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - if ((work = malloc(2 * nombre_colonnes_a * sizeof(complex16))) == NULL) + if ((work = malloc(2 * ((size_t) nombre_colonnes_a) * + sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); @@ -1226,13 +1242,14 @@ calcul_rang(struct_processus *s_etat_pro return(-1); } - if ((jpvt = malloc(nombre_colonnes_a * sizeof(integer4))) == NULL) + if ((jpvt = malloc(((size_t) nombre_colonnes_a) * sizeof(integer4))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) + for(i = 0; i < nombre_colonnes_a; i++) { ((integer4 *) jpvt)[i] = 0; } @@ -1249,13 +1266,14 @@ calcul_rang(struct_processus *s_etat_pro nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) ? nombre_lignes_a : nombre_colonnes_a; - if ((matrice_b = malloc(nombre_lignes_b * sizeof(complex16))) == NULL) + if ((matrice_b = malloc(((size_t) nombre_lignes_b) * + sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); } - for(i = 0; i < (unsigned long) nombre_lignes_b; i++) + for(i = 0; i < nombre_lignes_b; i++) { ((complex16 *) matrice_b)[i].partie_reelle = 0; ((complex16 *) matrice_b)[i].partie_imaginaire = 0; @@ -1266,10 +1284,10 @@ calcul_rang(struct_processus *s_etat_pro matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, work, &lwork, rwork, &erreur); - lwork = ((complex16 *) work)[0].partie_reelle; + lwork = (integer4) ((complex16 *) work)[0].partie_reelle; free(work); - if ((work = malloc(lwork * sizeof(complex16))) == NULL) + if ((work = malloc(((size_t) lwork) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(-1); @@ -1312,15 +1330,14 @@ determinant(struct_processus *s_etat_pro integer4 *pivot; integer4 rang; + integer8 i; + integer8 j; + integer8 k; integer8 signe; + integer8 taille_matrice_f77; real8 *vecteur_reel; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; - void *matrice_f77; nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes; @@ -1333,7 +1350,7 @@ determinant(struct_processus *s_etat_pro { 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; @@ -1344,13 +1361,13 @@ determinant(struct_processus *s_etat_pro { 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]; } } - 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; @@ -1369,8 +1386,8 @@ determinant(struct_processus *s_etat_pro } else { - if ((vecteur_reel = malloc((*s_matrice).nombre_colonnes * - sizeof(real8))) == NULL) + if ((vecteur_reel = malloc(((size_t) ((*s_matrice) + .nombre_colonnes)) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1381,7 +1398,7 @@ determinant(struct_processus *s_etat_pro for(i = 0; i < (*s_matrice).nombre_colonnes; i++) { - if ((unsigned long) pivot[i] != (i + 1)) + if (pivot[i] != (i + 1)) { signe = (signe == 1) ? -1 : 1; } @@ -1395,8 +1412,7 @@ determinant(struct_processus *s_etat_pro vecteur_reel[0] *= vecteur_reel[i]; } - (*((real8 *) valeur)) = vecteur_reel[0] * signe; - + (*((real8 *) valeur)) = vecteur_reel[0] * ((real8) signe); free(vecteur_reel); } @@ -1408,7 +1424,7 @@ determinant(struct_processus *s_etat_pro 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; @@ -1424,8 +1440,8 @@ determinant(struct_processus *s_etat_pro } } - 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; @@ -1444,8 +1460,8 @@ determinant(struct_processus *s_etat_pro } else { - if ((vecteur_reel = malloc((*s_matrice).nombre_colonnes * - sizeof(real8))) == NULL) + if ((vecteur_reel = malloc(((size_t) (*s_matrice) + .nombre_colonnes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1456,7 +1472,7 @@ determinant(struct_processus *s_etat_pro for(i = 0; i < (*s_matrice).nombre_colonnes; i++) { - if ((unsigned long) pivot[i] != (i + 1)) + if (pivot[i] != (i + 1)) { signe = (signe == 1) ? -1 : 1; } @@ -1470,7 +1486,7 @@ determinant(struct_processus *s_etat_pro vecteur_reel[0] *= vecteur_reel[i]; } - (*((real8 *) valeur)) = vecteur_reel[0] * signe; + (*((real8 *) valeur)) = vecteur_reel[0] * ((real8) signe); free(vecteur_reel); } @@ -1483,7 +1499,7 @@ determinant(struct_processus *s_etat_pro 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; @@ -1499,8 +1515,8 @@ determinant(struct_processus *s_etat_pro } } - 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; @@ -1520,8 +1536,8 @@ determinant(struct_processus *s_etat_pro } else { - if ((vecteur_complexe = malloc((*s_matrice).nombre_colonnes * - sizeof(complex16))) == NULL) + if ((vecteur_complexe = malloc(((size_t) (*s_matrice) + .nombre_colonnes) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1532,7 +1548,7 @@ determinant(struct_processus *s_etat_pro for(i = 0; i < (*s_matrice).nombre_colonnes; i++) { - if ((unsigned long) pivot[i] != (i + 1)) + if (pivot[i] != (i + 1)) { signe = (signe == 1) ? -1 : 1; } @@ -1575,9 +1591,9 @@ rang(struct_processus *s_etat_processus, integer4 rang; integer4 taille_matrice_f77; - unsigned long i; - unsigned long j; - unsigned long k; + integer8 i; + integer8 j; + integer8 k; void *matrice_f77; @@ -1587,7 +1603,7 @@ rang(struct_processus *s_etat_processus, ? nombre_lignes_a : nombre_colonnes_a; taille_matrice_f77 = nombre_lignes_a * nombre_colonnes_a; - if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * + if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1598,7 +1614,7 @@ rang(struct_processus *s_etat_processus, { 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; @@ -1609,7 +1625,7 @@ rang(struct_processus *s_etat_processus, { 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]; } } @@ -1630,7 +1646,7 @@ rang(struct_processus *s_etat_processus, 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; @@ -1662,7 +1678,7 @@ rang(struct_processus *s_etat_processus, 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;