CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
ex02l_dense_matrix_algebra_add.cpp
#include <iostream>
#include <cla3p/dense.hpp>
#include <cla3p/algebra.hpp>
int main()
{
A = 3.;
B = 2.;
std::cout << "A:\n" << A;
std::cout << "B:\n" << B << "\n";
/*
* Perform the operation (A + 2 * B) using operators and the add function respectively
*/
cla3p::dns::RdMatrix C1 = A + 2. * B;
std::cout << "C1:\n" << C1;
std::cout << "C2:\n" << C2 << "\n";
/*
* Perform the operation (Cx += 3 * A) using operators and the update function respectively
*/
C1 += 3. * A;
std::cout << "C1:\n" << C1;
cla3p::ops::update(3., B, C2);
std::cout << "C2:\n" << C2;
return 0;
}
void 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.
dns::XxVector< T_Scalar > 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.
XxMatrix< real_t > RdMatrix
Double precision real matrix.
Definition dense.hpp:55