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 calcNonzeroCountHashFromMatrix(
  CMR* cmr,                 
  CMR_CHRMAT* matrix,       
  ListMatrix* listmatrix,   
  ElementData* rowData,     
  ElementData* columnData,  
  long long* hashVector     
)
{
  assert(cmr);
  assert(matrix);
  assert(rowData);
  assert(columnData);
  for (size_t row = 0; row < matrix->numRows; ++row)
  {
    size_t first = matrix->rowSlice[row];
    size_t beyond = matrix->rowSlice[row + 1];
    for (size_t e = first; e < beyond; ++e)
    {
      size_t column = matrix->entryColumns[e];
      char value = matrix->entryValues[e];
      assert(value == 1 || value == -1);
      listmatrix->rowElements[row].numNonzeros++;
      long long newHash = projectSignedHash(rowData[row].hashValue + value * hashVector[column]);
      rowData[row].hashValue  = newHash;
      listmatrix->columnElements[column].numNonzeros++;
      newHash = projectSignedHash(columnData[column].hashValue + value * hashVector[row]);
      columnData[column].hashValue = newHash;
    }
  }
  return CMR_OKAY;
}
static CMR_ERROR calcNonzeroCountHashFromMatrix ( CMR * cmr , CMR_CHRMAT * matrix , ListMatrix * listmatrix , ElementData * rowData , ElementData * columnData , long long * hashVector ) { assert ( cmr ) ; assert ( matrix ) ; assert ( rowData ) ; assert ( columnData ) ; for ( size_t row = 0 ; row < matrix -> numRows ; ++ row ) { size_t first = matrix -> rowSlice [ row ] ; size_t beyond = matrix -> rowSlice [ row + 1 ] ; for ( size_t e = first ; e < beyond ; ++ e ) { size_t column = matrix -> entryColumns [ e ] ; char value = matrix -> entryValues [ e ] ; assert ( value == 1 || value == -1 ) ; listmatrix -> rowElements [ row ] . numNonzeros ++ ; long long newHash = projectSignedHash ( rowData [ row ] . hashValue + value * hashVector [ column ] ) ; rowData [ row ] . hashValue = newHash ; listmatrix -> columnElements [ column ] . numNonzeros ++ ; newHash = projectSignedHash ( columnData [ column ] . hashValue + value * hashVector [ row ] ) ; columnData [ 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. */ /**< Matrix. */ /**< List matrix representation. */ /**< Other row element data. */ /**< Other column element data. */ /**< Hash vector. */ /* Update row data. */ /* Update column data. */