Neal Becker wrote:
Either I completely misunderstand something, or zero_vector is seriously broken:
#include
#include <iostream> #include <iterator> #include <algorithm> using namespace std; namespace ublas = boost::numeric::ublas;
int main() { ublas::zero_vector<double> zeros (10); copy (zeros.begin(), zeros.end(), ostream_iterator<double> (cout, " ")); }
I expect this to print 10 '0'. Instead, it prints nothing.
This would be best posted to the uBlas mailing list, but it looks as though zero_vector<> is a lightweight object that doesn't actually store anything: if you ask for a value it'll return a const reference to a static data member that stores the "zero". Even so I would have expected it's iterators to "do the right thing" and iterate over .size() zeros. HTH, John.