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

Constructors | |
| XxMatrix () | |
| Default constructor. | |
| XxMatrix (int_t nr, int_t nc, const Property &pr=Property::General()) | |
| Dimension constructor. | |
| XxMatrix (int_t nr, int_t nc, T_Scalar *vals, int_t ldv, bool bind, const Property &pr=Property::General()) | |
| Auxiliary constructor. | |
| XxMatrix (const XxMatrix< T_Scalar > &other) | |
| Copy constructor. | |
| XxMatrix (XxMatrix< T_Scalar > &&other) | |
| Move constructor. | |
| ~XxMatrix () | |
| Destructor. | |
Operators | |
| XxMatrix< T_Scalar > & | operator= (const XxMatrix< T_Scalar > &other) |
| Copy assignment operator. | |
| XxMatrix< T_Scalar > & | operator= (XxMatrix< T_Scalar > &&other) |
| Move assignment operator. | |
| void | operator= (T_Scalar val) |
| Fill operator. | |
| alias::VirtualScal_dns< T_Scalar > | operator- () const |
| Unary negation operator. | |
Arguments | |
| int_t | ld () const |
| Get the leading dimension. | |
Public Member Functions | |
| void | clear () |
| Clear the device matrix. | |
| void | fill (T_Scalar val) |
| Fill all elements with a value. | |
| XxMatrix< T_Scalar > | copy () const |
| Create a deep copy of the device matrix. | |
| XxMatrix< T_Scalar > | rcopy () |
| Create a reference copy (shallow copy) of the device matrix. | |
| Guard< XxMatrix< T_Scalar > > | rcopy () const |
| Create a guarded reference copy (shallow copy) of the device matrix. | |
| XxMatrix< T_Scalar > | move () |
| Move the device matrix's resources. | |
| std::string | info (const std::string &header="") const |
| Get information about the device matrix. | |
| void | iscale (T_Scalar val) |
| Scale the device matrix in-place. | |
| alias::VirtualTrans_dns< T_Scalar > | transpose () const |
| Transpose the device matrix. | |
| alias::VirtualTrans_dns< T_Scalar > | ctranspose () const |
| Conjugate transpose the device matrix. | |
| alias::VirtualConj_dns< T_Scalar > | conjugate () const |
| Compute the complex conjugate. | |
| void | iconjugate () |
| Conjugate the device matrix in-place. | |
| T_RScalar | normOne () const |
| Compute the 1-norm. | |
| T_RScalar | normInf () const |
| Compute the infinity norm. | |
| T_RScalar | normMax () const |
| Compute the maximum norm. | |
| T_RScalar | normFro () const |
| Compute the Frobenius norm. | |
| XxMatrix< T_Scalar > | block (int_t ibgn, int_t jbgn, int_t ni, int_t nj) const |
| Extract a block as a new device matrix. | |
| XxMatrix< T_Scalar > | rblock (int_t ibgn, int_t jbgn, int_t ni, int_t nj) |
| Extract a reference block. | |
| Guard< XxMatrix< T_Scalar > > | rblock (int_t ibgn, int_t jbgn, int_t ni, int_t nj) const |
| Extract a guarded reference block. | |
| void | setBlock (int_t ibgn, int_t jbgn, const XxMatrix< T_Scalar > &src) |
| Set a block of elements. | |
| XxVector< T_Scalar > | column (int_t j) const |
| Extract a column as a new device vector. | |
| XxVector< T_Scalar > | rcolumn (int_t j) |
| Extract a column as a reference. | |
| Guard< XxVector< T_Scalar > > | rcolumn (int_t j) const |
| Extract a column as a guarded reference. | |
| XxMatrix< T_Scalar > | row (int_t i) const |
| Extract a row as a new device matrix. | |
| XxMatrix< T_Scalar > | rrow (int_t i) |
| Extract a row as a reference. | |
| Guard< XxMatrix< T_Scalar > > | rrow (int_t i) const |
| Extract a row as a guarded reference. | |
| VirtualRowvec< T_Scalar > | rrowvec (int_t i) const |
| Extract a row as a virtual row vector. | |
| void | copyToHost (::cla3p::dns::XxMatrix< T_Cla3pScalar > &dest) const |
| Copies the device matrix to a host matrix. | |
| void | copyFromHost (const ::cla3p::dns::XxMatrix< T_Cla3pScalar > &src) |
| Copies a host matrix to the device matrix. | |
Creators/Generators | |
| static Guard< XxMatrix< T_Scalar > > | view (int_t nr, int_t nc, const T_Scalar *vals, int_t ldv, const Property &pr=Property::General()) |
| Create a view of existing device memory. | |
The device dense matrix class.
Represents a dense matrix stored on the GPU device.
| T_Scalar | The scalar type (e.g., float, double, complex). |
| culite::dns::XxMatrix< T_Scalar >::XxMatrix | ( | ) |
Default constructor.
Creates an empty device matrix with no allocated device memory.
|
explicit |
Dimension constructor.
Creates a device matrix of the specified dimensions and allocates device memory.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | pr | The matrix property (default: General). |
|
explicit |
Auxiliary constructor.
Creates a device matrix using existing device memory.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | vals | Pointer to existing device memory. |
| [in] | ldv | The leading dimension. |
| [in] | bind | If true, the matrix takes ownership of the memory. |
| [in] | pr | The matrix property (default: General). |
| culite::dns::XxMatrix< T_Scalar >::XxMatrix | ( | const XxMatrix< T_Scalar > & | other | ) |
Copy constructor.
Creates a new device matrix by copying another device matrix.
| [in] | other | The device matrix to copy. |
| culite::dns::XxMatrix< T_Scalar >::XxMatrix | ( | XxMatrix< T_Scalar > && | other | ) |
Move constructor.
Creates a new device matrix by moving resources from another device matrix.
| [in] | other | The device matrix to move from. |
| culite::dns::XxMatrix< T_Scalar >::~XxMatrix | ( | ) |
Destructor.
Destroys the device matrix and releases allocated device memory.
| XxMatrix< T_Scalar > & culite::dns::XxMatrix< T_Scalar >::operator= | ( | const XxMatrix< T_Scalar > & | other | ) |
Copy assignment operator.
Copies the contents of another device matrix to this device matrix.
| [in] | other | The device matrix to copy. |
| XxMatrix< T_Scalar > & culite::dns::XxMatrix< T_Scalar >::operator= | ( | XxMatrix< T_Scalar > && | other | ) |
Move assignment operator.
Moves resources from another device matrix to this device matrix.
| [in] | other | The device matrix to move from. |
| void culite::dns::XxMatrix< T_Scalar >::operator= | ( | T_Scalar | val | ) |
Fill operator.
Fills all elements with the specified value.
| [in] | val | The scalar value to fill with. |
| alias::VirtualScal_dns< T_Scalar > culite::dns::XxMatrix< T_Scalar >::operator- | ( | ) | const |
Unary negation operator.
Returns a negated copy of the device matrix.
| int_t culite::dns::XxMatrix< T_Scalar >::ld | ( | ) | const |
Get the leading dimension.
Returns the leading dimension of the device matrix (distance between consecutive columns).
| void culite::dns::XxMatrix< T_Scalar >::clear | ( | ) |
Clear the device matrix.
Releases all device memory and resets the matrix to an empty state.
| void culite::dns::XxMatrix< T_Scalar >::fill | ( | T_Scalar | val | ) |
Fill all elements with a value.
Sets all elements in the matrix to the specified scalar value.
| [in] | val | The scalar value to fill with. |
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::copy | ( | ) | const |
Create a deep copy of the device matrix.
Creates a new device matrix with its own device memory allocation and copies all elements from this matrix to the new matrix.
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::rcopy | ( | ) |
Create a reference copy (shallow copy) of the device matrix.
Creates a new device matrix object that references the same device memory as this matrix. Changes to either matrix will affect both.
| Guard< XxMatrix< T_Scalar > > culite::dns::XxMatrix< T_Scalar >::rcopy | ( | ) | const |
Create a guarded reference copy (shallow copy) of the device matrix.
Creates a guarded device matrix object that references the same device memory as this matrix. The guard ensures the reference is read-only.
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::move | ( | ) |
Move the device matrix's resources.
Transfers ownership of the device memory to a new matrix object, leaving this matrix in an empty state.
| std::string culite::dns::XxMatrix< T_Scalar >::info | ( | const std::string & | header = "" | ) | const |
Get information about the device matrix.
Returns a string containing information about the matrix's dimensions and properties.
| [in] | header | Optional header string to prepend to the information. |
| void culite::dns::XxMatrix< T_Scalar >::iscale | ( | T_Scalar | val | ) |
Scale the device matrix in-place.
Multiplies all elements of the device matrix by a scalar value.
| [in] | val | The scalar value to multiply by. |
| alias::VirtualTrans_dns< T_Scalar > culite::dns::XxMatrix< T_Scalar >::transpose | ( | ) | const |
Transpose the device matrix.
Returns a transposed copy of the device matrix.
| alias::VirtualTrans_dns< T_Scalar > culite::dns::XxMatrix< T_Scalar >::ctranspose | ( | ) | const |
Conjugate transpose the device matrix.
Returns a conjugate transposed copy of the device matrix.
| alias::VirtualConj_dns< T_Scalar > culite::dns::XxMatrix< T_Scalar >::conjugate | ( | ) | const |
Compute the complex conjugate.
Returns a device matrix containing the complex conjugate of each element.
| void culite::dns::XxMatrix< T_Scalar >::iconjugate | ( | ) |
Conjugate the device matrix in-place.
Replaces all elements with their complex conjugates.
| T_RScalar culite::dns::XxMatrix< T_Scalar >::normOne | ( | ) | const |
Compute the 1-norm.
Computes the maximum absolute column sum.
| T_RScalar culite::dns::XxMatrix< T_Scalar >::normInf | ( | ) | const |
Compute the infinity norm.
Computes the maximum absolute row sum.
| T_RScalar culite::dns::XxMatrix< T_Scalar >::normMax | ( | ) | const |
Compute the maximum norm.
Computes the maximum absolute value of all elements.
| T_RScalar culite::dns::XxMatrix< T_Scalar >::normFro | ( | ) | const |
Compute the Frobenius norm.
Computes the square root of the sum of squared absolute values of all elements.
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::block | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) const |
Extract a block as a new device matrix.
Creates a new device matrix containing a deep copy of a contiguous block of elements.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::rblock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) |
Extract a reference block.
Creates a device matrix that references a contiguous block of this matrix's device memory.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| Guard< XxMatrix< T_Scalar > > culite::dns::XxMatrix< T_Scalar >::rblock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) const |
Extract a guarded reference block.
Creates a guarded device matrix that references a contiguous block of this matrix's device memory.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| void culite::dns::XxMatrix< T_Scalar >::setBlock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| const XxMatrix< T_Scalar > & | src ) |
Set a block of elements.
Copies elements from the source device matrix to a contiguous block of this matrix.
| [in] | ibgn | The starting row index where the block will be written. |
| [in] | jbgn | The starting column index where the block will be written. |
| [in] | src | The source device matrix to copy from. |
| XxVector< T_Scalar > culite::dns::XxMatrix< T_Scalar >::column | ( | int_t | j | ) | const |
Extract a column as a new device vector.
Creates a new device vector containing a deep copy of a column.
| [in] | j | The column index. |
| XxVector< T_Scalar > culite::dns::XxMatrix< T_Scalar >::rcolumn | ( | int_t | j | ) |
Extract a column as a reference.
Creates a device vector that references a column of this matrix's device memory.
| [in] | j | The column index. |
| Guard< XxVector< T_Scalar > > culite::dns::XxMatrix< T_Scalar >::rcolumn | ( | int_t | j | ) | const |
Extract a column as a guarded reference.
Creates a guarded device vector that references a column of this matrix's device memory.
| [in] | j | The column index. |
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::row | ( | int_t | i | ) | const |
Extract a row as a new device matrix.
Creates a new device matrix containing a deep copy of a row.
| [in] | i | The row index. |
| XxMatrix< T_Scalar > culite::dns::XxMatrix< T_Scalar >::rrow | ( | int_t | i | ) |
Extract a row as a reference.
Creates a device matrix that references a row of this matrix's device memory.
| [in] | i | The row index. |
| Guard< XxMatrix< T_Scalar > > culite::dns::XxMatrix< T_Scalar >::rrow | ( | int_t | i | ) | const |
Extract a row as a guarded reference.
Creates a guarded device matrix that references a row of this matrix's device memory.
| [in] | i | The row index. |
| VirtualRowvec< T_Scalar > culite::dns::XxMatrix< T_Scalar >::rrowvec | ( | int_t | i | ) | const |
Extract a row as a virtual row vector.
Creates a virtual row vector expression that references a row of this matrix's device memory.
| [in] | i | The row index. |
| void culite::dns::XxMatrix< T_Scalar >::copyToHost | ( | ::cla3p::dns::XxMatrix< T_Cla3pScalar > & | dest | ) | const |
Copies the device matrix to a host matrix.
Performs a device-to-host copy operation. If dest is empty, it is resized to match the dimensions and properties of the device matrix. Otherwise, dest must be compatible with the device matrix.
| [out] | dest | The destination host matrix. |
| void culite::dns::XxMatrix< T_Scalar >::copyFromHost | ( | const ::cla3p::dns::XxMatrix< T_Cla3pScalar > & | src | ) |
Copies a host matrix to the device matrix.
Performs a host-to-device copy operation. If the device matrix is empty, it is resized to match the dimensions and properties of src. Otherwise, the device matrix must be compatible with src.
| [in] | src | The source host matrix. |
|
static |
Create a view of existing device memory.
Creates a guarded device matrix that references existing device memory without taking ownership. The memory must remain valid for the lifetime of the returned view.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | vals | Pointer to the device memory. |
| [in] | ldv | The leading dimension. |
| [in] | pr | The matrix property (default: General). |