version 1.4, 2010/03/04 10:17:46
|
version 1.75, 2025/04/15 10:17:49
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.12 |
RPL/2 (R) version 4.1.36 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2025 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 30
|
Line 30
|
Entrées : struct_matrice |
Entrées : struct_matrice |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Sorties : décomposition de Schur de la matrice d'entrée et drapeau d'erreur. |
Sorties : décomposition de Schur de la matrice d'entrée et drapeau d'erreur. |
La matrice en entrée est écrasée. La matrice de sortie est |
La matrice en entrée est écrasée. La matrice de sortie est |
la forme de Schur. |
la forme de Schur. |
La routine renvoie aussi une matrice de complexes correspondant |
La routine renvoie aussi une matrice de complexes correspondant |
aux vecteurs de Schur. Cette matrice est allouée par |
aux vecteurs de Schur. Cette matrice est allouée par |
Line 59 factorisation_schur(struct_processus *s_
|
Line 59 factorisation_schur(struct_processus *s_
|
unsigned char calcul_vecteurs_schur; |
unsigned char calcul_vecteurs_schur; |
unsigned char tri_vecteurs_schur; |
unsigned char tri_vecteurs_schur; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long k; |
integer8 k; |
unsigned long taille_matrice_f77; |
integer8 taille_matrice_f77; |
|
|
void *matrice_a_f77; |
void *matrice_a_f77; |
void *matrice_vs_f77; |
void *matrice_vs_f77; |
Line 82 factorisation_schur(struct_processus *s_
|
Line 82 factorisation_schur(struct_processus *s_
|
{ |
{ |
/* Conversion de la matrice en matrice réelle */ |
/* 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]; |
tampon = (*s_matrice).tableau[i]; |
|
|
if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) |
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 = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
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]; |
((integer8 *) tampon)[j]; |
} |
} |
|
|
Line 104 factorisation_schur(struct_processus *s_
|
Line 105 factorisation_schur(struct_processus *s_
|
} |
} |
|
|
(*s_matrice).type = 'R'; |
(*s_matrice).type = 'R'; |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
} |
} |
|
|
case 'R' : |
case 'R' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if ((matrice_vs_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_vs_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 131 factorisation_schur(struct_processus *s_
|
Line 135 factorisation_schur(struct_processus *s_
|
} |
} |
} |
} |
|
|
if ((wr = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) |
if ((wr = (real8 *) malloc(((size_t) nombre_lignes_a) * |
== NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if ((wi = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) |
if ((wi = (real8 *) malloc(((size_t) nombre_lignes_a) * |
== NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 159 factorisation_schur(struct_processus *s_
|
Line 163 factorisation_schur(struct_processus *s_
|
matrice_vs_f77, &nombre_colonnes_a, |
matrice_vs_f77, &nombre_colonnes_a, |
work, &lwork, NULL, &info, 1, 1); |
work, &lwork, NULL, &info, 1, 1); |
|
|
lwork = ((real8 *) work)[0]; |
lwork = (integer4) ((real8 *) work)[0]; |
free(work); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 208 factorisation_schur(struct_processus *s_
|
Line 213 factorisation_schur(struct_processus *s_
|
(**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; |
(**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; |
(**s_schur).type = 'R'; |
(**s_schur).type = 'R'; |
|
|
if (((**s_schur).tableau = malloc((**s_schur) |
if (((**s_schur).tableau = malloc(((size_t) (**s_schur) |
.nombre_lignes * sizeof(real8 *))) == NULL) |
.nombre_lignes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 218 factorisation_schur(struct_processus *s_
|
Line 223 factorisation_schur(struct_processus *s_
|
for(i = 0; i < (**s_schur).nombre_lignes; i++) |
for(i = 0; i < (**s_schur).nombre_lignes; i++) |
{ |
{ |
if ((((real8 **) (**s_schur).tableau)[i] = (real8 *) |
if ((((real8 **) (**s_schur).tableau)[i] = (real8 *) |
malloc((**s_schur).nombre_colonnes * |
malloc(((size_t) (**s_schur).nombre_colonnes) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 244 factorisation_schur(struct_processus *s_
|
Line 249 factorisation_schur(struct_processus *s_
|
|
|
case 'C' : |
case 'C' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if ((matrice_vs_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_vs_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 271 factorisation_schur(struct_processus *s_
|
Line 276 factorisation_schur(struct_processus *s_
|
} |
} |
} |
} |
|
|
if ((w = (complex16 *) malloc(nombre_lignes_a * sizeof(complex16))) |
if ((w = (complex16 *) malloc(((size_t) nombre_lignes_a) * |
== NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 286 factorisation_schur(struct_processus *s_
|
Line 291 factorisation_schur(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
if ((rwork = (real8 *) malloc(nombre_lignes_a * sizeof(real8))) |
if ((rwork = (real8 *) malloc(((size_t) nombre_lignes_a) * |
== NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 299 factorisation_schur(struct_processus *s_
|
Line 304 factorisation_schur(struct_processus *s_
|
matrice_vs_f77, &nombre_colonnes_a, |
matrice_vs_f77, &nombre_colonnes_a, |
work, &lwork, rwork, NULL, &info, 1, 1); |
work, &lwork, rwork, NULL, &info, 1, 1); |
|
|
lwork = ((complex16 *) work)[0].partie_reelle; |
lwork = (integer4) ((complex16 *) work)[0].partie_reelle; |
free(work); |
free(work); |
|
|
if ((work = (complex16 *) malloc(lwork * sizeof(complex16))) |
if ((work = (complex16 *) malloc(((size_t) lwork) * |
== NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 353 factorisation_schur(struct_processus *s_
|
Line 358 factorisation_schur(struct_processus *s_
|
(**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; |
(**s_schur).nombre_lignes = (*s_matrice).nombre_lignes; |
(**s_schur).type = 'C'; |
(**s_schur).type = 'C'; |
|
|
if (((**s_schur).tableau = malloc((**s_schur) |
if (((**s_schur).tableau = malloc(((size_t) (**s_schur) |
.nombre_lignes * sizeof(complex16 *))) == NULL) |
.nombre_lignes) * sizeof(complex16 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 363 factorisation_schur(struct_processus *s_
|
Line 368 factorisation_schur(struct_processus *s_
|
for(i = 0; i < (**s_schur).nombre_lignes; i++) |
for(i = 0; i < (**s_schur).nombre_lignes; i++) |
{ |
{ |
if ((((complex16 **) (**s_schur).tableau)[i] = (complex16 *) |
if ((((complex16 **) (**s_schur).tableau)[i] = (complex16 *) |
malloc((**s_schur).nombre_colonnes * |
malloc(((size_t) (**s_schur).nombre_colonnes) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 416 factorisation_lq(struct_processus *s_eta
|
Line 421 factorisation_lq(struct_processus *s_eta
|
integer4 nombre_lignes_a; |
integer4 nombre_lignes_a; |
integer4 erreur; |
integer4 erreur; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long k; |
integer8 k; |
unsigned long taille_matrice_f77; |
integer8 taille_matrice_f77; |
|
|
void *matrice_a_f77; |
void *matrice_a_f77; |
void *tampon; |
void *tampon; |
Line 435 factorisation_lq(struct_processus *s_eta
|
Line 440 factorisation_lq(struct_processus *s_eta
|
{ |
{ |
/* Conversion de la matrice en matrice réelle */ |
/* 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]; |
tampon = (*s_matrice).tableau[i]; |
|
|
if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) |
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 = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
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]; |
((integer8 *) tampon)[j]; |
} |
} |
|
|
Line 457 factorisation_lq(struct_processus *s_eta
|
Line 463 factorisation_lq(struct_processus *s_eta
|
} |
} |
|
|
(*s_matrice).type = 'R'; |
(*s_matrice).type = 'R'; |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
} |
} |
|
|
case 'R' : |
case 'R' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) |
if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < |
? nombre_colonnes_a : nombre_lignes_a) * sizeof(real8))) |
nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * |
== NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 505 factorisation_lq(struct_processus *s_eta
|
Line 515 factorisation_lq(struct_processus *s_eta
|
return; |
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 *) |
((real8 **) (*s_matrice).tableau)[j][i] = ((real8 *) |
matrice_a_f77)[k++]; |
matrice_a_f77)[k++]; |
Line 522 factorisation_lq(struct_processus *s_eta
|
Line 532 factorisation_lq(struct_processus *s_eta
|
|
|
case 'C' : |
case 'C' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) |
if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < |
? nombre_colonnes_a : nombre_lignes_a) * |
nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 570 factorisation_lq(struct_processus *s_eta
|
Line 581 factorisation_lq(struct_processus *s_eta
|
return; |
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 **) (*s_matrice).tableau)[j][i].partie_reelle = |
((complex16 *) matrice_a_f77)[k].partie_reelle; |
((complex16 *) matrice_a_f77)[k].partie_reelle; |
Line 618 factorisation_qr(struct_processus *s_eta
|
Line 629 factorisation_qr(struct_processus *s_eta
|
|
|
real8 *rwork; |
real8 *rwork; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long k; |
integer8 k; |
unsigned long taille_matrice_f77; |
integer8 taille_matrice_f77; |
|
|
void *matrice_a_f77; |
void *matrice_a_f77; |
void *registre; |
void *registre; |
Line 638 factorisation_qr(struct_processus *s_eta
|
Line 649 factorisation_qr(struct_processus *s_eta
|
{ |
{ |
/* Conversion de la matrice en matrice réelle */ |
/* 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]; |
tampon = (*s_matrice).tableau[i]; |
|
|
if ((((real8 **) (*s_matrice).tableau)[i] = (real8 *) |
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 = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
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]; |
((integer8 *) tampon)[j]; |
} |
} |
|
|
Line 660 factorisation_qr(struct_processus *s_eta
|
Line 672 factorisation_qr(struct_processus *s_eta
|
} |
} |
|
|
(*s_matrice).type = 'R'; |
(*s_matrice).type = 'R'; |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
} |
} |
|
|
case 'R' : |
case 'R' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) |
if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < |
? nombre_colonnes_a : nombre_lignes_a) * sizeof(real8))) |
nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * |
== NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 688 factorisation_qr(struct_processus *s_eta
|
Line 703 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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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; |
lwork = -1; |
|
|
Line 710 factorisation_qr(struct_processus *s_eta
|
Line 726 factorisation_qr(struct_processus *s_eta
|
&nombre_lignes_a, pivot, (*((real8 **) tau)), |
&nombre_lignes_a, pivot, (*((real8 **) tau)), |
work, &lwork, &erreur); |
work, &lwork, &erreur); |
|
|
lwork = ((real8 *) work)[0]; |
lwork = (integer4) ((real8 *) work)[0]; |
|
|
free(work); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 722 factorisation_qr(struct_processus *s_eta
|
Line 738 factorisation_qr(struct_processus *s_eta
|
|
|
// Calcul de la permutation |
// Calcul de la permutation |
|
|
if ((registre = (void *) malloc(taille_matrice_f77 * |
if ((registre = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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, |
dgeqp3_(&nombre_lignes_a, &nombre_colonnes_a, registre, |
&nombre_lignes_a, pivot, (*((real8 **) tau)), |
&nombre_lignes_a, pivot, (*((real8 **) tau)), |
Line 767 factorisation_qr(struct_processus *s_eta
|
Line 784 factorisation_qr(struct_processus *s_eta
|
return; |
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 = |
(*s_etat_processus).erreur_execution = |
d_ex_routines_mathematiques; |
d_ex_routines_mathematiques; |
Line 785 factorisation_qr(struct_processus *s_eta
|
Line 802 factorisation_qr(struct_processus *s_eta
|
|
|
free(pivot); |
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 *) |
((real8 **) (*s_matrice).tableau)[j][i] = ((real8 *) |
matrice_a_f77)[k++]; |
matrice_a_f77)[k++]; |
Line 802 factorisation_qr(struct_processus *s_eta
|
Line 819 factorisation_qr(struct_processus *s_eta
|
|
|
case 'C' : |
case 'C' : |
{ |
{ |
if ((matrice_a_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_a_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*tau) = malloc(((nombre_colonnes_a < nombre_lignes_a) |
if (((*tau) = malloc(((size_t) ((nombre_colonnes_a < |
? nombre_colonnes_a : nombre_lignes_a) * sizeof(complex16))) |
nombre_lignes_a) ? nombre_colonnes_a : nombre_lignes_a)) * |
== NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 830 factorisation_qr(struct_processus *s_eta
|
Line 847 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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
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; |
lwork = -1; |
|
|
Line 873 factorisation_qr(struct_processus *s_eta
|
Line 892 factorisation_qr(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
lwork = ((complex16 *) work)[0].partie_reelle; |
lwork = (integer4) ((complex16 *) work)[0].partie_reelle; |
|
|
free(work); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 885 factorisation_qr(struct_processus *s_eta
|
Line 904 factorisation_qr(struct_processus *s_eta
|
|
|
// Calcul de la permutation |
// Calcul de la permutation |
|
|
if ((registre = (void *) malloc(taille_matrice_f77 * |
if ((registre = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 893 factorisation_qr(struct_processus *s_eta
|
Line 912 factorisation_qr(struct_processus *s_eta
|
} |
} |
|
|
memcpy(registre, matrice_a_f77, |
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, |
zgeqp3_(&nombre_lignes_a, &nombre_colonnes_a, registre, |
&nombre_lignes_a, pivot, (*((complex16 **) tau)), |
&nombre_lignes_a, pivot, (*((complex16 **) tau)), |
Line 939 factorisation_qr(struct_processus *s_eta
|
Line 958 factorisation_qr(struct_processus *s_eta
|
|
|
free(rwork); |
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 = |
(*s_etat_processus).erreur_execution = |
d_ex_routines_mathematiques; |
d_ex_routines_mathematiques; |
Line 957 factorisation_qr(struct_processus *s_eta
|
Line 976 factorisation_qr(struct_processus *s_eta
|
|
|
free(pivot); |
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 **) (*s_matrice).tableau)[j][i].partie_reelle = |
((complex16 *) matrice_a_f77)[k].partie_reelle; |
((complex16 *) matrice_a_f77)[k].partie_reelle; |
Line 1014 calcul_rang(struct_processus *s_etat_pro
|
Line 1033 calcul_rang(struct_processus *s_etat_pro
|
|
|
unsigned char norme; |
unsigned char norme; |
|
|
unsigned long i; |
integer8 i; |
|
|
void *matrice_b; |
void *matrice_b; |
void *matrice_c; |
void *matrice_c; |
Line 1024 calcul_rang(struct_processus *s_etat_pro
|
Line 1043 calcul_rang(struct_processus *s_etat_pro
|
#ifdef NORME_I |
#ifdef NORME_I |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
Line 1045 calcul_rang(struct_processus *s_etat_pro
|
Line 1064 calcul_rang(struct_processus *s_etat_pro
|
free(work); |
free(work); |
#endif |
#endif |
|
|
if ((matrice_c = malloc(nombre_lignes_a * nombre_colonnes_a * |
if ((matrice_c = malloc(((size_t) (nombre_lignes_a * nombre_colonnes_a)) |
sizeof(real8))) == NULL) |
* sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
} |
} |
|
|
memcpy(matrice_c, matrice_f77, nombre_lignes_a * nombre_colonnes_a * |
memcpy(matrice_c, matrice_f77, ((size_t) (nombre_lignes_a * |
sizeof(real8)); |
nombre_colonnes_a)) * sizeof(real8)); |
|
|
dgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, |
dgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, |
&nombre_lignes_a, pivot, &erreur); |
&nombre_lignes_a, pivot, &erreur); |
Line 1067 calcul_rang(struct_processus *s_etat_pro
|
Line 1086 calcul_rang(struct_processus *s_etat_pro
|
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
Line 1098 calcul_rang(struct_processus *s_etat_pro
|
Line 1119 calcul_rang(struct_processus *s_etat_pro
|
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
} |
} |
|
|
for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) |
for(i = 0; i < nombre_colonnes_a; i++) |
{ |
{ |
((integer4 *) jpvt)[i] = 0; |
((integer4 *) jpvt)[i] = 0; |
} |
} |
Line 1121 calcul_rang(struct_processus *s_etat_pro
|
Line 1143 calcul_rang(struct_processus *s_etat_pro
|
nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) |
nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) |
? 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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
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; |
((real8 *) matrice_b)[i] = 0; |
} |
} |
Line 1137 calcul_rang(struct_processus *s_etat_pro
|
Line 1160 calcul_rang(struct_processus *s_etat_pro
|
matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, |
matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, |
work, &lwork, &erreur); |
work, &lwork, &erreur); |
|
|
lwork = ((real8 *) work)[0]; |
lwork = (integer4) ((real8 *) work)[0]; |
free(work); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
Line 1174 calcul_rang(struct_processus *s_etat_pro
|
Line 1197 calcul_rang(struct_processus *s_etat_pro
|
free(work); |
free(work); |
#endif |
#endif |
|
|
if ((matrice_c = malloc(nombre_lignes_a * nombre_colonnes_a * |
if ((matrice_c = malloc(((size_t) (nombre_lignes_a * nombre_colonnes_a)) |
sizeof(complex16))) == NULL) |
* sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
} |
} |
|
|
memcpy(matrice_c, matrice_f77, nombre_lignes_a * nombre_colonnes_a * |
memcpy(matrice_c, matrice_f77, ((size_t) (nombre_lignes_a * |
sizeof(complex16)); |
nombre_colonnes_a)) * sizeof(complex16)); |
|
|
zgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, |
zgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, |
&nombre_lignes_a, pivot, &erreur); |
&nombre_lignes_a, pivot, &erreur); |
Line 1196 calcul_rang(struct_processus *s_etat_pro
|
Line 1219 calcul_rang(struct_processus *s_etat_pro
|
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
Line 1226 calcul_rang(struct_processus *s_etat_pro
|
Line 1251 calcul_rang(struct_processus *s_etat_pro
|
return(-1); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
} |
} |
|
|
for(i = 0; i < (unsigned long) nombre_colonnes_a; i++) |
for(i = 0; i < nombre_colonnes_a; i++) |
{ |
{ |
((integer4 *) jpvt)[i] = 0; |
((integer4 *) jpvt)[i] = 0; |
} |
} |
Line 1249 calcul_rang(struct_processus *s_etat_pro
|
Line 1275 calcul_rang(struct_processus *s_etat_pro
|
nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) |
nombre_lignes_b = (nombre_lignes_a > nombre_colonnes_a) |
? 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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
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_reelle = 0; |
((complex16 *) matrice_b)[i].partie_imaginaire = 0; |
((complex16 *) matrice_b)[i].partie_imaginaire = 0; |
Line 1266 calcul_rang(struct_processus *s_etat_pro
|
Line 1293 calcul_rang(struct_processus *s_etat_pro
|
matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, |
matrice_b, &nombre_lignes_b, jpvt, &rcond, &rang, |
work, &lwork, rwork, &erreur); |
work, &lwork, rwork, &erreur); |
|
|
lwork = ((complex16 *) work)[0].partie_reelle; |
lwork = (integer4) ((complex16 *) work)[0].partie_reelle; |
free(work); |
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; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(-1); |
return(-1); |
Line 1312 determinant(struct_processus *s_etat_pro
|
Line 1339 determinant(struct_processus *s_etat_pro
|
integer4 *pivot; |
integer4 *pivot; |
integer4 rang; |
integer4 rang; |
|
|
|
integer8 i; |
|
integer8 j; |
|
integer8 k; |
integer8 signe; |
integer8 signe; |
|
integer8 taille_matrice_f77; |
|
|
real8 *vecteur_reel; |
real8 *vecteur_reel; |
|
|
unsigned long i; |
|
unsigned long j; |
|
unsigned long k; |
|
unsigned long taille_matrice_f77; |
|
|
|
void *matrice_f77; |
void *matrice_f77; |
|
|
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes; |
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes; |
Line 1333 determinant(struct_processus *s_etat_pro
|
Line 1359 determinant(struct_processus *s_etat_pro
|
{ |
{ |
case 'I' : |
case 'I' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1344 determinant(struct_processus *s_etat_pro
|
Line 1370 determinant(struct_processus *s_etat_pro
|
{ |
{ |
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
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]; |
(*s_matrice).tableau)[j][i]; |
} |
} |
} |
} |
|
|
if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * |
if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) |
sizeof(integer4))) == NULL) |
* sizeof(integer4))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1369 determinant(struct_processus *s_etat_pro
|
Line 1395 determinant(struct_processus *s_etat_pro
|
} |
} |
else |
else |
{ |
{ |
if ((vecteur_reel = malloc((*s_matrice).nombre_colonnes * |
if ((vecteur_reel = malloc(((size_t) ((*s_matrice) |
sizeof(real8))) == NULL) |
.nombre_colonnes)) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1381 determinant(struct_processus *s_etat_pro
|
Line 1407 determinant(struct_processus *s_etat_pro
|
|
|
for(i = 0; i < (*s_matrice).nombre_colonnes; i++) |
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; |
signe = (signe == 1) ? -1 : 1; |
} |
} |
Line 1395 determinant(struct_processus *s_etat_pro
|
Line 1421 determinant(struct_processus *s_etat_pro
|
vecteur_reel[0] *= vecteur_reel[i]; |
vecteur_reel[0] *= vecteur_reel[i]; |
} |
} |
|
|
(*((real8 *) valeur)) = vecteur_reel[0] * signe; |
(*((real8 *) valeur)) = vecteur_reel[0] * ((real8) signe); |
|
|
free(vecteur_reel); |
free(vecteur_reel); |
} |
} |
|
|
Line 1408 determinant(struct_processus *s_etat_pro
|
Line 1433 determinant(struct_processus *s_etat_pro
|
|
|
case 'R' : |
case 'R' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1424 determinant(struct_processus *s_etat_pro
|
Line 1449 determinant(struct_processus *s_etat_pro
|
} |
} |
} |
} |
|
|
if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * |
if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) |
sizeof(integer4))) == NULL) |
* sizeof(integer4))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1444 determinant(struct_processus *s_etat_pro
|
Line 1469 determinant(struct_processus *s_etat_pro
|
} |
} |
else |
else |
{ |
{ |
if ((vecteur_reel = malloc((*s_matrice).nombre_colonnes * |
if ((vecteur_reel = malloc(((size_t) (*s_matrice) |
sizeof(real8))) == NULL) |
.nombre_colonnes) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1456 determinant(struct_processus *s_etat_pro
|
Line 1481 determinant(struct_processus *s_etat_pro
|
|
|
for(i = 0; i < (*s_matrice).nombre_colonnes; i++) |
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; |
signe = (signe == 1) ? -1 : 1; |
} |
} |
Line 1470 determinant(struct_processus *s_etat_pro
|
Line 1495 determinant(struct_processus *s_etat_pro
|
vecteur_reel[0] *= vecteur_reel[i]; |
vecteur_reel[0] *= vecteur_reel[i]; |
} |
} |
|
|
(*((real8 *) valeur)) = vecteur_reel[0] * signe; |
(*((real8 *) valeur)) = vecteur_reel[0] * ((real8) signe); |
|
|
free(vecteur_reel); |
free(vecteur_reel); |
} |
} |
Line 1483 determinant(struct_processus *s_etat_pro
|
Line 1508 determinant(struct_processus *s_etat_pro
|
|
|
case 'C' : |
case 'C' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1499 determinant(struct_processus *s_etat_pro
|
Line 1524 determinant(struct_processus *s_etat_pro
|
} |
} |
} |
} |
|
|
if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot * |
if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) |
sizeof(integer4))) == NULL) |
* sizeof(integer4))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1520 determinant(struct_processus *s_etat_pro
|
Line 1545 determinant(struct_processus *s_etat_pro
|
} |
} |
else |
else |
{ |
{ |
if ((vecteur_complexe = malloc((*s_matrice).nombre_colonnes * |
if ((vecteur_complexe = malloc(((size_t) (*s_matrice) |
sizeof(complex16))) == NULL) |
.nombre_colonnes) * sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1532 determinant(struct_processus *s_etat_pro
|
Line 1557 determinant(struct_processus *s_etat_pro
|
|
|
for(i = 0; i < (*s_matrice).nombre_colonnes; i++) |
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; |
signe = (signe == 1) ? -1 : 1; |
} |
} |
Line 1575 rang(struct_processus *s_etat_processus,
|
Line 1600 rang(struct_processus *s_etat_processus,
|
integer4 rang; |
integer4 rang; |
integer4 taille_matrice_f77; |
integer4 taille_matrice_f77; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long k; |
integer8 k; |
|
|
void *matrice_f77; |
void *matrice_f77; |
|
|
Line 1587 rang(struct_processus *s_etat_processus,
|
Line 1612 rang(struct_processus *s_etat_processus,
|
? nombre_lignes_a : nombre_colonnes_a; |
? nombre_lignes_a : nombre_colonnes_a; |
taille_matrice_f77 = 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) |
sizeof(integer4))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1598 rang(struct_processus *s_etat_processus,
|
Line 1623 rang(struct_processus *s_etat_processus,
|
{ |
{ |
case 'I' : |
case 'I' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1609 rang(struct_processus *s_etat_processus,
|
Line 1634 rang(struct_processus *s_etat_processus,
|
{ |
{ |
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
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]; |
(*s_matrice).tableau)[j][i]; |
} |
} |
} |
} |
Line 1630 rang(struct_processus *s_etat_processus,
|
Line 1655 rang(struct_processus *s_etat_processus,
|
|
|
case 'R' : |
case 'R' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1662 rang(struct_processus *s_etat_processus,
|
Line 1687 rang(struct_processus *s_etat_processus,
|
|
|
case 'C' : |
case 'C' : |
{ |
{ |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * |
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |