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

Detailed description

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
class cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >

View of a ell_matrix.

Template Parameters
ArrayType1Type of column_indices array view
ArrayType2Type of values array view
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
Note
The matrix entries must be sorted by column index.
The matrix entries within each row should be shifted to the left.
The matrix should not contain duplicate entries.
Example
The following code snippet demonstrates how to create a 4-by-3 ell_matrix_view on the host with 3 nonzeros per row.
// include the ell_matrix header file
#include <cusp/print.h>
int main()
{
typedef typename IndexArray::view IndexArrayView;
typedef typename ValueArray::view ValueArrayView;
// initialize columns and values
IndexArray column_indices(4,3);
ValueArray values(4,3);
// X is used to fill unused entries in the matrix
// initialize matrix entries on host
column_indices(0,0) = 0; values(0,0) = 10;
column_indices(0,1) = 2; values(0,1) = 20; // shifted to leftmost position
column_indices(0,2) = X; values(0,2) = 0; // padding
column_indices(1,0) = X; values(1,0) = 0; // padding
column_indices(1,1) = X; values(1,1) = 0; // padding
column_indices(1,2) = X; values(1,2) = 0; // padding
column_indices(2,0) = 2; values(2,0) = 30; // shifted to leftmost position
column_indices(2,1) = X; values(2,1) = 0; // padding
column_indices(2,2) = X; values(2,2) = 0; // padding
column_indices(3,0) = 0; values(3,0) = 40;
column_indices(3,1) = 1; values(3,1) = 50;
column_indices(3,2) = 2; values(3,2) = 60;
// allocate storage for (4,3) matrix with 6 nonzeros
4,3,6,
// A now represents the following matrix
// [10 0 20]
// [ 0 0 0]
// [ 0 0 30]
// [40 50 60]
// print the constructed ell_matrix
// change first entry in values array
values(0,0) = -1;
// print the updated matrix view
}

Definition at line 318 of file ell_matrix.h.

#include <ell_matrix.h>

Inheritance diagram for cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >:

Public Methods

 ell_matrix_view (void)
 
template<typename OtherArrayType1 , typename OtherArrayType2 >
 ell_matrix_view (const size_t num_rows, const size_t num_cols, const size_t num_entries, const OtherArrayType1 &column_indices, const OtherArrayType2 &values)
 
 ell_matrix_view (ell_matrix< IndexType, ValueType, MemorySpace > &matrix)
 
 ell_matrix_view (const ell_matrix< IndexType, ValueType, MemorySpace > &matrix)
 
 ell_matrix_view (ell_matrix_view &matrix)
 
 ell_matrix_view (const ell_matrix_view &matrix)
 
void resize (size_t num_rows, size_t num_cols, size_t num_entries, size_t num_entries_per_row)
 
void resize (size_t num_rows, size_t num_cols, size_t num_entries, size_t num_entries_per_row, size_t alignment)
 

Public Members

column_indices_array_type column_indices
 
values_array_type values
 

Static Public Members

static const IndexType invalid_index = container::invalid_index
 

Constructor & Destructor Documentation

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( void  )
inline

Construct an empty ell_matrix_view.

Definition at line 356 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
template<typename OtherArrayType1 , typename OtherArrayType2 >
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( const size_t  num_rows,
const size_t  num_cols,
const size_t  num_entries,
const OtherArrayType1 &  column_indices,
const OtherArrayType2 &  values 
)
inline

Construct a ell_matrix_view with a specific shape and number of nonzero entries from existing arrays denoting the column indices and values.

Parameters
num_rowsNumber of rows.
num_colsNumber of columns.
num_entriesNumber of nonzero matrix entries.
column_indicesArray containing the column indices.
valuesArray containing the values.

Definition at line 368 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( ell_matrix< IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a ell_matrix_view from a existing ell_matrix.

Parameters
matrixell_matrix used to create view.

Definition at line 378 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( const ell_matrix< IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a ell_matrix_view from a existing const ell_matrix.

Parameters
matrixell_matrix used to create view.

Definition at line 387 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a ell_matrix_view from a existing ell_matrix_view.

Parameters
matrixell_matrix_view used to create view.

Definition at line 396 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::ell_matrix_view ( const ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace > &  matrix)
inline

Construct a ell_matrix_view from a existing const ell_matrix_view.

Parameters
matrixell_matrix_view used to create view.

Definition at line 405 of file ell_matrix.h.

Member Function Documentation

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
void cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::resize ( size_t  num_rows,
size_t  num_cols,
size_t  num_entries,
size_t  num_entries_per_row 
)

Resize matrix dimensions and underlying storage

Parameters
num_rowsNumber of rows.
num_colsNumber of columns.
num_entriesNumber of nonzero matrix entries.
num_entries_per_rowMaximum number of nonzeros per row.
template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
void cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::resize ( size_t  num_rows,
size_t  num_cols,
size_t  num_entries,
size_t  num_entries_per_row,
size_t  alignment 
)

Resize matrix dimensions and underlying storage

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

Member Data Documentation

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
column_indices_array_type cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::column_indices

View to column indices of the ELL data structure.

Definition at line 346 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
const IndexType cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::invalid_index = container::invalid_index
static

Value used to pad the rows of the column_indices array.

Definition at line 341 of file ell_matrix.h.

template<typename ArrayType1, typename ArrayType2, typename IndexType = typename ArrayType1::value_type, typename ValueType = typename ArrayType2::value_type, typename MemorySpace = typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type>
values_array_type cusp::ell_matrix_view< ArrayType1, ArrayType2, IndexType, ValueType, MemorySpace >::values

View to nonzero entries of the ELL data structure.

Definition at line 351 of file ell_matrix.h.