Boost logo

Ublas :

Subject: Re: [ublas] size_type for mapped_matrix
From: Ungermann, Jörn (j.ungermann_at_[hidden])
Date: 2011-04-13 13:19:48


Hi,

I think you are right in your observation that mapped_matrix is not consistent there.

Do you really have a sparse matrix with more than 2^32 non-zero entries? That would imply that you have about one third of non-zeros. I am not sure that a sparse approach is then still the most efficient one.

However, I'd use coordinate_matrix for construction, as inserting elements is *much* cheaper than for mapped_matrix, especially if you have more than 2^32 entries.

ublas::coordinate_matrix<double, ublas::row_major, 0, ublas::unbounded_array<long unsigned int, MyAllocator>
> MyTypeName;

You still have the problem then that unbounded_array uses size_t internally to manage the memory, which will probably a problem for you? The only way around *that* is writing your own allocator (MyAllocator above), as std::allocator also uses size_t.

And the same is then true for any kind of matrix-vector product you might want to do, which should not be carried through with either mapped/coordinate_matrix but only with compressed_matrix.

It might be simpler to switch to a 64 bit platform that uses a 64 bit type for size_t anyway, if you such large datasets.

Regards,
Jörn Ungermann

> -----Original Message-----
> From: ublas-bounces_at_[hidden] [mailto:ublas-
> bounces_at_[hidden]] On Behalf Of Alex Hagen-Zanker
> Sent: Mittwoch, 13. April 2011 11:08
> To: ublas_at_[hidden]
> Subject: [ublas] size_type for mapped_matrix
>
> Dear All,
>
> I am using a mapped_matrix as a sparse matrix for a matrix with
> dimensions 120 000 * 120 000. As this exceeds the limits of size_t I
> thought to step away from the default template parameters and use:
>
> mapped_matrix<double, row_major, map_std<long long, double> >
> myMatrix
>
> This does not solve my problem as the mapped_matrix::size_type is still
> size_t. Looking at the ublas source code I see that
> mapped_matrix::size_type boils down to std::map<long long,
> double>::size_type.
>
> It seems to me that this should be std::map<long long,
> double>::key_type
> instead.
>
> Is this a bug, or am I expecting too much?
>
> Can I use one of the other sparse matrix types instead?
>
> Thanks, Alex
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: j.ungermann_at_[hidden]

------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
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