CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
Add/Update Operations

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

Functions

template<typename T_Scalar>
dns::XxVector< T_Scalar > cla3p::ops::add (T_Scalar alpha, const dns::XxVector< T_Scalar > &x, T_Scalar beta, const dns::XxVector< T_Scalar > &y)
 Adds two compatible scaled dense vectors.
template<typename T_Scalar>
dns::XxMatrix< T_Scalar > cla3p::ops::add (T_Scalar alpha, const dns::XxMatrix< T_Scalar > &A, T_Scalar beta, const dns::XxMatrix< T_Scalar > &B)
 Adds two compatible scaled dense matrices.
template<typename T_Int, typename T_Scalar>
csr::XxMatrix< T_Int, T_Scalar > cla3p::ops::add (T_Scalar alpha, const csr::XxMatrix< T_Int, T_Scalar > &A, T_Scalar beta, const csr::XxMatrix< T_Int, T_Scalar > &B)
 Adds two compatible sparse matrices.
template<typename T_Int, typename T_Scalar>
csc::XxMatrix< T_Int, T_Scalar > cla3p::ops::add (T_Scalar alpha, const csc::XxMatrix< T_Int, T_Scalar > &A, T_Scalar beta, const csc::XxMatrix< T_Int, T_Scalar > &B)
 Adds two compatible sparse matrices.
template<typename T_Matrix>
lra::XxMatrix< T_Matrix > cla3p::ops::add (typename T_Matrix::value_type alpha, const lra::XxMatrix< T_Matrix > &A, typename T_Matrix::value_type beta, const lra::XxMatrix< T_Matrix > &B, const lra::RankModerator< T_Matrix > &rmod)
 Adds two compatible low-rank matrices.
template<typename T_Scalar>
void cla3p::ops::update (T_Scalar alpha, const dns::XxVector< T_Scalar > &x, dns::XxVector< T_Scalar > &y)
 Update a dense vector with a compatible scaled dense vector.
template<typename T_Scalar>
void cla3p::ops::update (T_Scalar alpha, const dns::XxMatrix< T_Scalar > &A, dns::XxMatrix< T_Scalar > &B)
 Update a dense matrix with a compatible scaled dense matrix.
template<typename T_Int, typename T_Scalar>
void cla3p::ops::update (T_Scalar alpha, const csr::XxMatrix< T_Int, T_Scalar > &A, csr::XxMatrix< T_Int, T_Scalar > &B)
 Update a sparse matrix with a compatible scaled sparse matrix.
template<typename T_Int, typename T_Scalar>
void cla3p::ops::update (T_Scalar alpha, const csc::XxMatrix< T_Int, T_Scalar > &A, csc::XxMatrix< T_Int, T_Scalar > &B)
 Update a sparse matrix with a compatible scaled sparse matrix.

Detailed Description

Operations for summing or updating existing containers.

Function Documentation

◆ add() [1/5]

template<typename T_Scalar>
dns::XxVector< T_Scalar > cla3p::ops::add ( T_Scalar alpha,
const dns::XxVector< T_Scalar > & x,
T_Scalar beta,
const dns::XxVector< T_Scalar > & y )

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.
Returns
The result of the operation \( \alpha \cdot x + \beta \cdot y \).
Examples
ex01j_dense_vector_algebra_add.cpp, ex02l_dense_matrix_algebra_add.cpp, and ex06l_sparse_matrix_algebra_add.cpp.

◆ add() [2/5]

template<typename T_Scalar>
dns::XxMatrix< T_Scalar > cla3p::ops::add ( T_Scalar alpha,
const dns::XxMatrix< T_Scalar > & A,
T_Scalar beta,
const dns::XxMatrix< T_Scalar > & B )

Adds two compatible scaled dense matrices.

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

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).
Parameters
[in]alphaThe scaling coefficient for A.
[in]AThe first input dense matrix.
[in]betaThe scaling coefficient for B.
[in]BThe second input dense matrix.
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \).

◆ add() [3/5]

template<typename T_Int, typename T_Scalar>
csr::XxMatrix< T_Int, T_Scalar > cla3p::ops::add ( T_Scalar alpha,
const csr::XxMatrix< T_Int, T_Scalar > & A,
T_Scalar beta,
const csr::XxMatrix< T_Int, T_Scalar > & B )

Adds two compatible sparse matrices.

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

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]betaThe scaling coefficient for B.
[in]BThe second input sparse matrix.
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \).

◆ add() [4/5]

template<typename T_Int, typename T_Scalar>
csc::XxMatrix< T_Int, T_Scalar > cla3p::ops::add ( T_Scalar alpha,
const csc::XxMatrix< T_Int, T_Scalar > & A,
T_Scalar beta,
const csc::XxMatrix< T_Int, T_Scalar > & B )

Adds two compatible sparse matrices.

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

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]betaThe scaling coefficient for B.
[in]BThe second input sparse matrix.
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \).

◆ add() [5/5]

template<typename T_Matrix>
lra::XxMatrix< T_Matrix > cla3p::ops::add ( typename T_Matrix::value_type alpha,
const lra::XxMatrix< T_Matrix > & A,
typename T_Matrix::value_type beta,
const lra::XxMatrix< T_Matrix > & B,
const lra::RankModerator< T_Matrix > & rmod )

Adds two compatible low-rank matrices.

Performs the operation \( \alpha \cdot A + \beta \cdot B \) with rank moderation.

Template Parameters
T_MatrixThe underlying matrix type.
Parameters
[in]alphaThe scaling coefficient for A.
[in]AThe first input low-rank matrix.
[in]betaThe scaling coefficient for B.
[in]BThe second input low-rank matrix.
[in]rmodThe rank moderator that controls the rank cutoff.
Returns
The result of the operation \( \alpha \cdot A + \beta \cdot B \).

◆ update() [1/4]

template<typename T_Scalar>
void cla3p::ops::update ( T_Scalar alpha,
const dns::XxVector< T_Scalar > & x,
dns::XxVector< T_Scalar > & y )

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.
Examples
ex01j_dense_vector_algebra_add.cpp, ex02l_dense_matrix_algebra_add.cpp, and ex06l_sparse_matrix_algebra_add.cpp.

◆ update() [2/4]

template<typename T_Scalar>
void cla3p::ops::update ( T_Scalar alpha,
const dns::XxMatrix< T_Scalar > & A,
dns::XxMatrix< T_Scalar > & B )

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.

◆ update() [3/4]

template<typename T_Int, typename T_Scalar>
void cla3p::ops::update ( T_Scalar alpha,
const csr::XxMatrix< T_Int, T_Scalar > & A,
csr::XxMatrix< T_Int, T_Scalar > & B )

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.

◆ update() [4/4]

template<typename T_Int, typename T_Scalar>
void cla3p::ops::update ( T_Scalar alpha,
const csc::XxMatrix< T_Int, T_Scalar > & A,
csc::XxMatrix< T_Int, T_Scalar > & B )

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.