![]() |
cuLite v0.3.1
A lite CUDA C++ Interface
|
The device sparse matrix class (compressed sparse row format). More...

Constructors | |
| XxMatrix () | |
| Default constructor. | |
| XxMatrix (T_Int nr, T_Int nc, T_Int nz, const Property &pr=Property::General()) | |
| Dimension constructor. | |
| XxMatrix (T_Int nr, T_Int nc, T_Int *rptr, T_Int *cidx, T_Scalar *vals, bool bind, const Property &pr=Property::General()) | |
| Auxiliary constructor. | |
| XxMatrix (const XxMatrix< T_Int, T_Scalar > &other) | |
| Copy constructor. | |
| XxMatrix (XxMatrix< T_Int, T_Scalar > &&other) | |
| Move constructor. | |
| ~XxMatrix () | |
| Destructor. | |
Operators | |
| XxMatrix< T_Int, T_Scalar > & | operator= (const XxMatrix< T_Int, T_Scalar > &other) |
| Copy assignment operator. | |
| XxMatrix< T_Int, T_Scalar > & | operator= (XxMatrix< T_Int, T_Scalar > &&other) |
| Move assignment operator. | |
| alias::VirtualScal_csr< T_Int, T_Scalar > | operator- () const |
| Unary negation operator. | |
Arguments | |
| T_Int * | rowptr () |
| Access the row pointer array. | |
| const T_Int * | rowptr () const |
| Access the row pointer array. | |
| T_Int * | colidx () |
| Access the column index array. | |
| const T_Int * | colidx () const |
| Access the column index array. | |
| T_Int | nnz () const |
| Get the number of non-zero elements. | |
Public Member Functions | |
| void | clear () |
| Clear the device sparse matrix. | |
| std::string | info (const std::string &header="") const |
| Get information about the sparse matrix. | |
| XxMatrix< T_Int, T_Scalar > | copy () const |
| Create a deep copy of the device sparse matrix. | |
| XxMatrix< T_Int, T_Scalar > | rcopy () |
| Create a reference copy (shallow copy) of the device sparse matrix. | |
| Guard< XxMatrix< T_Int, T_Scalar > > | rcopy () const |
| Create a guarded reference copy (shallow copy) of the device sparse matrix. | |
| XxMatrix< T_Int, T_Scalar > | move () |
| Move the device sparse matrix's resources. | |
| void | iscale (T_Scalar val) |
| Scale the device sparse matrix in-place. | |
| alias::VirtualTrans_csr< T_Int, T_Scalar > | transpose () const |
| Compute the transpose. | |
| alias::VirtualTrans_csr< T_Int, T_Scalar > | ctranspose () const |
| Compute the conjugate transpose (Hermitian transpose). | |
| alias::VirtualConj_csr< T_Int, T_Scalar > | conjugate () const |
| Compute the complex conjugate. | |
| void | iconjugate () |
| Conjugate the device sparse matrix in-place. | |
| void | copyToHost (::cla3p::csr::XxMatrix< T_Cla3pInt, T_Cla3pScalar > &dest) const |
| Copy the device sparse matrix to host memory. | |
| void | copyFromHost (const ::cla3p::csr::XxMatrix< T_Cla3pInt, T_Cla3pScalar > &src) |
| Copy a host sparse matrix to this device sparse matrix. | |
Creators/Generators | |
| static Guard< XxMatrix< T_Int, T_Scalar > > | view (T_Int nr, T_Int nc, const T_Int *rptr, const T_Int *cidx, const T_Scalar *vals, const Property &pr=Property::General()) |
| Create a view of existing device CSR arrays. | |
The device sparse matrix class (compressed sparse row format).
Represents a sparse matrix stored on the GPU device in CSR format.
| T_Int | The integer type for indexing (e.g., int32_t, int64_t). |
| T_Scalar | The scalar type (e.g., float, double, complex). |
| culite::csr::XxMatrix< T_Int, T_Scalar >::XxMatrix | ( | ) |
Default constructor.
Creates an empty device sparse matrix with no allocated device memory.
|
explicit |
Dimension constructor.
Creates a device sparse matrix of the specified dimensions in CSR format and allocates device memory.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | nz | The number of non-zero elements. |
| [in] | pr | The matrix property (default: General). |
|
explicit |
Auxiliary constructor.
Creates a device sparse matrix using existing device memory CSR format arrays.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | rptr | Pointer to existing device row pointer array. |
| [in] | cidx | Pointer to existing device column index array. |
| [in] | vals | Pointer to existing device values array. |
| [in] | bind | If true, the matrix takes ownership of the device memory. |
| [in] | pr | The matrix property (default: General). |
| culite::csr::XxMatrix< T_Int, T_Scalar >::XxMatrix | ( | const XxMatrix< T_Int, T_Scalar > & | other | ) |
Copy constructor.
Creates a new device sparse matrix by copying another device sparse matrix.
| [in] | other | The device sparse matrix to copy. |
| culite::csr::XxMatrix< T_Int, T_Scalar >::XxMatrix | ( | XxMatrix< T_Int, T_Scalar > && | other | ) |
Move constructor.
Creates a new device sparse matrix by moving resources from another device sparse matrix.
| [in] | other | The device sparse matrix to move from. |
| culite::csr::XxMatrix< T_Int, T_Scalar >::~XxMatrix | ( | ) |
Destructor.
Destroys the device sparse matrix and releases allocated device memory.
| XxMatrix< T_Int, T_Scalar > & culite::csr::XxMatrix< T_Int, T_Scalar >::operator= | ( | const XxMatrix< T_Int, T_Scalar > & | other | ) |
Copy assignment operator.
Copies the contents of another device sparse matrix to this device sparse matrix.
| [in] | other | The device sparse matrix to copy. |
| XxMatrix< T_Int, T_Scalar > & culite::csr::XxMatrix< T_Int, T_Scalar >::operator= | ( | XxMatrix< T_Int, T_Scalar > && | other | ) |
Move assignment operator.
Moves resources from another device sparse matrix to this device sparse matrix.
| [in] | other | The device sparse matrix to move from. |
| alias::VirtualScal_csr< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::operator- | ( | ) | const |
Unary negation operator.
Returns a negated copy of the device sparse matrix.
| T_Int * culite::csr::XxMatrix< T_Int, T_Scalar >::rowptr | ( | ) |
Access the row pointer array.
Returns a pointer to the row pointer array (CSR format).
| const T_Int * culite::csr::XxMatrix< T_Int, T_Scalar >::rowptr | ( | ) | const |
Access the row pointer array.
Returns a pointer to the row pointer array (CSR format).
| T_Int * culite::csr::XxMatrix< T_Int, T_Scalar >::colidx | ( | ) |
Access the column index array.
Returns a pointer to the column index array (CSR format).
| const T_Int * culite::csr::XxMatrix< T_Int, T_Scalar >::colidx | ( | ) | const |
Access the column index array.
Returns a pointer to the column index array (CSR format).
| T_Int culite::csr::XxMatrix< T_Int, T_Scalar >::nnz | ( | ) | const |
Get the number of non-zero elements.
Returns the number of stored non-zero elements in the device sparse matrix.
| void culite::csr::XxMatrix< T_Int, T_Scalar >::clear | ( | ) |
Clear the device sparse matrix.
Releases all device memory and resets the matrix to an empty state.
| std::string culite::csr::XxMatrix< T_Int, T_Scalar >::info | ( | const std::string & | header = "" | ) | const |
Get information about the sparse matrix.
Returns a string containing information about the matrix's dimensions, non-zeros, and properties.
| [in] | header | Optional header string to prepend to the information. |
| XxMatrix< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::copy | ( | ) | const |
Create a deep copy of the device sparse matrix.
Creates a new device sparse matrix with its own device memory allocation and copies all elements from this matrix to the new matrix.
| XxMatrix< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::rcopy | ( | ) |
Create a reference copy (shallow copy) of the device sparse matrix.
Creates a new device sparse matrix object that references the same device memory as this matrix. Changes to either matrix will affect both.
| Guard< XxMatrix< T_Int, T_Scalar > > culite::csr::XxMatrix< T_Int, T_Scalar >::rcopy | ( | ) | const |
Create a guarded reference copy (shallow copy) of the device sparse matrix.
Creates a guarded device sparse matrix object that references the same device memory as this matrix. The guard ensures the reference is read-only.
| XxMatrix< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::move | ( | ) |
Move the device sparse matrix's resources.
Transfers ownership of the device memory to a new matrix object, leaving this matrix in an empty state.
| void culite::csr::XxMatrix< T_Int, T_Scalar >::iscale | ( | T_Scalar | val | ) |
Scale the device sparse matrix in-place.
Multiplies all non-zero elements of the device sparse matrix by a scalar value.
| [in] | val | The scalar value to multiply by. |
| alias::VirtualTrans_csr< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::transpose | ( | ) | const |
Compute the transpose.
Returns a virtual expression representing the transpose of the device sparse matrix. Rows and columns are swapped.
| alias::VirtualTrans_csr< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::ctranspose | ( | ) | const |
Compute the conjugate transpose (Hermitian transpose).
Returns a virtual expression representing the conjugate transpose of the device sparse matrix. Rows and columns are swapped, and complex elements are conjugated. For real matrices, this is equivalent to transpose().
| alias::VirtualConj_csr< T_Int, T_Scalar > culite::csr::XxMatrix< T_Int, T_Scalar >::conjugate | ( | ) | const |
Compute the complex conjugate.
Returns a device matrix containing the complex conjugate of each non-zero element.
| void culite::csr::XxMatrix< T_Int, T_Scalar >::iconjugate | ( | ) |
Conjugate the device sparse matrix in-place.
Replaces all non-zero elements with their complex conjugates.
| void culite::csr::XxMatrix< T_Int, T_Scalar >::copyToHost | ( | ::cla3p::csr::XxMatrix< T_Cla3pInt, T_Cla3pScalar > & | dest | ) | const |
Copy the device sparse matrix to host memory.
Transfers the device sparse matrix data to a host sparse matrix.
| [out] | dest | The host sparse matrix destination. |
| void culite::csr::XxMatrix< T_Int, T_Scalar >::copyFromHost | ( | const ::cla3p::csr::XxMatrix< T_Cla3pInt, T_Cla3pScalar > & | src | ) |
Copy a host sparse matrix to this device sparse matrix.
Transfers data from a host sparse matrix to this device sparse matrix.
| [in] | src | The host sparse matrix source. |
|
static |
Create a view of existing device CSR arrays.
Creates a guarded device sparse matrix that references existing device CSR format memory without taking ownership. The device memory must remain valid for the lifetime of the returned view.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | rptr | Pointer to the device row pointer array. |
| [in] | cidx | Pointer to the device column index array. |
| [in] | vals | Pointer to the device values array. |
| [in] | pr | The matrix property (default: General). |