src/cmr/series_parallel.c
/**
 * \brief Checks whether the row/column at \p index is a (negated) copy of a row/column stored in the hashtable.
 *
 * Compares the actual vectors by traversing the linked-list representation.
 */
\brief Checks whether the row/column at \p index is a (negated) copy of a row/column stored in the hashtable.
Compares the actual vectors by traversing the linked-list representation.
\ brief Checks whether the row / column at \ p index is a ( negated ) copy of a row / column stored in the hashtable . Compares the actual vectors by traversing the linked - list representation .
static
size_t findCopy(
  ListMatrixElement* listData,  
  ElementData* data,            
  CMR_LISTHASHTABLE* hashtable, 
  size_t index,                 
  bool isRow,                   
  bool support                  
)
{
  CMR_LISTHASHTABLE_HASH hash = llabs(data[index].hashValue);
  CMRdbgMsg(4, "Processing %s %d with a collision (hash value %ld).\n", isRow ? "row" : "column", index,
    data[index].hashValue);
  for (CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst(hashtable, hash);
    entry != SIZE_MAX; entry = CMRlisthashtableFindNext(hashtable, hash, entry))
  {
    size_t collisionIndex = CMRlisthashtableValue(hashtable, entry);
    CMRdbgMsg(8, "%s %d has the same hash value. Comparing...\n", isRow ? "Row" : "Column", collisionIndex);
    bool equal = true;
    bool negated = true;
    if (isRow)
    {
      ListMatrixNonzero* nz1 = listData[index].head.right;
      ListMatrixNonzero* nz2 = listData[collisionIndex].head.right;
      while (equal || negated || support)
      {
        if (nz1->column != nz2->column)
        {
          equal = false;
          negated = false;
          support = false;
          break;
        }
        if (nz1->column == SIZE_MAX)
          break;
        if (nz1->value == nz2->value)
          negated = false;
        else
          equal = false;
        nz1 = nz1->right;
        nz2 = nz2->right;
      }
    }
    else
    {
      ListMatrixNonzero* nz1 = listData[index].head.below;
      ListMatrixNonzero* nz2 = listData[collisionIndex].head.below;
      while (equal || negated || support)
      {
        if (nz1->row != nz2->row)
        {
          equal = false;
          negated = false;
          support = false;
          break;
        }
        if (nz1->row == SIZE_MAX)
          break;
        if (nz1->value == nz2->value)
          negated = false;
        else
          equal = false;
        nz1 = nz1->below;
        nz2 = nz2->below;
      }
    }
    if (equal || negated || support)
      return collisionIndex;
  }
  return SIZE_MAX;
}
static size_t findCopy ( ListMatrixElement * listData , ElementData * data , CMR_LISTHASHTABLE * hashtable , size_t index , bool isRow , bool support ) { CMR_LISTHASHTABLE_HASH hash = llabs ( data [ index ] . hashValue ) ; CMRdbgMsg ( 4 , " \n " , isRow ? " " : " " , index , data [ index ] . hashValue ) ; for ( CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst ( hashtable , hash ) ; entry != SIZE_MAX ; entry = CMRlisthashtableFindNext ( hashtable , hash , entry ) ) { size_t collisionIndex = CMRlisthashtableValue ( hashtable , entry ) ; CMRdbgMsg ( 8 , " \n " , isRow ? " " : " " , collisionIndex ) ; bool equal = true ; bool negated = true ; if ( isRow ) { ListMatrixNonzero * nz1 = listData [ index ] . head . right ; ListMatrixNonzero * nz2 = listData [ collisionIndex ] . head . right ; while ( equal || negated || support ) { if ( nz1 -> column != nz2 -> column ) { equal = false ; negated = false ; support = false ; break ; } if ( nz1 -> column == SIZE_MAX ) break ; if ( nz1 -> value == nz2 -> value ) negated = false ; else equal = false ; nz1 = nz1 -> right ; nz2 = nz2 -> right ; } } else { ListMatrixNonzero * nz1 = listData [ index ] . head . below ; ListMatrixNonzero * nz2 = listData [ collisionIndex ] . head . below ; while ( equal || negated || support ) { if ( nz1 -> row != nz2 -> row ) { equal = false ; negated = false ; support = false ; break ; } if ( nz1 -> row == SIZE_MAX ) break ; if ( nz1 -> value == nz2 -> value ) negated = false ; else equal = false ; nz1 = nz1 -> below ; nz2 = nz2 -> below ; } } if ( equal || negated || support ) return collisionIndex ; } return SIZE_MAX ; }
\brief Checks whether the row/column at \p index is a (negated) copy of a row/column stored in the hashtable.
\ brief Checks whether the row / column at \ p index is a ( negated ) copy of a row / column stored in the hashtable .
/**< Row/column list data. */ /**< Other row/column data. */ /**< Row/column hashtable. */ /**< Index in \p data. */ /**< Whether we are dealing with rows. */ /**< Whether only the support of the vector matters. */