Boost logo

Ublas :

Subject: Re: [ublas] How to understand the meanings of the member function index1() and index2() in the iterator of compressed_matrix
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-11-12 09:32:13


On 2010-11-12 14:56, 魏华祎 wrote:
> Hi, everyone,
>
>
> Please tell me how to understand the meaning of the return value
> of the following function members in iterators class of
> compressed_matrix class:
>
> ublas::compressed_matrix<double, ublas::row_major> ::iterator1.index1();
> ublas::compressed_matrix<double, ublas::row_major> ::iterator1.index2();
>
> ublas::compressed_matrix<double, ublas::row_major> ::iterator2.index1();
> ublas::compressed_matrix<double, ublas::row_major> ::iterator2.index2();
>
> I can't make sure about it. Then if replace the ublas::row_major by
> ublas::column_major?
>
> Thanks!
>
>
> Huayi
>

Hello Huayi,

everything with number N represents the N-th coordinate of the index of
the object. In numeric_bindings, we called this number the "addressing
index".

So, iterator1 will iterate over the first coordinate of a matrix, i.e.,
its rows. Irrespective of the data order of the matrix. I guess the
.index1 and .index2 will give you the actual coordinate values of the
entry you are visiting.

Hope this helps,

Rutger