Skip to content

Commit

Permalink
avoid unuseful copy
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Nov 21, 2023
1 parent 7e2ea1a commit ee8111c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
27 changes: 9 additions & 18 deletions src/SIMPLEXE/spx_calculer_a_barre_s_avec_base_reduite.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ callback_function call_back = SPXgetcbmessage(Spx);
char msg [SIRIUS_CALLBACK_BUFFER_SIZE];
/* Eventuellement forme produit de l'inverse */
if ( Spx->UtiliserLaLuUpdate == NON_SPX ) {
strcpy(msg, "CalculerBBarre AppliquerLesEtaVecteurs pas operationnel \n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_FATAL);
call_back(Spx->something_from_the_caller, "CalculerBBarre AppliquerLesEtaVecteurs pas operationnel \n", 0, SIRIUS_FATAL);
exit(0);
SPX_AppliquerLesEtaVecteurs( Spx, ABarreS, CntDeABarreSNonNuls, &NbTermesNonNuls, *CalculEnHyperCreux, *TypeDeSortie );
}
Expand All @@ -123,20 +122,16 @@ Spx->NbABarreSNonNuls = NbTermesNonNuls;
snprintf(msg, SIRIUS_CALLBACK_BUFFER_SIZE, "---------------- CalculerABarreS Spx->NombreDeChangementsDeBase %d -------------\n",Spx->NombreDeChangementsDeBase);
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
if ( *TypeDEntree == VECTEUR_LU ) {
strcpy(msg, "apres resolution TypeDEntree = VECTEUR_LU\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, "apres resolution TypeDEntree = VECTEUR_LU\n", 0, SIRIUS_INFO);
}
if ( *TypeDEntree == COMPACT_LU ){
strcpy(msg, "apres resolution TypeDEntree = COMPACT_LU\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, "apres resolution TypeDEntree = COMPACT_LU\n", 0, SIRIUS_INFO);
}
if ( *TypeDeSortie == VECTEUR_LU ) {
strcpy(msg, "apres resolution TypeDeSortie = VECTEUR_LU\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, "apres resolution TypeDeSortie = VECTEUR_LU\n", 0, SIRIUS_INFO);
}
if ( *TypeDeSortie == COMPACT_LU ){
strcpy(msg, "apres resolution TypeDeSortie = COMPACT_LU\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, "apres resolution TypeDeSortie = COMPACT_LU\n", 0, SIRIUS_INFO);
}
{
double * Buff; int i; int Var; int ic; int icMx; double * Sortie; char Arret;
Expand Down Expand Up @@ -188,23 +183,19 @@ for ( r = 0 ; r < RangDeLaMatriceFactorisee ; r++ ) {

Var = Spx->VariableEnBaseDeLaContrainte[Spx->ColonneDeLaBaseFactorisee[r]];
if ( Spx->OrigineDeLaVariable[Var] != NATIVE ){
strcpy(msg, " variable non native\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, " variable non native\n", 0, SIRIUS_INFO);
}
else {
strcpy(msg, " variable native\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, " variable native\n", 0, SIRIUS_INFO);
}
Arret = OUI_SPX;
}
}
if ( Arret == OUI_SPX ) {
strcpy(msg, "Verif ABarreS not OK\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_FATAL);
call_back(Spx->something_from_the_caller, "Verif ABarreS not OK\n", 0, SIRIUS_FATAL);
exit(0);
}
strcpy(msg, "Fin verif ABarreS OK\n");
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
call_back(Spx->something_from_the_caller, "Fin verif ABarreS OK\n", 0, SIRIUS_INFO);
free( Buff );
free( Sortie );

Expand Down
25 changes: 17 additions & 8 deletions src/SIMPLEXE/spx_calculer_b_barre_avec_base_reduite.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,19 @@ SecondMembreCreux = NON_LU;
SPX_ResolutionDeSysteme( Spx, TypeDEntree, BBarre, NULL, NULL, &TypeDeSortie,
CalculEnHyperCreux, Save, SecondMembreCreux );

callback_function call_back = SPXgetcbmessage(Spx);
char msg [SIRIUS_CALLBACK_BUFFER_SIZE];

/* Eventuellement forme produit de l'inverse */
if ( Spx->UtiliserLaLuUpdate == NON_SPX ) {
printf("CalculerBBarre AppliquerLesEtaVecteurs pas operationnel \n");
exit(0);
call_back(Spx->something_from_the_caller, "CalculerBBarre AppliquerLesEtaVecteurs pas operationnel \n", 0, SIRIUS_FATAL);
exit(0);
SPX_AppliquerLesEtaVecteurs( Spx, BBarre, NULL, NULL, CalculEnHyperCreux, TypeDeSortie );
}

# if VERIFICATION_BBARRE == OUI_SPX
printf("----------- CalculerBBarre Iteration %d ---------------- \n",Spx->Iteration);
snprintf(msg, SIRIUS_CALLBACK_BUFFER_SIZE, "----------- CalculerBBarre Iteration %d ---------------- \n",Spx->Iteration);
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
{
double * Buff; int i; int Var; int ic; int icMx; double * Sortie; char Arret;
Buff = (double *) malloc( Spx->NombreDeContraintes * sizeof( double ) );
Expand Down Expand Up @@ -200,18 +204,23 @@ for ( i = 0 ; i < Spx->NombreDeContraintes ; i++ ) {
Arret = NON_SPX;
for ( i = 0 ; i < Spx->NombreDeContraintes ; i++ ) {
if ( fabs( Buff[i] ) > 1.e-7 ) {
printf("i = %d ecart %e VariableEnBaseDeLaContrainte %d\n",i,Buff[i],Spx->VariableEnBaseDeLaContrainte[i]);
snprintf(msg, SIRIUS_CALLBACK_BUFFER_SIZE, "i = %d ecart %e VariableEnBaseDeLaContrainte %d\n",i,Buff[i],Spx->VariableEnBaseDeLaContrainte[i]);
call_back(Spx->something_from_the_caller, msg, 0, SIRIUS_INFO);
Var = Spx->VariableEnBaseDeLaContrainte[i];
if ( Spx->OrigineDeLaVariable[Var] != NATIVE ) printf(" variable non native\n");
else printf(" variable native\n");
if ( Spx->OrigineDeLaVariable[Var] != NATIVE ) {
call_back(Spx->something_from_the_caller, " variable non native\n", 0, SIRIUS_INFO);
}
else {
call_back(Spx->something_from_the_caller, " variable native\n", 0, SIRIUS_INFO);
}
Arret = OUI_SPX;
}
}
if ( Arret == OUI_SPX ) {
printf("Verif Bbarre not OK\n");
call_back(Spx->something_from_the_caller, "Verif Bbarre not OK\n", 0, SIRIUS_FATAL);
exit(0);
}
printf("Fin verif Bbarre OK\n");
call_back(Spx->something_from_the_caller, "Fin verif Bbarre OK\n", 0, SIRIUS_INFO);
free( Buff );
free( Sortie );

Expand Down

0 comments on commit ee8111c

Please sign in to comment.