|
Ublas : |
From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2004-12-30 03:17:10
Kresimir Fresl wrote:
>
> Hi Dmitri,
>
>> Umfpack "symbolic" driver function (in C) accept an " int " for
>> matrix sizes and " int* " for indexes array.
>> (Strictly speaking, it should have been 'unsigned' and 'unsigned*',
>> if I don't miss some point.)
>
>
>> As I understand, ublas matrix methods do some 'unsigned' comparisons
>> to check sizes inside the code. This causes g++ to issue warning
>> messages like this:
>> "Warning : comparison of signed vs. unsigned.",
>> even when compiling the basic examples from umfpack bindings
>> documentation.
>
>
> Yes, size_type in ublas vectors and matrices is unsigned (as in standard
> library).
>
> On the other hand, umfpack functions expect that index arrays are arrays
> of int's. As Mr. Davis replied, unsigned int's are not often used in C.
> (And, if I correctly remember, there were some discussions in C++
> newgroups whether size_type in standard library, which is also index
> type in std::vector, should be int or unsigned. ;o)
>
> As the introductory example in umfpack bindings documentation shows,
> matrix type should be
>
> ublas::compressed_matrix<double, ublas::column_major, 0,
> ublas::unbounded_array<int>, ublas::unbounded_array<double> >
>
> Fourth template argument is index array type.
>
> Probably we should state explicitly (not just in the example) that
> index array must be array of int's, and not unsigned's which is
> default type in ublas.
This is the right way to do things, but the warnings remain.
With ublas_pure, my old superlu codes do no longer compile (I reported
this a while ago and suggested a fix, although it is not very clean
either). I think that the concept of size_type should be revisited: the
size_type of the sparse matrix is not necessarily the same as the
size_type of the index_array_type and value_array_type. As far as I can
see, no distinction is currently made.
Karl