Changeset 1194 for trunk


Ignore:
Timestamp:
Nov 24, 2015 6:23:41 PM (4 years ago)
Author:
pbelotti
Message:

comparison operator for top-level auxiliary (with sign)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/expression/CouenneExprAux.hpp

    r1080 r1194  
    1414
    1515#include <iostream>
     16#include <assert.h>
    1617
    1718#include "CouenneExprVar.hpp"
     
    211212  inline bool operator () (exprAux* e0, exprAux* e1) const
    212213  {
    213     return ((e0 -> sign  () < e1 -> sign  ()) ||
    214             ((e0 -> Image () != NULL) && (e1 -> Image () != NULL) && (e0 -> Image () -> compare (*(e1 -> Image ())) < 0)));
     214    int signDiff = (e0 -> sign  () - e1 -> sign  ());
     215
     216    assert (e0 -> Image () != NULL);
     217    assert (e1 -> Image () != NULL);
     218
     219    return ((signDiff < 0) ||
     220            ((signDiff == 0) &&
     221             ((e0 -> Image () != NULL) &&
     222              (e1 -> Image () != NULL) &&
     223              (e0 -> Image () -> compare (*(e1 -> Image ())) < 0))));
    215224  }
    216225};
Note: See TracChangeset for help on using the changeset viewer.