54 template<
typename SparseStorageType>
57 m_sparseStorage(sparseStoragePtr)
61 template<
typename SparseStorageType>
68 template<
typename SparseStorageType>
74 template<
typename SparseStorageType>
80 template<
typename SparseStorageType>
86 template<
typename SparseStorageType>
93 template<
typename SparseStorageType>
101 template<
typename SparseStorageType>
107 template<
typename SparseStorageType>
113 template<
typename SparseStorageType>
120 template<
typename SparseStorageType>
128 template<
typename SparseStorageType>
136 template<
typename SparseStorageType>
141 sizeof(
unsigned long);
144 template<
typename SparseStorageType>
150 template<
typename SparseStorageType>
157 template<
typename SparseStorageType>
162 typename SparseStorageType::const_iterator entry =
m_sparseStorage->begin();
166 bandwidth = (std::max)(bandwidth, 2*std::abs((
int)(entry->first.first - entry->first.second+1)));
171 template<
typename SparseStorageType>
176 typename SparseStorageType::const_iterator entry =
m_sparseStorage->begin();
179 (*coo)[std::make_pair(entry->first.first, entry->first.second) ] = entry->second;
191 template<
typename SparseStorageType>
195 const int gridRows = matRows / blockSize + (matRows % blockSize > 0);
196 const int gridCols = gridRows;
198 std::vector< std::vector<int> > grid (gridRows);
199 for (
int row = 0; row < gridRows; row++)
201 grid[row].resize(gridCols,0);
204 typename SparseStorageType::const_iterator entry =
m_sparseStorage->begin();
207 const IndexType row = entry->first.first;
208 const IndexType col = entry->first.second;
209 const int gridRow = row / blockSize;
210 const int gridCol = col / blockSize;
211 grid[gridRow][gridCol]++;
214 for (
int row = 0; row < gridRows; row++)
216 for (
int col = 0; col < gridCols; col++)
218 out << grid[row][col] <<
" ";
230 template<
typename SparseStorageType>
235 std::vector< std::vector<int> > grid (blockSize);
236 for (
int row = 0; row < blockSize; row++)
238 grid[row].resize(blockSize,0);
241 typename SparseStorageType::const_iterator entry =
m_sparseStorage->begin();
244 const IndexType row = entry->first.first;
245 const IndexType col = entry->first.second;
247 if (blk_row != row / blockSize )
continue;
248 if (blk_col != col / blockSize )
continue;
249 grid[row % blockSize][col % blockSize]++;
252 for (
int row = 0; row < blockSize; row++)
254 for (
int col = 0; col < blockSize; col++)
256 out << grid[row][col] <<
" ";
COOMatTypeSharedPtr GetCooStorage()
std::map< CoordType, NekDouble > COOMatType
size_t GetMemoryFootprint() const
IndexType GetColumns() const
std::shared_ptr< SparseStorageType > SparseStorageSharedPtr
const DataType GetFillInRatio() const
SparseStorageSharedPtr m_sparseStorage
IndexType GetRows() const
SparseStorageType::DataType DataType
void Multiply(const DataVectorType &in, DataVectorType &out)
SparseStorageType::const_iterator begin() const
unsigned long GetMulCallsCounter() const
boost::call_traits< DataType >::const_reference operator()(const IndexType row, const IndexType column) 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...
SparseStorageType::const_iterator end() const
const DataType GetAvgRowDensity() const
NekSparseMatrix(const SparseStorageSharedPtr &sparseStoragePtr)
IndexType GetNumNonZeroEntries() const
void writeSparsityPatternTo(std::ostream &out, IndexType blockSize=64)
unsigned long m_mulCallsCounter
std::shared_ptr< COOMatType > COOMatTypeSharedPtr