version 1.19, 2011/04/21 16:00:53
|
version 1.48, 2014/04/25 07:37:27
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.0.prerelease.0 |
RPL/2 (R) version 4.1.18 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2014 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" |
|
|
|
|
/*
|
/* |
================================================================================
|
================================================================================ |
Fonction calculant le nombre de condition d'une matrice
|
Fonction calculant le nombre de condition d'une matrice |
================================================================================
|
================================================================================ |
Entrées : struct_matrice
|
Entrées : struct_matrice |
--------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------- |
Sorties : nombre de condition de la matrice
|
Sorties : nombre de condition de la matrice |
--------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------- |
Effets de bord : néant
|
Effets de bord : néant |
================================================================================
|
================================================================================ |
*/
|
*/ |
|
|
static integer4
|
static integer4 |
calcul_cond(struct_processus *s_etat_processus, void *matrice_f77,
|
calcul_cond(struct_processus *s_etat_processus, void *matrice_f77, |
integer4 nombre_lignes_a, integer4 nombre_colonnes_a,
|
integer4 nombre_lignes_a, integer4 nombre_colonnes_a, |
integer4 *pivot, unsigned char type, real8 *cond)
|
integer4 *pivot, unsigned char type, real8 *cond) |
{
|
{ |
integer4 erreur;
|
integer4 erreur; |
integer4 *iwork;
|
integer4 *iwork; |
integer4 longueur;
|
integer4 longueur; |
integer4 ordre;
|
integer4 ordre; |
|
|
real8 anorme;
|
real8 anorme; |
real8 rcond;
|
real8 rcond; |
real8 *rwork;
|
real8 *rwork; |
|
|
unsigned char norme;
|
unsigned char norme; |
|
|
void *work;
|
void *work; |
|
|
norme = '1';
|
norme = '1'; |
longueur = 1;
|
longueur = 1; |
|
|
if (type == 'R')
|
if (type == 'R') |
{
|
{ |
// work est NULL dans le cas de la norme '1'
|
// work est NULL dans le cas de la norme '1' |
anorme = dlange_(&norme, &nombre_lignes_a, &nombre_colonnes_a,
|
anorme = dlange_(&norme, &nombre_lignes_a, &nombre_colonnes_a, |
matrice_f77, &nombre_lignes_a, NULL, longueur);
|
matrice_f77, &nombre_lignes_a, NULL, longueur); |
|
|
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); |
|
|
if (erreur < 0)
|
if (erreur < 0) |
{
|
{ |
(*s_etat_processus).erreur_execution =
|
(*s_etat_processus).erreur_execution = |
d_ex_routines_mathematiques;
|
d_ex_routines_mathematiques; |
|
|
free(matrice_f77);
|
free(matrice_f77); |
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;
|
{ |
return(-1);
|
(*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) * |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
sizeof(real8))) == NULL) |
return(-1);
|
{ |
}
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(-1); |
ordre = (nombre_lignes_a > nombre_colonnes_a)
|
} |
? nombre_colonnes_a : nombre_lignes_a;
|
|
|
ordre = (nombre_lignes_a > nombre_colonnes_a) |
dgecon_(&norme, &ordre, matrice_f77,
|
? nombre_colonnes_a : nombre_lignes_a; |
&nombre_lignes_a, &anorme, &rcond, work, iwork, &erreur,
|
|
longueur);
|
dgecon_(&norme, &ordre, matrice_f77, |
|
&nombre_lignes_a, &anorme, &rcond, work, iwork, &erreur, |
free(work);
|
longueur); |
free(iwork);
|
|
|
free(work); |
if (erreur < 0)
|
free(iwork); |
{
|
|
(*s_etat_processus).erreur_execution =
|
if (erreur < 0) |
d_ex_routines_mathematiques;
|
{ |
|
(*s_etat_processus).erreur_execution = |
free(matrice_f77);
|
d_ex_routines_mathematiques; |
return(-1);
|
|
}
|
free(matrice_f77); |
}
|
return(-1); |
else
|
} |
{
|
} |
// work est NULL dans le cas de la norme '1'
|
else |
anorme = zlange_(&norme, &nombre_lignes_a, &nombre_colonnes_a,
|
{ |
matrice_f77, &nombre_lignes_a, NULL, longueur);
|
// work est NULL dans le cas de la norme '1' |
|
anorme = zlange_(&norme, &nombre_lignes_a, &nombre_colonnes_a, |
zgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77,
|
matrice_f77, &nombre_lignes_a, NULL, longueur); |
&nombre_lignes_a, pivot, &erreur);
|
|
|
zgetrf_(&nombre_lignes_a, &nombre_colonnes_a, matrice_f77, |
if (erreur < 0)
|
&nombre_lignes_a, pivot, &erreur); |
{
|
|
(*s_etat_processus).erreur_execution =
|
if (erreur < 0) |
d_ex_routines_mathematiques;
|
{ |
|
(*s_etat_processus).erreur_execution = |
free(matrice_f77);
|
d_ex_routines_mathematiques; |
return(-1);
|
|
}
|
free(matrice_f77); |
|
return(-1); |
if ((rwork = malloc(2 * nombre_colonnes_a * sizeof(real8))) == NULL)
|
} |
{
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
if ((rwork = malloc(2 * ((size_t) nombre_colonnes_a) * sizeof(real8))) |
return(-1);
|
== NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
if ((work = malloc(2 * nombre_colonnes_a * sizeof(complex16))) == NULL)
|
return(-1); |
{
|
} |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
|
return(-1);
|
if ((work = malloc(2 * ((size_t) nombre_colonnes_a) * |
}
|
sizeof(complex16))) == NULL) |
|
{ |
ordre = (nombre_lignes_a > nombre_colonnes_a)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
? nombre_colonnes_a : nombre_lignes_a;
|
return(-1); |
|
} |
zgecon_(&norme, &ordre, matrice_f77,
|
|
&nombre_lignes_a, &anorme, &rcond, work, rwork, &erreur,
|
ordre = (nombre_lignes_a > nombre_colonnes_a) |
longueur);
|
? nombre_colonnes_a : nombre_lignes_a; |
|
|
free(work);
|
zgecon_(&norme, &ordre, matrice_f77, |
free(rwork);
|
&nombre_lignes_a, &anorme, &rcond, work, rwork, &erreur, |
|
longueur); |
if (erreur < 0)
|
|
{
|
free(work); |
(*s_etat_processus).erreur_execution =
|
free(rwork); |
d_ex_routines_mathematiques;
|
|
|
if (erreur < 0) |
free(matrice_f77);
|
{ |
return(-1);
|
(*s_etat_processus).erreur_execution = |
}
|
d_ex_routines_mathematiques; |
}
|
|
|
free(matrice_f77); |
(*cond) = ((real8) 1 / rcond);
|
return(-1); |
return(0);
|
} |
}
|
} |
|
|
|
(*cond) = ((real8) 1 / rcond); |
void
|
return(0); |
cond(struct_processus *s_etat_processus,
|
} |
struct_matrice *s_matrice, real8 *condition)
|
|
{
|
|
integer4 dimension_vecteur_pivot;
|
void |
integer4 nombre_lignes_a;
|
cond(struct_processus *s_etat_processus, |
integer4 nombre_colonnes_a;
|
struct_matrice *s_matrice, real8 *condition) |
integer4 *pivot;
|
{ |
integer4 rang;
|
integer4 dimension_vecteur_pivot; |
integer4 taille_matrice_f77;
|
integer4 nombre_lignes_a; |
|
integer4 nombre_colonnes_a; |
real8 cond;
|
integer4 *pivot; |
|
integer4 rang; |
unsigned long i;
|
integer4 taille_matrice_f77; |
unsigned long j;
|
|
unsigned long k;
|
real8 cond; |
|
|
void *matrice_f77;
|
integer8 i; |
|
integer8 j; |
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes;
|
integer8 k; |
nombre_colonnes_a = (integer4) (*s_matrice).nombre_colonnes;
|
|
dimension_vecteur_pivot = (nombre_lignes_a < nombre_colonnes_a)
|
void *matrice_f77; |
? nombre_lignes_a : nombre_colonnes_a;
|
|
taille_matrice_f77 = nombre_lignes_a * nombre_colonnes_a;
|
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes; |
|
nombre_colonnes_a = (integer4) (*s_matrice).nombre_colonnes; |
if ((pivot = (integer4 *) malloc(dimension_vecteur_pivot *
|
dimension_vecteur_pivot = (nombre_lignes_a < nombre_colonnes_a) |
sizeof(integer4))) == NULL)
|
? nombre_lignes_a : nombre_colonnes_a; |
{
|
taille_matrice_f77 = nombre_lignes_a * nombre_colonnes_a; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
|
return;
|
if ((pivot = (integer4 *) malloc(((size_t) dimension_vecteur_pivot) * |
}
|
sizeof(integer4))) == NULL) |
|
{ |
switch((*s_matrice).type)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
case 'I' :
|
} |
{
|
|
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
switch((*s_matrice).type) |
sizeof(real8))) == NULL)
|
{ |
{
|
case 'I' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(real8))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((real8 *) matrice_f77)[k++] = ((integer8 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((real8 *) matrice_f77)[k++] = (real8) ((integer8 **) |
if ((rang = calcul_cond(s_etat_processus, matrice_f77,
|
(*s_matrice).tableau)[j][i]; |
nombre_lignes_a, nombre_colonnes_a, pivot,
|
} |
'R', &cond)) < 0)
|
} |
{
|
|
free(pivot);
|
if ((rang = calcul_cond(s_etat_processus, matrice_f77, |
free(matrice_f77);
|
nombre_lignes_a, nombre_colonnes_a, pivot, |
return;
|
'R', &cond)) < 0) |
}
|
{ |
|
free(pivot); |
free(matrice_f77);
|
free(matrice_f77); |
(*condition) = cond;
|
return; |
break;
|
} |
}
|
|
|
free(matrice_f77); |
case 'R' :
|
(*condition) = cond; |
{
|
break; |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
} |
sizeof(real8))) == NULL)
|
|
{
|
case 'R' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(real8))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((real8 *) matrice_f77)[k++] = ((real8 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((real8 *) matrice_f77)[k++] = ((real8 **) |
if ((rang = calcul_cond(s_etat_processus, matrice_f77,
|
(*s_matrice).tableau)[j][i]; |
nombre_lignes_a, nombre_colonnes_a, pivot,
|
} |
'R', &cond)) < 0)
|
} |
{
|
|
free(pivot);
|
if ((rang = calcul_cond(s_etat_processus, matrice_f77, |
free(matrice_f77);
|
nombre_lignes_a, nombre_colonnes_a, pivot, |
return;
|
'R', &cond)) < 0) |
}
|
{ |
|
free(pivot); |
free(matrice_f77);
|
free(matrice_f77); |
(*condition) = cond;
|
return; |
break;
|
} |
}
|
|
|
free(matrice_f77); |
case 'C' :
|
(*condition) = cond; |
{
|
break; |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
} |
sizeof(complex16))) == NULL)
|
|
{
|
case 'C' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(complex16))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((complex16 *) matrice_f77)[k++] = ((complex16 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((complex16 *) matrice_f77)[k++] = ((complex16 **) |
if ((rang = calcul_cond(s_etat_processus, matrice_f77,
|
(*s_matrice).tableau)[j][i]; |
nombre_lignes_a, nombre_colonnes_a, pivot,
|
} |
'C', &cond)) < 0)
|
} |
{
|
|
free(pivot);
|
if ((rang = calcul_cond(s_etat_processus, matrice_f77, |
free(matrice_f77);
|
nombre_lignes_a, nombre_colonnes_a, pivot, |
return;
|
'C', &cond)) < 0) |
}
|
{ |
|
free(pivot); |
free(matrice_f77);
|
free(matrice_f77); |
(*condition) = cond;
|
return; |
break;
|
} |
}
|
|
}
|
free(matrice_f77); |
|
(*condition) = cond; |
free(pivot);
|
break; |
|
} |
return;
|
} |
}
|
|
|
free(pivot); |
|
|
/*
|
return; |
================================================================================
|
} |
Fonction effectuant une décomposition en valeurs singulières
|
|
================================================================================
|
|
Entrées : struct_matrice
|
/* |
--------------------------------------------------------------------------------
|
================================================================================ |
Sorties : valeurs singulières dans le vecteur S. Si les pointeurs sur U
|
Fonction effectuant une décomposition en valeurs singulières |
et VH ne sont pas nul, les matrices U et VH sont aussi calculées.
|
================================================================================ |
--------------------------------------------------------------------------------
|
Entrées : struct_matrice |
Effets de bord : néant
|
-------------------------------------------------------------------------------- |
================================================================================
|
Sorties : valeurs singulières dans le vecteur S. Si les pointeurs sur U |
*/
|
et VH ne sont pas nul, les matrices U et VH sont aussi calculées. |
|
-------------------------------------------------------------------------------- |
void valeurs_singulieres(struct_processus *s_etat_processus,
|
Effets de bord : néant |
struct_matrice *s_matrice, struct_matrice *matrice_u,
|
================================================================================ |
struct_vecteur *vecteur_s, struct_matrice *matrice_vh)
|
*/ |
{
|
|
integer4 erreur;
|
void valeurs_singulieres(struct_processus *s_etat_processus, |
integer4 longueur;
|
struct_matrice *s_matrice, struct_matrice *matrice_u, |
integer4 lwork;
|
struct_vecteur *vecteur_s, struct_matrice *matrice_vh) |
integer4 nombre_colonnes_a;
|
{ |
integer4 nombre_lignes_a;
|
integer4 erreur; |
integer4 nombre_valeurs_singulieres;
|
integer4 longueur; |
integer4 taille_matrice_f77;
|
integer4 lwork; |
|
integer4 nombre_colonnes_a; |
real8 *rwork;
|
integer4 nombre_lignes_a; |
|
integer4 nombre_valeurs_singulieres; |
unsigned char jobu;
|
integer4 taille_matrice_f77; |
unsigned char jobvh;
|
|
|
integer8 i; |
unsigned long i;
|
integer8 j; |
unsigned long j;
|
integer8 k; |
unsigned long k;
|
|
|
real8 *rwork; |
void *matrice_f77;
|
|
void *matrice_f77_u;
|
unsigned char jobu; |
void *matrice_f77_vh;
|
unsigned char jobvh; |
void *vecteur_f77_s;
|
|
void *work;
|
void *matrice_f77; |
|
void *matrice_f77_u; |
longueur = 1;
|
void *matrice_f77_vh; |
|
void *vecteur_f77_s; |
if (matrice_u != NULL)
|
void *work; |
{
|
|
jobu = 'A';
|
longueur = 1; |
}
|
|
else
|
if (matrice_u != NULL) |
{
|
{ |
jobu = 'N';
|
jobu = 'A'; |
}
|
} |
|
else |
if (matrice_vh != NULL)
|
{ |
{
|
jobu = 'N'; |
jobvh = 'A';
|
} |
}
|
|
else
|
if (matrice_vh != NULL) |
{
|
{ |
jobvh = 'N';
|
jobvh = 'A'; |
}
|
} |
|
else |
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes;
|
{ |
nombre_colonnes_a = (integer4) (*s_matrice).nombre_colonnes;
|
jobvh = 'N'; |
taille_matrice_f77 = nombre_lignes_a * nombre_colonnes_a;
|
} |
nombre_valeurs_singulieres = (nombre_lignes_a < nombre_colonnes_a)
|
|
? nombre_lignes_a : nombre_colonnes_a;
|
nombre_lignes_a = (integer4) (*s_matrice).nombre_lignes; |
|
nombre_colonnes_a = (integer4) (*s_matrice).nombre_colonnes; |
switch((*s_matrice).type)
|
taille_matrice_f77 = nombre_lignes_a * nombre_colonnes_a; |
{
|
nombre_valeurs_singulieres = (nombre_lignes_a < nombre_colonnes_a) |
case 'I' :
|
? nombre_lignes_a : nombre_colonnes_a; |
{
|
|
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
switch((*s_matrice).type) |
sizeof(real8))) == NULL)
|
{ |
{
|
case 'I' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(real8))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((real8 *) matrice_f77)[k++] = ((integer8 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((real8 *) matrice_f77)[k++] = (real8) ((integer8 **) |
lwork = -1;
|
(*s_matrice).tableau)[j][i]; |
|
} |
if ((work = malloc(sizeof(real8))) == NULL)
|
} |
{
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
lwork = -1; |
return;
|
|
}
|
if ((work = malloc(sizeof(real8))) == NULL) |
|
{ |
if (matrice_u != NULL)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_u = malloc(nombre_lignes_a * nombre_lignes_a *
|
} |
sizeof(real8))) == NULL)
|
|
{
|
if (matrice_u != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_u = malloc(((size_t) (nombre_lignes_a * |
return;
|
nombre_lignes_a)) * sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_u = NULL;
|
} |
}
|
} |
|
else |
if ((vecteur_f77_s = malloc(nombre_valeurs_singulieres *
|
{ |
sizeof(real8))) == NULL)
|
matrice_f77_u = NULL; |
{
|
} |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if ((vecteur_f77_s = malloc(((size_t) nombre_valeurs_singulieres) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
if (matrice_vh != NULL)
|
d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_vh = malloc(nombre_colonnes_a
|
} |
* nombre_colonnes_a * sizeof(real8))) == NULL)
|
|
{
|
if (matrice_vh != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_vh = malloc(((size_t) (nombre_colonnes_a |
return;
|
* nombre_colonnes_a)) * sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_vh = NULL;
|
} |
}
|
} |
|
else |
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
{ |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
matrice_f77_vh = NULL; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, &erreur, longueur, longueur);
|
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
lwork = ((real8 *) work)[0];
|
matrice_f77_u, &nombre_lignes_a, |
free(work);
|
matrice_f77_vh, &nombre_colonnes_a, |
|
work, &lwork, &erreur, longueur, longueur); |
if ((work = malloc(lwork * sizeof(real8))) == NULL)
|
|
{
|
lwork = (integer4) ((real8 *) work)[0]; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
free(work); |
return;
|
|
}
|
if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) |
|
{ |
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
return; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, &erreur, longueur, longueur);
|
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
free(work);
|
matrice_f77_u, &nombre_lignes_a, |
free(matrice_f77);
|
matrice_f77_vh, &nombre_colonnes_a, |
|
work, &lwork, &erreur, longueur, longueur); |
if (erreur != 0)
|
|
{
|
free(work); |
if (erreur > 0)
|
free(matrice_f77); |
{
|
|
(*s_etat_processus).exception = d_ep_decomposition_SVD;
|
if (erreur != 0) |
}
|
{ |
else
|
if (erreur > 0) |
{
|
{ |
(*s_etat_processus).erreur_execution =
|
(*s_etat_processus).exception = d_ep_decomposition_SVD; |
d_ex_routines_mathematiques;
|
} |
}
|
else |
|
{ |
free(matrice_f77_u);
|
(*s_etat_processus).erreur_execution = |
free(matrice_f77_vh);
|
d_ex_routines_mathematiques; |
free(vecteur_f77_s);
|
} |
return;
|
|
}
|
free(matrice_f77_u); |
|
free(matrice_f77_vh); |
if (matrice_u != NULL)
|
free(vecteur_f77_s); |
{
|
return; |
(*matrice_u).nombre_lignes = nombre_lignes_a;
|
} |
(*matrice_u).nombre_colonnes = nombre_lignes_a;
|
|
|
if (matrice_u != NULL) |
if (((*matrice_u).tableau = malloc((*matrice_u).nombre_lignes *
|
{ |
sizeof(real8 *))) == NULL)
|
(*matrice_u).nombre_lignes = nombre_lignes_a; |
{
|
(*matrice_u).nombre_colonnes = nombre_lignes_a; |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if (((*matrice_u).tableau = malloc(((size_t) |
return;
|
(*matrice_u).nombre_lignes) * sizeof(real8 *))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(i = 0; i < (*matrice_u).nombre_lignes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
if ((((real8 **) (*matrice_u).tableau)[i] =
|
} |
malloc((*matrice_u).nombre_colonnes *
|
|
sizeof(real8))) == NULL)
|
for(i = 0; i < (*matrice_u).nombre_lignes; i++) |
{
|
{ |
(*s_etat_processus).erreur_systeme =
|
if ((((real8 **) (*matrice_u).tableau)[i] = |
d_es_allocation_memoire;
|
malloc(((size_t) (*matrice_u).nombre_colonnes) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++)
|
return; |
{
|
} |
for(j = 0; j < (*matrice_u).nombre_lignes; j++)
|
} |
{
|
|
((real8 **) (*matrice_u).tableau)[j][i] =
|
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++) |
((real8 *) matrice_f77_u)[k++];
|
{ |
}
|
for(j = 0; j < (*matrice_u).nombre_lignes; j++) |
}
|
{ |
|
((real8 **) (*matrice_u).tableau)[j][i] = |
free(matrice_f77_u);
|
((real8 *) matrice_f77_u)[k++]; |
}
|
} |
|
} |
if (matrice_vh != NULL)
|
|
{
|
free(matrice_f77_u); |
(*matrice_vh).nombre_lignes = nombre_colonnes_a;
|
} |
(*matrice_vh).nombre_colonnes = nombre_colonnes_a;
|
|
|
if (matrice_vh != NULL) |
if (((*matrice_vh).tableau = malloc((*matrice_vh)
|
{ |
.nombre_lignes * sizeof(real8 *))) == NULL)
|
(*matrice_vh).nombre_lignes = nombre_colonnes_a; |
{
|
(*matrice_vh).nombre_colonnes = nombre_colonnes_a; |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if (((*matrice_vh).tableau = malloc(((size_t) (*matrice_vh) |
return;
|
.nombre_lignes) * sizeof(real8 *))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(i = 0; i < (*matrice_vh).nombre_lignes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
if ((((real8 **) (*matrice_vh).tableau)[i] =
|
} |
malloc((*matrice_vh).nombre_colonnes *
|
|
sizeof(real8))) == NULL)
|
for(i = 0; i < (*matrice_vh).nombre_lignes; i++) |
{
|
{ |
(*s_etat_processus).erreur_systeme =
|
if ((((real8 **) (*matrice_vh).tableau)[i] = |
d_es_allocation_memoire;
|
malloc(((size_t) (*matrice_vh).nombre_colonnes) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++)
|
return; |
{
|
} |
for(j = 0; j < (*matrice_vh).nombre_lignes; j++)
|
} |
{
|
|
((real8 **) (*matrice_vh).tableau)[j][i] =
|
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++) |
((real8 *) matrice_f77_vh)[k++];
|
{ |
}
|
for(j = 0; j < (*matrice_vh).nombre_lignes; j++) |
}
|
{ |
|
((real8 **) (*matrice_vh).tableau)[j][i] = |
free(matrice_f77_vh);
|
((real8 *) matrice_f77_vh)[k++]; |
}
|
} |
|
} |
(*vecteur_s).taille = nombre_valeurs_singulieres;
|
|
(*vecteur_s).type = 'R';
|
free(matrice_f77_vh); |
(*vecteur_s).tableau = vecteur_f77_s;
|
} |
|
|
break;
|
(*vecteur_s).taille = nombre_valeurs_singulieres; |
}
|
(*vecteur_s).type = 'R'; |
|
(*vecteur_s).tableau = vecteur_f77_s; |
case 'R' :
|
|
{
|
break; |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
} |
sizeof(real8))) == NULL)
|
|
{
|
case 'R' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(real8))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((real8 *) matrice_f77)[k++] = ((real8 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((real8 *) matrice_f77)[k++] = ((real8 **) |
lwork = -1;
|
(*s_matrice).tableau)[j][i]; |
|
} |
if ((work = malloc(sizeof(real8))) == NULL)
|
} |
{
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
lwork = -1; |
return;
|
|
}
|
if ((work = malloc(sizeof(real8))) == NULL) |
|
{ |
if (matrice_u != NULL)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_u = malloc(nombre_lignes_a * nombre_lignes_a *
|
} |
sizeof(real8))) == NULL)
|
|
{
|
if (matrice_u != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_u = malloc(((size_t) (nombre_lignes_a * |
return;
|
nombre_lignes_a)) * sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_u = NULL;
|
} |
}
|
} |
|
else |
if ((vecteur_f77_s = malloc(nombre_valeurs_singulieres *
|
{ |
sizeof(real8))) == NULL)
|
matrice_f77_u = NULL; |
{
|
} |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if ((vecteur_f77_s = malloc(((size_t) nombre_valeurs_singulieres) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
if (matrice_vh != NULL)
|
d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_vh = malloc(nombre_colonnes_a
|
} |
* nombre_colonnes_a * sizeof(real8))) == NULL)
|
|
{
|
if (matrice_vh != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_vh = malloc(((size_t) (nombre_colonnes_a |
return;
|
* nombre_colonnes_a)) * sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_vh = NULL;
|
} |
}
|
} |
|
else |
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
{ |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
matrice_f77_vh = NULL; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, &erreur, longueur, longueur);
|
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
lwork = ((real8 *) work)[0];
|
matrice_f77_u, &nombre_lignes_a, |
free(work);
|
matrice_f77_vh, &nombre_colonnes_a, |
|
work, &lwork, &erreur, longueur, longueur); |
if ((work = malloc(lwork * sizeof(real8))) == NULL)
|
|
{
|
lwork = (integer4) ((real8 *) work)[0]; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
free(work); |
return;
|
|
}
|
if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) |
|
{ |
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
return; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, &erreur, longueur, longueur);
|
dgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
free(work);
|
matrice_f77_u, &nombre_lignes_a, |
free(matrice_f77);
|
matrice_f77_vh, &nombre_colonnes_a, |
|
work, &lwork, &erreur, longueur, longueur); |
if (erreur != 0)
|
|
{
|
free(work); |
if (erreur > 0)
|
free(matrice_f77); |
{
|
|
(*s_etat_processus).exception = d_ep_decomposition_SVD;
|
if (erreur != 0) |
}
|
{ |
else
|
if (erreur > 0) |
{
|
{ |
(*s_etat_processus).erreur_execution =
|
(*s_etat_processus).exception = d_ep_decomposition_SVD; |
d_ex_routines_mathematiques;
|
} |
}
|
else |
|
{ |
free(matrice_f77_u);
|
(*s_etat_processus).erreur_execution = |
free(matrice_f77_vh);
|
d_ex_routines_mathematiques; |
free(vecteur_f77_s);
|
} |
return;
|
|
}
|
free(matrice_f77_u); |
|
free(matrice_f77_vh); |
if (matrice_u != NULL)
|
free(vecteur_f77_s); |
{
|
return; |
(*matrice_u).nombre_lignes = nombre_lignes_a;
|
} |
(*matrice_u).nombre_colonnes = nombre_lignes_a;
|
|
|
if (matrice_u != NULL) |
if (((*matrice_u).tableau = malloc((*matrice_u).nombre_lignes *
|
{ |
sizeof(real8 *))) == NULL)
|
(*matrice_u).nombre_lignes = nombre_lignes_a; |
{
|
(*matrice_u).nombre_colonnes = nombre_lignes_a; |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if (((*matrice_u).tableau = malloc(((size_t) |
return;
|
(*matrice_u).nombre_lignes) * sizeof(real8 *))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(i = 0; i < (*matrice_u).nombre_lignes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
if ((((real8 **) (*matrice_u).tableau)[i] =
|
} |
malloc((*matrice_u).nombre_colonnes *
|
|
sizeof(real8))) == NULL)
|
for(i = 0; i < (*matrice_u).nombre_lignes; i++) |
{
|
{ |
(*s_etat_processus).erreur_systeme =
|
if ((((real8 **) (*matrice_u).tableau)[i] = |
d_es_allocation_memoire;
|
malloc(((size_t) (*matrice_u).nombre_colonnes) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++)
|
return; |
{
|
} |
for(j = 0; j < (*matrice_u).nombre_lignes; j++)
|
} |
{
|
|
((real8 **) (*matrice_u).tableau)[j][i] =
|
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++) |
((real8 *) matrice_f77_u)[k++];
|
{ |
}
|
for(j = 0; j < (*matrice_u).nombre_lignes; j++) |
}
|
{ |
|
((real8 **) (*matrice_u).tableau)[j][i] = |
free(matrice_f77_u);
|
((real8 *) matrice_f77_u)[k++]; |
}
|
} |
|
} |
if (matrice_vh != NULL)
|
|
{
|
free(matrice_f77_u); |
(*matrice_vh).nombre_lignes = nombre_colonnes_a;
|
} |
(*matrice_vh).nombre_colonnes = nombre_colonnes_a;
|
|
|
if (matrice_vh != NULL) |
if (((*matrice_vh).tableau = malloc((*matrice_vh)
|
{ |
.nombre_lignes * sizeof(real8 *))) == NULL)
|
(*matrice_vh).nombre_lignes = nombre_colonnes_a; |
{
|
(*matrice_vh).nombre_colonnes = nombre_colonnes_a; |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if (((*matrice_vh).tableau = malloc(((size_t) (*matrice_vh) |
return;
|
.nombre_lignes) * sizeof(real8 *))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(i = 0; i < (*matrice_vh).nombre_lignes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
if ((((real8 **) (*matrice_vh).tableau)[i] =
|
} |
malloc((*matrice_vh).nombre_colonnes *
|
|
sizeof(real8))) == NULL)
|
for(i = 0; i < (*matrice_vh).nombre_lignes; i++) |
{
|
{ |
(*s_etat_processus).erreur_systeme =
|
if ((((real8 **) (*matrice_vh).tableau)[i] = |
d_es_allocation_memoire;
|
malloc(((size_t) (*matrice_vh).nombre_colonnes) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++)
|
return; |
{
|
} |
for(j = 0; j < (*matrice_vh).nombre_lignes; j++)
|
} |
{
|
|
((real8 **) (*matrice_vh).tableau)[j][i] =
|
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++) |
((real8 *) matrice_f77_vh)[k++];
|
{ |
}
|
for(j = 0; j < (*matrice_vh).nombre_lignes; j++) |
}
|
{ |
|
((real8 **) (*matrice_vh).tableau)[j][i] = |
free(matrice_f77_vh);
|
((real8 *) matrice_f77_vh)[k++]; |
}
|
} |
|
} |
(*vecteur_s).taille = nombre_valeurs_singulieres;
|
|
(*vecteur_s).type = 'R';
|
free(matrice_f77_vh); |
(*vecteur_s).tableau = vecteur_f77_s;
|
} |
|
|
break;
|
(*vecteur_s).taille = nombre_valeurs_singulieres; |
}
|
(*vecteur_s).type = 'R'; |
|
(*vecteur_s).tableau = vecteur_f77_s; |
case 'C' :
|
|
{
|
break; |
if ((matrice_f77 = (void *) malloc(taille_matrice_f77 *
|
} |
sizeof(complex16))) == NULL)
|
|
{
|
case 'C' : |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
{ |
return;
|
if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * |
}
|
sizeof(complex16))) == NULL) |
|
{ |
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*s_matrice).nombre_lignes; j++)
|
} |
{
|
|
((complex16 *) matrice_f77)[k++] = ((complex16 **)
|
for(k = 0, i = 0; i < (*s_matrice).nombre_colonnes; i++) |
(*s_matrice).tableau)[j][i];
|
{ |
}
|
for(j = 0; j < (*s_matrice).nombre_lignes; j++) |
}
|
{ |
|
((complex16 *) matrice_f77)[k++] = ((complex16 **) |
lwork = -1;
|
(*s_matrice).tableau)[j][i]; |
|
} |
if ((work = malloc(sizeof(complex16))) == NULL)
|
} |
{
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
lwork = -1; |
return;
|
|
}
|
if ((work = malloc(sizeof(complex16))) == NULL) |
|
{ |
if (matrice_u != NULL)
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_u = malloc(nombre_lignes_a * nombre_lignes_a *
|
} |
sizeof(complex16))) == NULL)
|
|
{
|
if (matrice_u != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_u = malloc(((size_t) (nombre_lignes_a * |
return;
|
nombre_lignes_a)) * sizeof(complex16))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_u = NULL;
|
} |
}
|
} |
|
else |
if ((vecteur_f77_s = malloc(nombre_valeurs_singulieres *
|
{ |
sizeof(real8))) == NULL)
|
matrice_f77_u = NULL; |
{
|
} |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if ((vecteur_f77_s = malloc(((size_t) nombre_valeurs_singulieres) * |
return;
|
sizeof(real8))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
if (matrice_vh != NULL)
|
d_es_allocation_memoire; |
{
|
return; |
if ((matrice_f77_vh = malloc(nombre_colonnes_a
|
} |
* nombre_colonnes_a * sizeof(complex16))) == NULL)
|
|
{
|
if (matrice_vh != NULL) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((matrice_f77_vh = malloc(((size_t) (nombre_colonnes_a |
return;
|
* nombre_colonnes_a)) * sizeof(complex16))) == NULL) |
}
|
{ |
}
|
(*s_etat_processus).erreur_systeme = |
else
|
d_es_allocation_memoire; |
{
|
return; |
matrice_f77_vh = NULL;
|
} |
}
|
} |
|
else |
if ((rwork = malloc(5 * nombre_valeurs_singulieres * sizeof(real8)))
|
{ |
== NULL)
|
matrice_f77_vh = NULL; |
{
|
} |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if ((rwork = malloc(5 * ((size_t) nombre_valeurs_singulieres) |
return;
|
* sizeof(real8))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
zgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
d_es_allocation_memoire; |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
return; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, rwork, &erreur, longueur, longueur);
|
zgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
lwork = ((real8 *) work)[0];
|
matrice_f77_u, &nombre_lignes_a, |
free(work);
|
matrice_f77_vh, &nombre_colonnes_a, |
|
work, &lwork, rwork, &erreur, longueur, longueur); |
if ((work = malloc(lwork * sizeof(real8))) == NULL)
|
|
{
|
lwork = (integer4) ((real8 *) work)[0]; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
|
free(work); |
return;
|
|
}
|
if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) |
|
{ |
zgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a,
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
matrice_f77, &nombre_lignes_a, vecteur_f77_s,
|
return; |
matrice_f77_u, &nombre_lignes_a,
|
} |
matrice_f77_vh, &nombre_colonnes_a,
|
|
work, &lwork, rwork, &erreur, longueur, longueur);
|
zgesvd_(&jobu, &jobvh, &nombre_lignes_a, &nombre_colonnes_a, |
|
matrice_f77, &nombre_lignes_a, vecteur_f77_s, |
free(work);
|
matrice_f77_u, &nombre_lignes_a, |
free(rwork);
|
matrice_f77_vh, &nombre_colonnes_a, |
free(matrice_f77);
|
work, &lwork, rwork, &erreur, longueur, longueur); |
|
|
if (erreur != 0)
|
free(work); |
{
|
free(rwork); |
if (erreur > 0)
|
free(matrice_f77); |
{
|
|
(*s_etat_processus).exception = d_ep_decomposition_SVD;
|
if (erreur != 0) |
}
|
{ |
else
|
if (erreur > 0) |
{
|
{ |
(*s_etat_processus).erreur_execution =
|
(*s_etat_processus).exception = d_ep_decomposition_SVD; |
d_ex_routines_mathematiques;
|
} |
}
|
else |
|
{ |
free(matrice_f77_u);
|
(*s_etat_processus).erreur_execution = |
free(matrice_f77_vh);
|
d_ex_routines_mathematiques; |
free(vecteur_f77_s);
|
} |
return;
|
|
}
|
free(matrice_f77_u); |
|
free(matrice_f77_vh); |
if (matrice_u != NULL)
|
free(vecteur_f77_s); |
{
|
return; |
(*matrice_u).nombre_lignes = nombre_lignes_a;
|
} |
(*matrice_u).nombre_colonnes = nombre_lignes_a;
|
|
|
if (matrice_u != NULL) |
if (((*matrice_u).tableau = malloc((*matrice_u).nombre_lignes *
|
{ |
sizeof(complex16 *))) == NULL)
|
(*matrice_u).nombre_lignes = nombre_lignes_a; |
{
|
(*matrice_u).nombre_colonnes = nombre_lignes_a; |
(*s_etat_processus).erreur_systeme =
|
|
d_es_allocation_memoire;
|
if (((*matrice_u).tableau = malloc(((size_t) |
return;
|
(*matrice_u).nombre_lignes) * sizeof(complex16 *))) |
}
|
== NULL) |
|
{ |
for(i = 0; i < (*matrice_u).nombre_lignes; i++)
|
(*s_etat_processus).erreur_systeme = |
{
|
d_es_allocation_memoire; |
if ((((complex16 **) (*matrice_u).tableau)[i] =
|
return; |
malloc((*matrice_u).nombre_colonnes *
|
} |
sizeof(complex16))) == NULL)
|
|
{
|
for(i = 0; i < (*matrice_u).nombre_lignes; i++) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((((complex16 **) (*matrice_u).tableau)[i] = |
return;
|
malloc(((size_t) (*matrice_u).nombre_colonnes) * |
}
|
sizeof(complex16))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*matrice_u).nombre_lignes; j++)
|
} |
{
|
} |
((complex16 **) (*matrice_u).tableau)[j][i] =
|
|
((complex16 *) matrice_f77_u)[k++];
|
for(k = 0, i = 0; i < (*matrice_u).nombre_colonnes; i++) |
}
|
{ |
}
|
for(j = 0; j < (*matrice_u).nombre_lignes; j++) |
|
{ |
free(matrice_f77_u);
|
((complex16 **) (*matrice_u).tableau)[j][i] = |
}
|
((complex16 *) matrice_f77_u)[k++]; |
|
} |
if (matrice_vh != NULL)
|
} |
{
|
|
(*matrice_vh).nombre_lignes = nombre_colonnes_a;
|
free(matrice_f77_u); |
(*matrice_vh).nombre_colonnes = nombre_colonnes_a;
|
} |
|
|
if (((*matrice_vh).tableau = malloc((*matrice_vh)
|
if (matrice_vh != NULL) |
.nombre_lignes * sizeof(complex16 *))) == NULL)
|
{ |
{
|
(*matrice_vh).nombre_lignes = nombre_colonnes_a; |
(*s_etat_processus).erreur_systeme =
|
(*matrice_vh).nombre_colonnes = nombre_colonnes_a; |
d_es_allocation_memoire;
|
|
return;
|
if (((*matrice_vh).tableau = malloc(((size_t) (*matrice_vh) |
}
|
.nombre_lignes) * sizeof(complex16 *))) == NULL) |
|
{ |
for(i = 0; i < (*matrice_vh).nombre_lignes; i++)
|
(*s_etat_processus).erreur_systeme = |
{
|
d_es_allocation_memoire; |
if ((((complex16 **) (*matrice_vh).tableau)[i] =
|
return; |
malloc((*matrice_vh).nombre_colonnes *
|
} |
sizeof(complex16))) == NULL)
|
|
{
|
for(i = 0; i < (*matrice_vh).nombre_lignes; i++) |
(*s_etat_processus).erreur_systeme =
|
{ |
d_es_allocation_memoire;
|
if ((((complex16 **) (*matrice_vh).tableau)[i] = |
return;
|
malloc(((size_t) (*matrice_vh).nombre_colonnes) * |
}
|
sizeof(complex16))) == NULL) |
}
|
{ |
|
(*s_etat_processus).erreur_systeme = |
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++)
|
d_es_allocation_memoire; |
{
|
return; |
for(j = 0; j < (*matrice_vh).nombre_lignes; j++)
|
} |
{
|
} |
((complex16 **) (*matrice_vh).tableau)[j][i] =
|
|
((complex16 *) matrice_f77_vh)[k++];
|
for(k = 0, i = 0; i < (*matrice_vh).nombre_colonnes; i++) |
}
|
{ |
}
|
for(j = 0; j < (*matrice_vh).nombre_lignes; j++) |
|
{ |
free(matrice_f77_vh);
|
((complex16 **) (*matrice_vh).tableau)[j][i] = |
}
|
((complex16 *) matrice_f77_vh)[k++]; |
|
} |
(*vecteur_s).taille = nombre_valeurs_singulieres;
|
} |
(*vecteur_s).type = 'R';
|
|
(*vecteur_s).tableau = vecteur_f77_s;
|
free(matrice_f77_vh); |
|
} |
break;
|
|
}
|
(*vecteur_s).taille = nombre_valeurs_singulieres; |
}
|
(*vecteur_s).type = 'R'; |
|
(*vecteur_s).tableau = vecteur_f77_s; |
return;
|
|
}
|
break; |
|
} |
// vim: ts=4
|
} |
|
|
|
return; |
|
} |
|
|
|
// vim: ts=4 |