src/cmr/series_parallel.c
/**
 * \brief Scan the matrix to compute the number of nonzeros and the hash of each row and each column.
 */
\brief Scan the matrix to compute the number of nonzeros and the hash of each row and each column.
\ brief Scan the matrix to compute the number of nonzeros and the hash of each row and each column .
static
CMR_ERROR calcBinaryHashFromListMatrix(
  CMR* cmr,                 
  ListMatrix* listmatrix,   
  ElementData* rowData,     
  ElementData* columnData,  
  long long* hashVector     
)
{
  assert(cmr);
  assert(listmatrix);
  assert(rowData);
  assert(columnData);
  for (ListMatrixNonzero* rowHead = listmatrix->anchor.below; rowHead->row != SIZE_MAX; rowHead = rowHead->below)
    rowData[rowHead->row].hashValue = 0;
  for (ListMatrixNonzero* columnHead = listmatrix->anchor.right; columnHead->column != SIZE_MAX;
    columnHead = columnHead->right)
  {
    columnData[columnHead->column].hashValue = 0;
  }
  for (ListMatrixNonzero* rowHead = listmatrix->anchor.below; rowHead->row != SIZE_MAX; rowHead = rowHead->below)
  {
    for (ListMatrixNonzero* nz = rowHead->right; nz != rowHead; nz = nz->right)
    {
      long long newHash = projectSignedHash(rowData[nz->row].hashValue + hashVector[nz->column]);
      rowData[nz->row].hashValue  = newHash;
      newHash = projectSignedHash(columnData[nz->column].hashValue + hashVector[nz->row]);
      columnData[nz->column].hashValue = newHash;
    }
  }
  return CMR_OKAY;
}
static CMR_ERROR calcBinaryHashFromListMatrix ( CMR * cmr , ListMatrix * listmatrix , ElementData * rowData , ElementData * columnData , long long * hashVector ) { assert ( cmr ) ; assert ( listmatrix ) ; assert ( rowData ) ; assert ( columnData ) ; for ( ListMatrixNonzero * rowHead = listmatrix -> anchor . below ; rowHead -> row != SIZE_MAX ; rowHead = rowHead -> below ) rowData [ rowHead -> row ] . hashValue = 0 ; for ( ListMatrixNonzero * columnHead = listmatrix -> anchor . right ; columnHead -> column != SIZE_MAX ; columnHead = columnHead -> right ) { columnData [ columnHead -> column ] . hashValue = 0 ; } for ( ListMatrixNonzero * rowHead = listmatrix -> anchor . below ; rowHead -> row != SIZE_MAX ; rowHead = rowHead -> below ) { for ( ListMatrixNonzero * nz = rowHead -> right ; nz != rowHead ; nz = nz -> right ) { long long newHash = projectSignedHash ( rowData [ nz -> row ] . hashValue + hashVector [ nz -> column ] ) ; rowData [ nz -> row ] . hashValue = newHash ; newHash = projectSignedHash ( columnData [ nz -> column ] . hashValue + hashVector [ nz -> row ] ) ; columnData [ nz -> column ] . hashValue = newHash ; } } return CMR_OKAY ; }
\brief Scan the matrix to compute the number of nonzeros and the hash of each row and each column.
\ brief Scan the matrix to compute the number of nonzeros and the hash of each row and each column .
/**< \ref CMR environment. */ /**< List matrix. */ /**< Other row element data. */ /**< Other column element data. */ /**< Hash vector. */ /* Reset hash values. */ /* Update row data. */ /* Update column data. */