cuLite v0.3.1
A lite CUDA C++ Interface
Loading...
Searching...
No Matches
Add/Update Operations

Operations for summing or updating existing containers. More...

Functions

template<typename T_Scalar>
void culite::ops::add (T_Scalar alpha, const dns::XxVector< T_Scalar > &x, T_Scalar beta, const dns::XxVector< T_Scalar > &y, dns::XxVector< T_Scalar > &z, CuBlasHandler &cublasHandler=globalCuBlasHandler())
 Adds two compatible scaled dense vectors.
template<typename T_Scalar>
void culite::ops::add (op_t opA, T_Scalar alpha, const dns::XxMatrix< T_Scalar > &A, op_t opB, T_Scalar beta, const dns::XxMatrix< T_Scalar > &B, dns::XxMatrix< T_Scalar > &C, CuBlasHandler &cublasHandler=globalCuBlasHandler())
 Adds two compatible scaled dense matrices with optional transpose operations.
template<typename T_Int, typename T_Scalar>
csr::XxMatrix< T_Int, T_Scalar > culite::ops::add (T_Scalar alpha, const csr::XxMatrix< T_Int, T_Scalar > &A, T_Scalar beta, const csr::XxMatrix< T_Int, T_Scalar > &B, CuSparseHandler &cusparseHandler=globalCuSparseHandler())
 Adds two compatible sparse matrices in CSR format.
template<typename T_Int, typename T_Scalar>
csc::XxMatrix< T_Int, T_Scalar > culite::ops::add (T_Scalar alpha, const csc::XxMatrix< T_Int, T_Scalar > &A, T_Scalar beta, const csc::XxMatrix< T_Int, T_Scalar > &B, CuSparseHandler &cusparseHandler=globalCuSparseHandler())
 Adds two compatible sparse matrices in CSC format.
template<typename T_Scalar>
void culite::ops::update (T_Scalar alpha, const dns::XxVector< T_Scalar > &x, dns::XxVector< T_Scalar > &y, CuBlasHandler &cublasHandler=globalCuBlasHandler())
 Update a dense vector with a compatible scaled dense vector.
template<typename T_Scalar>
void culite::ops::update (op_t opA, T_Scalar alpha, const dns::XxMatrix< T_Scalar > &A, dns::XxMatrix< T_Scalar > &B, CuBlasHandler &cublasHandler=globalCuBlasHandler())
 Update a dense matrix with a compatible scaled dense matrix with optional transposition.
template<typename T_Scalar>
void culite::ops::update (T_Scalar alpha, const dns::XxMatrix< T_Scalar > &A, dns::XxMatrix< T_Scalar > &B, CuBlasHandler &cublasHandler=globalCuBlasHandler())
 Update a dense matrix with a compatible scaled dense matrix.
template<typename T_Int, typename T_Scalar>
void culite::ops::update (T_Scalar alpha, const csr::XxMatrix< T_Int, T_Scalar > &A, csr::XxMatrix< T_Int, T_Scalar > &B, CuSparseHandler &cuSparseHandler=globalCuSparseHandler())
 Update a sparse matrix with a compatible scaled sparse matrix.
template<typename T_Int, typename T_Scalar>
void culite::ops::update (T_Scalar alpha, const csc::XxMatrix< T_Int, T_Scalar > &A, csc::XxMatrix< T_Int, T_Scalar > &B, CuSparseHandler &cuSparseHandler=globalCuSparseHandler())
 Update a sparse matrix with a compatible scaled sparse matrix.

Detailed Description

Operations for summing or updating existing containers.

Function Documentation

◆ add() [1/4]

template<typename T_Scalar>
void culite::ops::add ( T_Scalar alpha,
const dns::XxVector< T_Scalar > & x,
T_Scalar beta,
const dns::XxVector< T_Scalar > & y,
dns::XxVector< T_Scalar > & z,
CuBlasHandler & cublasHandler = globalCuBlasHandler() )

Adds two compatible scaled dense vectors.

Performs the operation \( \alpha \cdot x + \beta \cdot y \).

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient for x.
[in]xThe first input dense vector.
[in]betaThe scaling coefficient for y.
[in]yThe second input dense vector.
[out]zThe output dense vector.
[in]cublasHandlerThe cuBLAS handler for GPU operations (defaults to global handler).
Examples
ex02l_dense_matrix_algebra_add.cpp, and ex06l_sparse_matrix_algebra_add.cpp.

◆ add() [2/4]

template<typename T_Scalar>
void culite::ops::add ( op_t opA,
T_Scalar alpha,
const dns::XxMatrix< T_Scalar > & A,
op_t opB,
T_Scalar beta,
const dns::XxMatrix< T_Scalar > & B,
dns::XxMatrix< T_Scalar > & C,
CuBlasHandler & cublasHandler = globalCuBlasHandler() )

Adds two compatible scaled dense matrices with optional transpose operations.

Performs the operation \( \alpha \cdot op_A(A) + \beta \cdot op_B(B) \), where \( op_A \) and \( op_B \) can be no-transpose, transpose, or conjugate transpose.

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]opAThe operation to apply to matrix A (no-transpose, transpose, or conjugate transpose).
[in]alphaThe scaling coefficient for A.
[in]AThe first input dense matrix.
[in]opBThe operation to apply to matrix B (no-transpose, transpose, or conjugate transpose).
[in]betaThe scaling coefficient for B.
[in]BThe second input dense matrix.
[out]CThe output dense matrix.
[in]cublasHandlerThe cuBLAS handler for GPU operations (defaults to global handler).

◆ add() [3/4]

template<typename T_Int, typename T_Scalar>
csr::XxMatrix< T_Int, T_Scalar > culite::ops::add ( T_Scalar alpha,
const csr::XxMatrix< T_Int, T_Scalar > & A,
T_Scalar beta,
const csr::XxMatrix< T_Int, T_Scalar > & B,
CuSparseHandler & cusparseHandler = globalCuSparseHandler() )

Adds two compatible sparse matrices in CSR format.

Performs the operation \( \alpha \cdot A + \beta \cdot B \) on GPU using cuSPARSE.

Template Parameters
T_IntThe integer type for indexing.
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient for A.
[in]AThe first input sparse matrix in CSR format.
[in]betaThe scaling coefficient for B.
[in]BThe second input sparse matrix in CSR format.
[in]cusparseHandlerThe cuSPARSE handler for GPU operations (defaults to global handler).
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \) as a CSR matrix.

◆ add() [4/4]

template<typename T_Int, typename T_Scalar>
csc::XxMatrix< T_Int, T_Scalar > culite::ops::add ( T_Scalar alpha,
const csc::XxMatrix< T_Int, T_Scalar > & A,
T_Scalar beta,
const csc::XxMatrix< T_Int, T_Scalar > & B,
CuSparseHandler & cusparseHandler = globalCuSparseHandler() )

Adds two compatible sparse matrices in CSC format.

Performs the operation \( \alpha \cdot A + \beta \cdot B \) on GPU using cuSPARSE.

Template Parameters
T_IntThe integer type for indexing.
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient for A.
[in]AThe first input sparse matrix in CSC format.
[in]betaThe scaling coefficient for B.
[in]BThe second input sparse matrix in CSC format.
[in]cusparseHandlerThe cuSPARSE handler for GPU operations (defaults to global handler).
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \) as a CSC matrix.

◆ update() [1/5]

template<typename T_Scalar>
void culite::ops::update ( T_Scalar alpha,
const dns::XxVector< T_Scalar > & x,
dns::XxVector< T_Scalar > & y,
CuBlasHandler & cublasHandler = globalCuBlasHandler() )

Update a dense vector with a compatible scaled dense vector.

Performs the operation \( y = y + \alpha \cdot x \).

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient.
[in]xThe input dense vector.
[in,out]yThe dense vector to be updated.
[in]cublasHandlerThe cuBLAS handler for GPU operations (defaults to global handler).
Examples
ex02l_dense_matrix_algebra_add.cpp, and ex06l_sparse_matrix_algebra_add.cpp.

◆ update() [2/5]

template<typename T_Scalar>
void culite::ops::update ( op_t opA,
T_Scalar alpha,
const dns::XxMatrix< T_Scalar > & A,
dns::XxMatrix< T_Scalar > & B,
CuBlasHandler & cublasHandler = globalCuBlasHandler() )

Update a dense matrix with a compatible scaled dense matrix with optional transposition.

Performs the operation \( B = B + \alpha \cdot op(A) \), where \( op(A) \) can be \( A \), \( A^T \), or \( A^H \).

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]opAThe operation to apply to matrix A (N for none, T for transpose, H for conjugate transpose).
[in]alphaThe scaling coefficient.
[in]AThe input dense matrix.
[in,out]BThe dense matrix to be updated.
[in]cublasHandlerThe cuBLAS handler for GPU operations (defaults to global handler).

◆ update() [3/5]

template<typename T_Scalar>
void culite::ops::update ( T_Scalar alpha,
const dns::XxMatrix< T_Scalar > & A,
dns::XxMatrix< T_Scalar > & B,
CuBlasHandler & cublasHandler = globalCuBlasHandler() )

Update a dense matrix with a compatible scaled dense matrix.

Performs the operation \( B = B + \alpha \cdot A \).

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient.
[in]AThe input dense matrix.
[in,out]BThe dense matrix to be updated.
[in]cublasHandlerThe cuBLAS handler for GPU operations (defaults to global handler).

◆ update() [4/5]

template<typename T_Int, typename T_Scalar>
void culite::ops::update ( T_Scalar alpha,
const csr::XxMatrix< T_Int, T_Scalar > & A,
csr::XxMatrix< T_Int, T_Scalar > & B,
CuSparseHandler & cuSparseHandler = globalCuSparseHandler() )

Update a sparse matrix with a compatible scaled sparse matrix.

Performs the operation \( B = B + \alpha \cdot A \).

Template Parameters
T_IntThe integer type for indexing.
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient.
[in]AThe input sparse matrix.
[in,out]BThe sparse matrix to be updated.
[in]cuSparseHandlerThe cuSPARSE handler for GPU operations (defaults to global handler, currently unused).
Warning
This function currently does not utilize the cuSparseHandler and may not be optimized for performance. Use with caution for large sparse matrices as it allocates memory on the device internally.

◆ update() [5/5]

template<typename T_Int, typename T_Scalar>
void culite::ops::update ( T_Scalar alpha,
const csc::XxMatrix< T_Int, T_Scalar > & A,
csc::XxMatrix< T_Int, T_Scalar > & B,
CuSparseHandler & cuSparseHandler = globalCuSparseHandler() )

Update a sparse matrix with a compatible scaled sparse matrix.

Performs the operation \( B = B + \alpha \cdot A \).

Template Parameters
T_IntThe integer type for indexing.
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient.
[in]AThe input sparse matrix.
[in,out]BThe sparse matrix to be updated.
[in]cuSparseHandlerThe cuSPARSE handler for GPU operations (defaults to global handler, currently unused).
Warning
This function currently does not utilize the cuSparseHandler and may not be optimized for performance. Use with caution for large sparse matrices as it allocates memory on the device internally.