Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
Public Methods | Public Members | List of all members
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace > Class Template Reference

Detailed description

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
class cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >

View of a hyb_matrix.

Template Parameters
MatrixType1Type of ell
MatrixType2Type of coo
IndexTypeType used for matrix indices (e.g. int).
ValueTypeType used for matrix values (e.g. float).
MemorySpaceA memory space (e.g. cusp::host_memory or cusp::device_memory)
Overview
A hyb_matrix_view is a sparse matrix view of a hyb_matrix constructed from existing data or iterators. See ell_matrix and coo_matrix for format constraints.
Note
The matrix entries must be sorted by row index.
The matrix should not contain duplicate entries.
Example
The following code snippet demonstrates how to create a 4-by-3 hyb_matrix_view on the host with 6 nonzeros.
// include coo_matrix header file
#include <cusp/print.h>
int main()
{
// allocate storage for (4,3) matrix with 8 nonzeros
// ELL portion has 5 nonzeros and storage for 2 nonzeros per row
// COO portion has 3 nonzeros
// Initialize A to represent the following matrix
// [10 20 30 40]
// [ 0 50 0 0]
// [60 0 70 80]
// A is split into ELL and COO parts as follows
// [10 20 30 40] [10 20 0 0] [ 0 0 30 40]
// [ 0 50 0 0] = [ 0 50 0 0] + [ 0 0 0 0]
// [60 0 70 80] [60 0 70 0] [ 0 0 0 80]
// Initialize ELL part
// X is used to fill unused entries in the ELL portion of the matrix
// first row
ell.column_indices(0,0) = 0; ell.values(0,0) = 10;
ell.column_indices(0,1) = 1; ell.values(0,1) = 20;
// second row
ell.column_indices(1,0) = 1; ell.values(1,0) = 50; // shifted to leftmost position
ell.column_indices(1,1) = X; ell.values(1,1) = 0; // padding
// third row
ell.column_indices(2,0) = 0; ell.values(2,0) = 60;
ell.column_indices(2,1) = 2; ell.values(2,1) = 70; // shifted to leftmost position
// Initialize COO part
coo.row_indices[0] = 0; coo.column_indices[0] = 2; coo.values[0] = 30;
coo.row_indices[1] = 0; coo.column_indices[1] = 3; coo.values[1] = 40;
coo.row_indices[2] = 2; coo.column_indices[2] = 3; coo.values[2] = 80;
// allocate storage for (4,3) matrix with 6 nonzeros
// print the constructed hyb_matrix
// change first entry in values array
ell.values(0,0) = -1;
// print the updated matrix view
}

Definition at line 341 of file hyb_matrix.h.

#include <hyb_matrix.h>

Inheritance diagram for cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >:

Public Methods

 hyb_matrix_view (void)
 
template<typename OtherMatrixType1 , typename OtherMatrixType2 >
 hyb_matrix_view (OtherMatrixType1 &ell, OtherMatrixType2 &coo)
 
template<typename OtherMatrixType1 , typename OtherMatrixType2 >
 hyb_matrix_view (const OtherMatrixType1 &ell, const OtherMatrixType2 &coo)
 
 hyb_matrix_view (hyb_matrix< IndexType, ValueType, MemorySpace > &matrix)
 
 hyb_matrix_view (const hyb_matrix< IndexType, ValueType, MemorySpace > &matrix)
 
 hyb_matrix_view (hyb_matrix_view &matrix)
 
 hyb_matrix_view (const hyb_matrix_view &matrix)
 
void resize (size_t num_rows, size_t num_cols, size_t num_ell_entries, size_t num_coo_entries, size_t num_entries_per_row, size_t alignment=32)
 

Public Members

ell_matrix_type ell
 
coo_matrix_type coo
 

Constructor & Destructor Documentation

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( void  )
inline

Construct an empty hyb_matrix_view.

Definition at line 371 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
template<typename OtherMatrixType1 , typename OtherMatrixType2 >
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( OtherMatrixType1 &  ell,
OtherMatrixType2 &  coo 
)
inline

Construct a hyb_matrix_view with a specific shape and number of nonzero entries from existing ell_matrix and coo_matrix matrices.

Template Parameters
OtherMatrixType1Type of ell_matrix used to construct view
OtherMatrixType2Type of coo_matrix used to construct view
Parameters
ellMatrix containing ELL portion of hyb_format.
cooMatrix containing COO portion of hyb_format.

Definition at line 383 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
template<typename OtherMatrixType1 , typename OtherMatrixType2 >
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( const OtherMatrixType1 &  ell,
const OtherMatrixType2 &  coo 
)
inline

Construct a hyb_matrix_view with a specific shape and number of nonzero entries from existing const ell_matrix and const coo_matrix matrices.

Template Parameters
OtherMatrixType1Type of ell_matrix used to construct view
OtherMatrixType2Type of coo_matrix used to construct view
Parameters
ellMatrix containing ELL portion of hyb_format.
cooMatrix containing COO portion of hyb_format.

Definition at line 396 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( hyb_matrix< IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a hyb_matrix_view from a existing hyb_matrix.

Parameters
matrixhyb_matrix used to create view.

Definition at line 403 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( const hyb_matrix< IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a hyb_matrix_view from a existing const hyb_matrix.

Parameters
matrixhyb_matrix used to create view.

Definition at line 410 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a hyb_matrix_view from a existing hyb_matrix_view.

Parameters
matrixhyb_matrix_view used to create view.

Definition at line 417 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::hyb_matrix_view ( const hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a hyb_matrix_view from a existing const hyb_matrix_view.

Parameters
matrixhyb_matrix_view used to create view.

Definition at line 424 of file hyb_matrix.h.

Member Function Documentation

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
void cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::resize ( size_t  num_rows,
size_t  num_cols,
size_t  num_ell_entries,
size_t  num_coo_entries,
size_t  num_entries_per_row,
size_t  alignment = 32 
)

Resize matrix dimensions and underlying storage

Parameters
num_rowsNumber of rows.
num_colsNumber of columns.
num_ell_entriesNumber of nonzero matrix entries in the ELL portion.
num_coo_entriesNumber of nonzero matrix entries in the ELL portion.
num_entries_per_rowMaximum number of nonzeros per row in the ELL portion.
alignmentAmount of padding used to align the ELL data structure (default 32).

Member Data Documentation

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
coo_matrix_type cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::coo

View to the COO portion of the HYB structure.

Definition at line 367 of file hyb_matrix.h.

template<typename MatrixType1, typename MatrixType2, typename IndexType = typename MatrixType1::index_type, typename ValueType = typename MatrixType1::value_type, typename MemorySpace = typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type>
ell_matrix_type cusp::hyb_matrix_view< MatrixType1, MatrixType2, IndexType, ValueType, MemorySpace >::ell

View to the ELL portion of the HYB structure.

Definition at line 363 of file hyb_matrix.h.