Boost logo

Ublas :

Subject: Re: [ublas] Accessing the indices of non-zero elements in a UBLAS sparse vector
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2011-09-24 02:50:14


Hi,

for(mapped_iterator<double>::iterator v = vector.begin(); v !=
vector.end(); ++v){
    std::cout<<v.index()<<" "<<*v<std::endl;
}

>
>
> On 23/09/11 11:53, Oswin Krause wrote:
>> Hi,
>>
>> maybe i have to correct myself, my information seems to be outdated.
>>
>> the source code for mapped_vector::iterator states:
>>
>> BOOST_UBLAS_INLINE
>> iterator&operator ++ () {
>> ++ it_;
>> return *this;
>> }
>> BOOST_UBLAS_INLINE
>> reference operator * () const {
>> BOOST_UBLAS_CHECK (index ()< (*this) ().size (), bad_index ());
>> return (*it_).second;
>> }
>>
>> So it should work out of the box without the index workaround. Sorry for
>> the inconvenience caused...finally i can beatify some of my own code :)
>> (after i have checked whether this is also true for the sparse matrices.
>> unfortunately, THAT code is a mess).
>
> What does "out of the box" mean here? Can you give a line of code?
>
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: Oswin.Krause_at_[hidden]
>