49 #include <boost/lexical_cast.hpp> 
   57     template<
typename SparseStorageType>
 
   60         m_sparseStorage(sparseStoragePtr)
 
   64     template<
typename SparseStorageType>
 
   66         m_mulCallsCounter(src.m_mulCallsCounter),
 
   67         m_sparseStorage(src.m_sparseStorage)
 
   71     template<
typename SparseStorageType>
 
   77     template<
typename SparseStorageType>
 
   80         return m_sparseStorage->GetRows();
 
   83     template<
typename SparseStorageType>
 
   86         return m_sparseStorage->GetColumns();
 
   89     template<
typename SparseStorageType>
 
   92         return m_sparseStorage->GetNumNonZeroEntries();
 
   96     template<
typename SparseStorageType>
 
   99         return m_sparseStorage->GetFillInRatio();
 
  104     template<
typename SparseStorageType>
 
  107         return m_sparseStorage->GetValue(row, column);
 
  110     template<
typename SparseStorageType>
 
  113         return m_sparseStorage->begin();
 
  116     template<
typename SparseStorageType>
 
  119         return m_sparseStorage->end();
 
  123     template<
typename SparseStorageType>
 
  127         m_sparseStorage->Multiply(in,out);
 
  131     template<
typename SparseStorageType>
 
  135         m_sparseStorage->Multiply(in,out);
 
  139     template<
typename SparseStorageType>
 
  142         return m_sparseStorage->GetMemoryUsage(
 
  143                     m_sparseStorage->GetNumNonZeroEntries(),
 
  144                     m_sparseStorage->GetRows()
 
  147                sizeof(
unsigned long); 
 
  150     template<
typename SparseStorageType>
 
  153         return m_mulCallsCounter;
 
  156     template<
typename SparseStorageType>
 
  159         return (
DataType) m_sparseStorage->GetNumNonZeroEntries() /
 
  160                (
DataType) m_sparseStorage->GetRows();
 
  163     template<
typename SparseStorageType>
 
  168         typename SparseStorageType::const_iterator entry = m_sparseStorage->begin();
 
  170         for (; entry != m_sparseStorage->end(); ++entry)
 
  172             bandwidth = (std::max)(bandwidth, 2*std::abs((
int)(entry->first.first - entry->first.second+1)));
 
  177     template<
typename SparseStorageType>
 
  182         typename SparseStorageType::const_iterator entry = m_sparseStorage->begin();
 
  183         for (; entry != m_sparseStorage->end(); entry++)
 
  185             (*coo)[std::make_pair(entry->first.first, entry->first.second) ] = entry->second;
 
  197     template<
typename SparseStorageType>
 
  200         const int matRows = m_sparseStorage->GetRows();
 
  201         const int gridRows = matRows / blockSize + (matRows % blockSize > 0);
 
  202         const int gridCols = gridRows;
 
  204         std::vector< std::vector<int> > grid (gridRows);
 
  205         for (
int row = 0; row < gridRows; row++)
 
  207             grid[row].resize(gridCols,0);
 
  210         typename SparseStorageType::const_iterator entry = m_sparseStorage->begin();
 
  211         for (; entry != m_sparseStorage->end(); entry++)
 
  213             const IndexType row = entry->first.first;
 
  214             const IndexType col = entry->first.second;
 
  215             const int gridRow = row / blockSize;
 
  216             const int gridCol = col / blockSize;
 
  217             grid[gridRow][gridCol]++;
 
  220         for (
int row = 0; row < gridRows; row++)
 
  222             for (
int col = 0; col < gridCols; col++)
 
  224                 out << grid[row][col] << 
" ";
 
  236     template<
typename SparseStorageType>
 
  240         blockSize = (std::min)(blockSize, m_sparseStorage->GetRows());
 
  241         std::vector< std::vector<int> > grid (blockSize);
 
  242         for (
int row = 0; row < blockSize; row++)
 
  244             grid[row].resize(blockSize,0);
 
  247         typename SparseStorageType::const_iterator entry = m_sparseStorage->begin();
 
  248         for (; entry != m_sparseStorage->end(); entry++)
 
  250             const IndexType row = entry->first.first;
 
  251             const IndexType col = entry->first.second;
 
  253             if (blk_row != row / blockSize ) 
continue;
 
  254             if (blk_col != col / blockSize ) 
continue;
 
  255             grid[row % blockSize][col % blockSize]++;
 
  258         for (
int row = 0; row < blockSize; row++)
 
  260             for (
int col = 0; col < blockSize; col++)
 
  262                 out << grid[row][col] << 
" ";
 
boost::shared_ptr< SparseStorageType > SparseStorageSharedPtr
COOMatTypeSharedPtr GetCooStorage()
std::map< CoordType, NekDouble > COOMatType
boost::shared_ptr< COOMatType > COOMatTypeSharedPtr
boost::call_traits< DataType >::const_reference operator()(const IndexType row, const IndexType column) const 
SparseStorageType::const_iterator begin() const 
const size_t GetMemoryFootprint() const 
SparseStorageType::DataType DataType
void Multiply(const DataVectorType &in, DataVectorType &out)
const IndexType GetColumns() const 
const IndexType GetBandwidth()
const IndexType GetNumNonZeroEntries() const 
const unsigned long GetMulCallsCounter() const 
void writeBlockSparsityPatternTo(std::ostream &out, const IndexType blk_row=0, const IndexType blk_col=0, IndexType blockSize=64)
Complementary routine to the previous. It generates exact non-zero pattern of a given block matrix en...
const IndexType GetRows() const 
SparseStorageType::const_iterator end() const 
const DataType GetAvgRowDensity() const 
NekSparseMatrix(const SparseStorageSharedPtr &sparseStoragePtr)
void writeSparsityPatternTo(std::ostream &out, IndexType blockSize=64)
const DataType GetFillInRatio() const