Skip to content

Commit

Permalink
check if constraints are not NULL before unsetting equilibration
Browse files Browse the repository at this point in the history
  • Loading branch information
claisne committed Feb 13, 2023
1 parent 5d3aa62 commit c37c009
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/ecos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1655,11 +1655,11 @@ void ECOS_updateData(pwork *w, pfloat *Gpr, pfloat *Apr,
/* Only unequilibrate the old data if the new data is in a different location in memory. */
/* This is required for backward compatibility since existing code might need this step. */
if (
((Gpr + w->G->nnz < w->G->pr) || (w->G->pr + w->G->nnz < Gpr)) &&
((Apr + w->A->nnz < w->A->pr) || (w->A->pr + w->A->nnz < Apr)) &&
(!w->G || ((Gpr + w->G->nnz < w->G->pr) || (w->G->pr + w->G->nnz < Gpr))) &&
(!w->A || ((Apr + w->A->nnz < w->A->pr) || (w->A->pr + w->A->nnz < Apr))) &&
((c + w->n < w->c) || (w->c + w->n < c)) &&
((h + w->m < w->h) || (w->h + w->m < h)) &&
((b + w->p < w->b) || (w->b + w->p < b))
(!w->h || ((h + w->m < w->h) || (w->h + w->m < h))) &&
(!w->b || ((b + w->p < w->b) || (w->b + w->p < b)))
){
unset_equilibration(w);
}
Expand Down
4 changes: 2 additions & 2 deletions src/equil.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ void unset_equilibration(pwork *w)
idxint i;
/* idxint num_cols = w->A ? w->A->n : w->G->n; */
idxint num_A_rows = w->A ? w->A->m : 0;
idxint num_G_rows = w->G->m;
idxint num_G_rows = w->G ? w->G->m : 0;

if(w->A)
if(num_A_rows > 0)
restore(w->Aequil, w->xequil, w->A);
if(num_G_rows > 0)
restore(w->Gequil, w->xequil, w->G);
Expand Down

0 comments on commit c37c009

Please sign in to comment.