Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-06-30 07:14:25

On Friday 30 June 2006 12:04, Vadim Zborovskii wrote:

> uBlas documentation claims that base index is supported for sparse
> vectors and matrices. Is there similar mechanism for dense vectors and
> matrices?

AFAIK there is no index base for dense types. Only coordinate_vector/matrix
and compressed_vector/matrix support an arbitrary index base. One could
easily implement similar behavior for dense types but no one really needed
this. You can simulate a different index base by always using the below
functions when you directly use indices.

IB ... index base
    static size_type zero_based (size_type k_based_index) {
        return k_based_index - IB;
    static size_type k_based (size_type zero_based_index) {
        return zero_based_index + IB;