Public Types | Public Member Functions | Friends

coordinate_matrix< SCALARTYPE, ALIGNMENT > Class Template Reference

A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row and column indices and val denotes the entry. More...

#include <coordinate_matrix.hpp>

Public Types

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

Public Member Functions

 coordinate_matrix ()
 Default construction of a coordinate matrix. No memory is allocated.
 coordinate_matrix (unsigned int rows, unsigned int cols, unsigned int nonzeros=0)
 Construction of a coordinate matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated.
void reserve (unsigned int new_nonzeros)
 Allocate memory for the supplied number of nonzeros in the matrix. Old values are preserved.
void resize (unsigned int new_size1, unsigned int new_size2, bool preserve=true)
 Resize the matrix.
unsigned int size1 () const
 Returns the number of rows.
unsigned int size2 () const
 Returns the number of columns.
unsigned int nnz () const
 Returns the number of nonzero entries.
unsigned int internal_nnz () const
 Returns the number of internal nonzero entries.
const viennacl::ocl::handle
< cl_mem > & 
handle12 () const
 Returns the OpenCL handle to the (row, column) index array.
const viennacl::ocl::handle
< cl_mem > & 
handle () const
 Returns the OpenCL handle to the matrix entry array.
const viennacl::ocl::handle
< cl_mem > & 
handle3 () const
 Returns the OpenCL handle to the group start index array.

Friends

template<typename CPU_MATRIX , typename SCALARTYPE2 , unsigned int ALIGNMENT2>
void copy (const CPU_MATRIX &cpu_matrix, coordinate_matrix< SCALARTYPE2, ALIGNMENT2 > &gpu_matrix)

Detailed Description

template<class SCALARTYPE, unsigned int ALIGNMENT>
class viennacl::coordinate_matrix< SCALARTYPE, ALIGNMENT >

A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row and column indices and val denotes the entry.

The present implementation of coordinate_matrix suffers from poor runtime efficiency. Users are adviced to use compressed_matrix in the meanwhile.

Template Parameters:
SCALARTYPE The floating point type (either float or double, checked at compile time)
ALIGNMENT The internal memory size for the arrays, given by (size()/ALIGNMENT + 1) * ALIGNMENT. ALIGNMENT must be a power of two.

Member Typedef Documentation

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

Constructor & Destructor Documentation

coordinate_matrix (  )  [inline]

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

coordinate_matrix ( unsigned int  rows,
unsigned int  cols,
unsigned int  nonzeros = 0 
) [inline]

Construction of a coordinate 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
nonzeros Optional number of nonzeros for memory preallocation

Member Function Documentation

const viennacl::ocl::handle<cl_mem>& handle (  )  const [inline]

Returns the OpenCL handle to the matrix entry array.

const viennacl::ocl::handle<cl_mem>& handle12 (  )  const [inline]

Returns the OpenCL handle to the (row, column) index array.

const viennacl::ocl::handle<cl_mem>& handle3 (  )  const [inline]

Returns the OpenCL handle to the group start index array.

unsigned int internal_nnz (  )  const [inline]

Returns the number of internal nonzero entries.

unsigned int nnz (  )  const [inline]

Returns the number of nonzero entries.

void reserve ( unsigned int  new_nonzeros  )  [inline]

Allocate memory for the supplied number of nonzeros in the matrix. Old values are preserved.

void resize ( unsigned int  new_size1,
unsigned int  new_size2,
bool  preserve = true 
) [inline]

Resize the matrix.

Parameters:
new_size1 New number of rows
new_size2 New number of columns
preserve If true, the old values are preserved. At present, old values are always discarded.
unsigned int size1 (  )  const [inline]

Returns the number of rows.

unsigned int size2 (  )  const [inline]

Returns the number of columns.


Friends And Related Function Documentation

void copy ( const CPU_MATRIX &  cpu_matrix,
coordinate_matrix< SCALARTYPE2, ALIGNMENT2 > &  gpu_matrix 
) [friend]

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