Boost logo

Ublas :

Subject: [ublas] Can you get a row reference when iterators over rows of a ublas::matrix?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-07-08 18:36:08


Hi there,
I think I may be misunderstood or misusing the begin1(), etc. on a matrix.

Certainly, the following pattern works:
    for(auto iter = A.begin1(); iter < A.end1(); ++iter) //Goes through
rows.
        for(auto iter2 = iter.begin(); iter2 < iter.end(); ++iter2) //Goes
through the columns in the row
            cout << *iter2 << " "; //Display the value of that column

But when you dereference iter in this example, it doesn't return a
ublas::matrix_row or anything similar. Is this possible or do I need to do
an std::copy to get it into a vector_expression compatible object?

-Jesse