src/cmr/series_parallel.c
/**
 * \brief Scans the matrix initially in order to add all rows or columns either to the queue or to the hashtable.
 */
\brief Scans the matrix initially in order to add all rows or columns either to the queue or to the hashtable.
\ brief Scans the matrix initially in order to add all rows or columns either to the queue or to the hashtable .
static
CMR_ERROR initializeQueueHashtableFromMatrix(
  CMR* cmr,                               
  CMR_LISTHASHTABLE* hashtable,           
  ListMatrixElement* listmatrixElements,  
  ElementData* data,                      
  size_t sizeData,                        
  CMR_ELEMENT* queue,                     
  size_t* pqueueEnd,                      
  bool isRow                              
)
{
  assert(cmr);
  assert(hashtable || sizeData == 0);
  for (size_t i = 0; i < sizeData; ++i)
  {
    CMRdbgMsg(2, "%s %d has %d nonzeros.\n", isRow ? "Row" : "Column", i, listmatrixElements[i].numNonzeros);
    if (listmatrixElements[i].numNonzeros > 1)
    {
      CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst(hashtable, llabs(data[i].hashValue));
      CMRdbgMsg(2, "Search for hash %ld of %s %d yields entry %d.\n", data[i].hashValue, isRow ? "row" : "column", i, entry);
      if (entry == SIZE_MAX)
      {
        CMR_CALL( CMRlisthashtableInsert(cmr, hashtable, llabs(data[i].hashValue), i, &data[i].hashEntry) );
        continue;
      }
    }
    queue[*pqueueEnd] = isRow ? CMRrowToElement(i) : CMRcolumnToElement(i);
    data[i].hashEntry = SIZE_MAX;
    data[i].inQueue = true;
    (*pqueueEnd)++;
  }
  return CMR_OKAY;
}
static CMR_ERROR initializeQueueHashtableFromMatrix ( CMR * cmr , CMR_LISTHASHTABLE * hashtable , ListMatrixElement * listmatrixElements , ElementData * data , size_t sizeData , CMR_ELEMENT * queue , size_t * pqueueEnd , bool isRow ) { assert ( cmr ) ; assert ( hashtable || sizeData == 0 ) ; for ( size_t i = 0 ; i < sizeData ; ++ i ) { CMRdbgMsg ( 2 , " \n " , isRow ? " " : " " , i , listmatrixElements [ i ] . numNonzeros ) ; if ( listmatrixElements [ i ] . numNonzeros > 1 ) { CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst ( hashtable , llabs ( data [ i ] . hashValue ) ) ; CMRdbgMsg ( 2 , " \n " , data [ i ] . hashValue , isRow ? " " : " " , i , entry ) ; if ( entry == SIZE_MAX ) { CMR_CALL ( CMRlisthashtableInsert ( cmr , hashtable , llabs ( data [ i ] . hashValue ) , i , & data [ i ] . hashEntry ) ) ; continue ; } } queue [ * pqueueEnd ] = isRow ? CMRrowToElement ( i ) : CMRcolumnToElement ( i ) ; data [ i ] . hashEntry = SIZE_MAX ; data [ i ] . inQueue = true ; ( * pqueueEnd ) ++ ; } return CMR_OKAY ; }
\brief Scans the matrix initially in order to add all rows or columns either to the queue or to the hashtable.
\ brief Scans the matrix initially in order to add all rows or columns either to the queue or to the hashtable .
/**< \ref CMR environment. */ /**< Row or column hashtable. */ /**< Row or column list matrix elements. */ /**< Other row/column data. */ /**< Length of \p ListMatrixElements and \p data. */ /**< Queue. */ /**< Pointer to end of queue. */ /**< Whether we are deadling with rows. */ /* Check if it qualifies for addition to the hashtable. */ /* If it was not added to the hashtable, we add it to the queue. */