|
Boost Users : |
Subject: [Boost-users] std::fill with boost::numeric::ublas::triangular_matrix
From: Max S. Kaznady (max.kaznady_at_[hidden])
Date: 2010-07-30 20:28:46
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_matrix<double, lower>P(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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net