src/cmr/series_parallel.c
/**
 * \brief Adds all rows or columns of the list representation of the matrix either to the queue or to the hashtable.
 */
\brief Adds all rows or columns of the list representation of the matrix either to the queue or to the hashtable.
\ brief Adds all rows or columns of the list representation of the matrix either to the queue or to the hashtable .
static
CMR_ERROR initializeQueueHashtableFromListMatrix(
  CMR* cmr,                     
  CMR_LISTHASHTABLE* hashtable, 
  ListMatrix* listmatrix,       
  ElementData* data,            
  CMR_ELEMENT* queue,           
  size_t* pqueueEnd,            
  bool isRow                    
)
{
  assert(cmr);
  CMRdbgMsg(2, "Initializing queue and hashtable from list representation. Inspecting %s.\n",
    isRow ? "rows" : "columns");
  ListMatrixNonzero* anchor = &listmatrix->anchor;
  for (ListMatrixNonzero* head = isRow ? anchor->below : anchor->right; head != anchor;
    head = (isRow ? head->below : head->right))
  {
    size_t i = isRow ? head->row : head->column;
    CMRdbgMsg(4, "%s %d has %d nonzeros.\n", isRow ? "Row" : "Column", i,
      isRow ? listmatrix->rowElements[i].numNonzeros : listmatrix->columnElements[i].numNonzeros);
    CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst(hashtable, llabs(data[i].hashValue));
    CMRdbgMsg(6, "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) );
    else
    {
      queue[*pqueueEnd] = isRow ? CMRrowToElement(i) : CMRcolumnToElement(i);
      data[i].hashEntry = SIZE_MAX;
      data[i].inQueue = true;
      (*pqueueEnd)++;
    }
  }
  return CMR_OKAY;
}
static CMR_ERROR initializeQueueHashtableFromListMatrix ( CMR * cmr , CMR_LISTHASHTABLE * hashtable , ListMatrix * listmatrix , ElementData * data , CMR_ELEMENT * queue , size_t * pqueueEnd , bool isRow ) { assert ( cmr ) ; CMRdbgMsg ( 2 , " \n " , isRow ? " " : " " ) ; ListMatrixNonzero * anchor = & listmatrix -> anchor ; for ( ListMatrixNonzero * head = isRow ? anchor -> below : anchor -> right ; head != anchor ; head = ( isRow ? head -> below : head -> right ) ) { size_t i = isRow ? head -> row : head -> column ; CMRdbgMsg ( 4 , " \n " , isRow ? " " : " " , i , isRow ? listmatrix -> rowElements [ i ] . numNonzeros : listmatrix -> columnElements [ i ] . numNonzeros ) ; CMR_LISTHASHTABLE_ENTRY entry = CMRlisthashtableFindFirst ( hashtable , llabs ( data [ i ] . hashValue ) ) ; CMRdbgMsg ( 6 , " \n " , data [ i ] . hashValue , isRow ? " " : " " , i , entry ) ; if ( entry == SIZE_MAX ) CMR_CALL ( CMRlisthashtableInsert ( cmr , hashtable , llabs ( data [ i ] . hashValue ) , i , & data [ i ] . hashEntry ) ) ; else { queue [ * pqueueEnd ] = isRow ? CMRrowToElement ( i ) : CMRcolumnToElement ( i ) ; data [ i ] . hashEntry = SIZE_MAX ; data [ i ] . inQueue = true ; ( * pqueueEnd ) ++ ; } } return CMR_OKAY ; }
\brief Adds all rows or columns of the list representation of the matrix either to the queue or to the hashtable.
\ brief Adds all rows or columns of the list representation of the matrix either to the queue or to the hashtable .
/**< \ref CMR environment. */ /**< Row or column hashtable. */ /**< List matrix. */ /**< Other row/column data array. */ /**< 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. */