ViennaCL - The Vienna Computing Library  1.5.2
Public Types | Public Member Functions
compressed_compressed_matrix< SCALARTYPE > Class Template Reference

A sparse square matrix in compressed sparse rows format optimized for the case that only a few rows carry nonzero entries. More...

#include <compressed_compressed_matrix.hpp>

Public Types

typedef
viennacl::backend::mem_handle 
handle_type
 
typedef scalar< typename
viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT
< SCALARTYPE >::ResultType > 
value_type
 
typedef vcl_size_t size_type
 

Public Member Functions

 compressed_compressed_matrix ()
 Default construction of a compressed matrix. No memory is allocated. More...
 
 compressed_compressed_matrix (vcl_size_t rows, vcl_size_t cols, vcl_size_t nonzero_rows=0, vcl_size_t nonzeros=0, viennacl::context ctx=viennacl::context())
 Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated. More...
 
 compressed_compressed_matrix (vcl_size_t rows, vcl_size_t cols, viennacl::context ctx)
 Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated. More...
 
 compressed_compressed_matrix (viennacl::context ctx)
 
compressed_compressed_matrixoperator= (compressed_compressed_matrix const &other)
 Assignment a compressed matrix from possibly another memory domain. More...
 
void set (const void *row_jumper, const void *row_indices, const void *col_buffer, const SCALARTYPE *elements, vcl_size_t rows, vcl_size_t cols, vcl_size_t nonzero_rows, vcl_size_t nonzeros)
 Sets the row, column and value arrays of the compressed matrix. More...
 
const vcl_size_tsize1 () const
 Returns the number of rows. More...
 
const vcl_size_tsize2 () const
 Returns the number of columns. More...
 
const vcl_size_tnnz1 () const
 Returns the number of nonzero entries. More...
 
const vcl_size_tnnz () const
 Returns the number of nonzero entries. More...
 
const handle_typehandle1 () const
 Returns the OpenCL handle to the row index array. More...
 
const handle_typehandle2 () const
 Returns the OpenCL handle to the column index array. More...
 
const handle_typehandle3 () const
 Returns the OpenCL handle to the row index array. More...
 
const handle_typehandle () const
 Returns the OpenCL handle to the matrix entry array. More...
 
handle_typehandle1 ()
 Returns the OpenCL handle to the row index array. More...
 
handle_typehandle2 ()
 Returns the OpenCL handle to the column index array. More...
 
handle_typehandle3 ()
 Returns the OpenCL handle to the row index array. More...
 
handle_typehandle ()
 Returns the OpenCL handle to the matrix entry array. More...
 
void switch_memory_context (viennacl::context new_ctx)
 
viennacl::memory_types memory_context () const
 

Detailed Description

template<class SCALARTYPE>
class viennacl::compressed_compressed_matrix< SCALARTYPE >

A sparse square matrix in compressed sparse rows format optimized for the case that only a few rows carry nonzero entries.

The difference to the 'standard' CSR format is that there is an additional array 'row_indices' so that the i-th set of indices in the CSR-layout refers to row_indices[i].

Template Parameters
SCALARTYPEThe floating point type (either float or double, checked at compile time)
ALIGNMENTThe internal memory size for the entries in each row is given by (size()/ALIGNMENT + 1) * ALIGNMENT. ALIGNMENT must be a power of two. Best values or usually 4, 8 or 16, higher values are usually a waste of memory.

Member Typedef Documentation

typedef scalar<typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT<SCALARTYPE>::ResultType> value_type

Constructor & Destructor Documentation

Default construction of a compressed matrix. No memory is allocated.

compressed_compressed_matrix ( vcl_size_t  rows,
vcl_size_t  cols,
vcl_size_t  nonzero_rows = 0,
vcl_size_t  nonzeros = 0,
viennacl::context  ctx = viennacl::context() 
)
inlineexplicit

Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated.

Parameters
rowsNumber of rows
colsNumber of columns
nonzero_rowsOptional number of nonzero rows for memory preallocation
nonzerosOptional number of nonzeros for memory preallocation
ctxContext in which to create the matrix. Uses the default context if omitted
compressed_compressed_matrix ( vcl_size_t  rows,
vcl_size_t  cols,
viennacl::context  ctx 
)
inlineexplicit

Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated.

Parameters
rowsNumber of rows
colsNumber of columns
ctxContext in which to create the matrix

Member Function Documentation

const handle_type& handle ( ) const
inline

Returns the OpenCL handle to the matrix entry array.

handle_type& handle ( )
inline

Returns the OpenCL handle to the matrix entry array.

const handle_type& handle1 ( ) const
inline

Returns the OpenCL handle to the row index array.

handle_type& handle1 ( )
inline

Returns the OpenCL handle to the row index array.

const handle_type& handle2 ( ) const
inline

Returns the OpenCL handle to the column index array.

handle_type& handle2 ( )
inline

Returns the OpenCL handle to the column index array.

const handle_type& handle3 ( ) const
inline

Returns the OpenCL handle to the row index array.

handle_type& handle3 ( )
inline

Returns the OpenCL handle to the row index array.

viennacl::memory_types memory_context ( ) const
inline
const vcl_size_t& nnz ( ) const
inline

Returns the number of nonzero entries.

const vcl_size_t& nnz1 ( ) const
inline

Returns the number of nonzero entries.

compressed_compressed_matrix& operator= ( compressed_compressed_matrix< SCALARTYPE > const &  other)
inline

Assignment a compressed matrix from possibly another memory domain.

void set ( const void *  row_jumper,
const void *  row_indices,
const void *  col_buffer,
const SCALARTYPE *  elements,
vcl_size_t  rows,
vcl_size_t  cols,
vcl_size_t  nonzero_rows,
vcl_size_t  nonzeros 
)
inline

Sets the row, column and value arrays of the compressed matrix.

Parameters
row_jumperPointer to an array holding the indices of the first element of each row (starting with zero). E.g. row_jumper[10] returns the index of the first entry of the 11th row. The array length is 'cols + 1'
row_indicesArray holding the indices of the nonzero rows
col_bufferPointer to an array holding the column index of each entry. The array length is 'nonzeros'
elementsPointer to an array holding the entries of the sparse matrix. The array length is 'elements'
rowsNumber of rows of the sparse matrix
colsNumber of columns of the sparse matrix
nonzero_rowsNumber of nonzero rows
nonzerosTotal number of nonzero entries
const vcl_size_t& size1 ( ) const
inline

Returns the number of rows.

const vcl_size_t& size2 ( ) const
inline

Returns the number of columns.

void switch_memory_context ( viennacl::context  new_ctx)
inline

The documentation for this class was generated from the following file: