I am trying to figure out a way of doing the following (initialize a
lower-triangular matrix P with 0's and fill the last row with 1's)
using iterators:
int n = 10;
boost::numeric::ublas::triangular_matrixP(n, n);
P = boost::numeric::ublas::zero_matrix<double>(n,n);
for (unsigned col = 0; col < n; ++col)
P(n, col) = 1.0;
I want to try and use std::fill, so something like
std::fill(P.begin1(), P.end() - (adjust pointer to not include the
last row), 0.0);
std::fill(P.begin2(), P.end2(), 1.0);
I can't seem to find any examples though on how to use iterators for
Boost lower triangular matrices. I know how to do this using STL
vector, that's easy, but I'm not sure how to adjust the iterator
pointer in this case.
Thanks in advance for your help.
Cheers,
Max