CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
ex01j_dense_vector_algebra_add.cpp
#include <iostream>
#include <cla3p/dense.hpp>
#include <cla3p/algebra.hpp>
int main()
{
x = 3.;
y = 2.;
std::cout << "x:\n" << x;
std::cout << "y:\n" << y << "\n";
/*
* Perform the operation (x + 2 * y) using operators and the add function respectively
*/
cla3p::dns::RdVector z1 = x + 2. * y;
std::cout << "z1:\n" << z1;
std::cout << "z2:\n" << z2 << "\n";
/*
* Perform the operation (z1 += 3 * x) using operators and the update function respectively
*/
z1 += 3. * x;
std::cout << "z1:\n" << z1;
cla3p::ops::update(3., x, z2);
std::cout << "z2:\n" << z2;
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.
XxVector< real_t > RdVector
Double precision real vector.
Definition dense.hpp:31