CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
ex06k_sparse_matrix_algebra_scale.cpp
#include <iostream>
#include <cla3p/sparse.hpp>
#include <cla3p/algebra.hpp>
int main()
{
Acoo.insert(0,0,1.0);
Acoo.insert(1,1,2.0);
Acoo.insert(2,1,3.0);
Acoo.insert(1,3,4.0);
Acoo.insert(0,0,5.0);
std::cout << "A:\n" << A << "\n";
/*
* Scale A using operators and the scale function respectively
*/
A *= 2.;
std::cout << "A *= 2:\n" << A << "\n";
A.iscale(.5);
std::cout << "A.iscale(.5):\n" << A << "\n";
cla3p::csc::RdMatrix B = 2. * A ;
std::cout << "B:\n" << B << "\n";
return 0;
}
csc::XxMatrix< T_Int, T_Scalar > toCsc(dup_t duplicatePolicy=dup_t::Sum) const
Convert to compressed sparse column (CSC) format.
void insert(const Tuple< T_Int, T_Scalar > &tuple)
Insert a non-zero element using a tuple.
void iscale(T_Scalar val)
Scale the sparse matrix in-place.
XxMatrix< int_t, real_t > RdMatrix
Double precision real COO (Coordinate) matrix.
Definition sparse.hpp:111
XxMatrix< int_t, real_t > RdMatrix
Double precision real CSC (Compressed Sparse Column) matrix.
Definition sparse.hpp:73