|
Ublas : |
Subject: [ublas] bug in compressed_matrix with using a custom index size type
From: Ungermann, Jörn (j.ungermann_at_[hidden])
Date: 2011-04-11 14:39:50
Hi all,
as I mentioned last week, I am trying to migrate our compressed_matrices to using 32bit integer for the index array. I am going to use these types:
typedef ublas::compressed_matrix<
double, ublas::row_major, 0, ublas::unbounded_array<unsigned int>
> SparseMatrixRowDouble;
typedef ublas::compressed_matrix<
float, ublas::row_major, 0, ublas::unbounded_array<unsigned int>
> SparseMatrixRowFloat;
After the annoying problem with the LU decomposition, I noticed a severe bug in compressed_matrix affecting my use-case.
The private size1_, size2_, filled1_ and filled2_ variables are rightly of array_size_type, which is still size_t, that is 64bit in my case.
However, the nnz and reserve functions use size_type, which may be too small for large matrices.
I therefore propose to change the type of all functions handling the number of non-zero entries to array_size_type, as it will otherwise break if one has more than 2^32 non-zero entries.
The attached patch file does the trick for me and has no effect in case one does not change the index_array type.
Kind regards,
Joern
PS: If this is not the right list for this, please tell me. I had not much luck in getting changes into ublas, as there is still one performance-bug including fix of mine on the trac server (Ticket https://svn.boost.org/trac/boost/ticket/4024).
-- Joern Ungermann Dipl.-Mathematiker Institute for Energy and Climate Research - Stratosphere (IEK-7) Research Centre Juelich Telefon: +49 2461 61-6438 ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender), Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Besuchen Sie uns auf unserem neuen Webauftritt unter www.fz-juelich.de