ViennaCL - The Vienna Computing Library: viennacl::compressed_compressed_matrix< NumericT > Class Template Reference

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
viennacl::compressed_compressed_matrix< NumericT > 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 < NumericT >::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_matrix & | operator= (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 NumericT *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...
void | clear ()
| Resets all entries in the matrix back to zero without changing the matrix size. Resets the sparsity pattern. More...
const vcl_size_t & | size1 () const
| Returns the number of rows. More...
const vcl_size_t & | size2 () const
| Returns the number of columns. More...
const vcl_size_t & | nnz1 () const
| Returns the number of nonzero entries. More...
const vcl_size_t & | nnz () const
| Returns the number of nonzero entries. More...
const handle_type & | handle1 () const
| Returns the OpenCL handle to the row index array. More...
const handle_type & | handle2 () const
| Returns the OpenCL handle to the column index array. More...
const handle_type & | handle3 () const
| Returns the OpenCL handle to the row index array. More...
const handle_type & | handle () const
| Returns the OpenCL handle to the matrix entry array. More...
handle_type & | handle1 ()
| Returns the OpenCL handle to the row index array. More...
handle_type & | handle2 ()
| Returns the OpenCL handle to the column index array. More...
handle_type & | handle3 ()
| Returns the OpenCL handle to the row index array. More...
handle_type & | handle ()
| 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 NumericT>
class viennacl::compressed_compressed_matrix< NumericT >

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

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

Definition at line 265 of file compressed_compressed_matrix.hpp.

## Member Typedef Documentation

template<class NumericT>

typedef viennacl::backend::mem_handle viennacl::compressed_compressed_matrix< NumericT >::handle_type

Definition at line 268 of file compressed_compressed_matrix.hpp.

template<class NumericT>

typedef vcl_size_t viennacl::compressed_compressed_matrix< NumericT >::size_type

Definition at line 270 of file compressed_compressed_matrix.hpp.

template<class NumericT>

typedef scalar<typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT<NumericT>::ResultType> viennacl::compressed_compressed_matrix< NumericT >::value_type

Definition at line 269 of file compressed_compressed_matrix.hpp.

## Constructor & Destructor Documentation

template<class NumericT>

viennacl::compressed_compressed_matrix< NumericT >::compressed_compressed_matrix | ( |  | ) |
| inline

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

Definition at line 273 of file compressed_compressed_matrix.hpp.

template<class NumericT>

viennacl::compressed_compressed_matrix< NumericT >::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

  rows | Number of rows
  cols | Number of columns
  nonzero_rows | Optional number of nonzero rows for memory preallocation
  nonzeros | Optional number of nonzeros for memory preallocation
  ctx | Context in which to create the matrix. Uses the default context if omitted

Definition at line 283 of file compressed_compressed_matrix.hpp.

template<class NumericT>

viennacl::compressed_compressed_matrix< NumericT >::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

  rows | Number of rows
  cols | Number of columns
  ctx | Context in which to create the matrix

Definition at line 317 of file compressed_compressed_matrix.hpp.

template<class NumericT>

viennacl::compressed_compressed_matrix< NumericT >::compressed_compressed_matrix | ( | viennacl::context | ctx | ) |
| inlineexplicit

Definition at line 338 of file compressed_compressed_matrix.hpp.

## Member Function Documentation

template<class NumericT>

void viennacl::compressed_compressed_matrix< NumericT >::clear | ( |  | ) |
| inline

Resets all entries in the matrix back to zero without changing the matrix size. Resets the sparsity pattern.

Definition at line 443 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle | ( |  | ) | const
| inline

Returns the OpenCL handle to the matrix entry array.

Definition at line 475 of file compressed_compressed_matrix.hpp.

template<class NumericT>

handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle | ( |  | ) |
| inline

Returns the OpenCL handle to the matrix entry array.

Definition at line 484 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle1 | ( |  | ) | const
| inline

Returns the OpenCL handle to the row index array.

Definition at line 469 of file compressed_compressed_matrix.hpp.

template<class NumericT>

handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle1 | ( |  | ) |
| inline

Returns the OpenCL handle to the row index array.

Definition at line 478 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle2 | ( |  | ) | const
| inline

Returns the OpenCL handle to the column index array.

Definition at line 471 of file compressed_compressed_matrix.hpp.

template<class NumericT>

handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle2 | ( |  | ) |
| inline

Returns the OpenCL handle to the column index array.

Definition at line 480 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle3 | ( |  | ) | const
| inline

Returns the OpenCL handle to the row index array.

Definition at line 473 of file compressed_compressed_matrix.hpp.

template<class NumericT>

handle_type& viennacl::compressed_compressed_matrix< NumericT >::handle3 | ( |  | ) |
| inline

Returns the OpenCL handle to the row index array.

Definition at line 482 of file compressed_compressed_matrix.hpp.

template<class NumericT>

viennacl::memory_types viennacl::compressed_compressed_matrix< NumericT >::memory_context | ( |  | ) | const
| inline

Definition at line 494 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const vcl_size_t& viennacl::compressed_compressed_matrix< NumericT >::nnz | ( |  | ) | const
| inline

Returns the number of nonzero entries.

Definition at line 466 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const vcl_size_t& viennacl::compressed_compressed_matrix< NumericT >::nnz1 | ( |  | ) | const
| inline

Returns the number of nonzero entries.

Definition at line 464 of file compressed_compressed_matrix.hpp.

template<class NumericT>

compressed_compressed_matrix& viennacl::compressed_compressed_matrix< NumericT >::operator= | ( | compressed_compressed_matrix< NumericT > const & | other | ) |
| inline

Assignment a compressed matrix from possibly another memory domain.

Definition at line 386 of file compressed_compressed_matrix.hpp.

template<class NumericT>

void viennacl::compressed_compressed_matrix< NumericT >::set | ( | const void * | row_jumper,
|  | const void * | row_indices,
|  | const void * | col_buffer,
|  | const NumericT * | 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_jumper | Pointer 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_indices | Array holding the indices of the nonzero rows
  col_buffer | Pointer to an array holding the column index of each entry. The array length is 'nonzeros'
  elements | Pointer to an array holding the entries of the sparse matrix. The array length is 'elements'
  rows | Number of rows of the sparse matrix
  cols | Number of columns of the sparse matrix
  nonzero_rows | Number of nonzero rows
  nonzeros | Total number of nonzero entries

Definition at line 416 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const vcl_size_t& viennacl::compressed_compressed_matrix< NumericT >::size1 | ( |  | ) | const
| inline

Returns the number of rows.

Definition at line 460 of file compressed_compressed_matrix.hpp.

template<class NumericT>

const vcl_size_t& viennacl::compressed_compressed_matrix< NumericT >::size2 | ( |  | ) | const
| inline

Returns the number of columns.

Definition at line 462 of file compressed_compressed_matrix.hpp.

template<class NumericT>

void viennacl::compressed_compressed_matrix< NumericT >::switch_memory_context | ( | viennacl::context | new_ctx | ) |
| inline

Definition at line 486 of file compressed_compressed_matrix.hpp.

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

- viennacl/compressed_compressed_matrix.hpp