CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
ex02j_dense_matrix_column_operations.cpp
#include <iostream>
#include <cla3p/dense.hpp>
int main()
{
for(cla3p::uint_t j = 0, icnt = 0; j < 5; j++)
for(cla3p::uint_t i = 0; i < 5; i++)
A(i,j) = icnt++;
std::cout << "A:\n" << A << "\n";
/*
* Get a copy of column 1 of A as a vector.
* Get a shallow copy of column 3 of A as a vector.
*/
std::cout << "Xc:\n" << Xc;
std::cout << "Xr:\n" << Xr;
/*
* Get a guarded shallow copy of column 3 of Aref as a vector.
*/
const cla3p::dns::RdMatrix& Aref = A;
std::cout << "Xg:\n" << Xg.get() << "\n";
/*
* Change values in columns.
*/
Xr = -1;
std::cout << "A:\n" << A;
/*
* Set values of Xc to A, at column 2.
*/
Xc = -2;
A.rcolumn(2) = Xc;
std::cout << "A:\n" << A;
return 0;
}
Immutable object wrapper.
Definition guard.hpp:37
const T_Object & get() const
Retrieves the guarded object.
Definition guard.hpp:96
XxVector< T_Scalar > rcolumn(int_t j)
Extract a column as a reference.
XxVector< T_Scalar > column(int_t j) const
Extract a column as a new vector.
XxMatrix< real_t > RdMatrix
Double precision real matrix.
Definition dense.hpp:55
XxVector< real_t > RdVector
Double precision real vector.
Definition dense.hpp:31