Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-10-03 07:10:57


Am Mittwoch, 3. Oktober 2007 12:37 schrieb Luis M. de la Cruz Salas:
> Hello everyone,
> I recently have begun to use uBlas in a project for solving PDEs.
> As many of the users of my code comes from Fortran, I wonder
> if in uBlas it is possible to construct Vectors and Matrices ranging
> from variable start and stop bounds. For example, it is possible
> to address the elements of a matrix A(N,N) from 1 to N?,
> or form -N/2 to N/2???

No, uBLAS always uses the default C style addressing from 0 to N-1. The
only exception is compressed_matrix where you can specify an index base
(IB) as a template parameter. However this only affects the numbers
stored in the index_array - the adressing is still zero based. You can
look at the k_based() and zero_based() function inside the source code
to have an example how an arbitrary index base can be implemented.
However you should keep in mind that the default type for indices is
std::size_t which may cause trouble if you try to use negative values.

mfg
Gunter