Boost logo

Ublas :

Subject: Re: [ublas] Numeric traits for ublas bounded_vector and matrix
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-02-23 07:53:40


Rutger ter Borg <rutger <at> terborg.net> writes:
> Could be, they both have static strides (result_of::stride<
> ublas::vector<double>::type is mpl::int_<1> (or, tag::contiguous)).

Ignoring my glaring misuse of ublas....
While all of the stride information is useful, I still think it is necessary to
have information on the sizes of the static allocations used by the vector/matrix

This is the main reason I am using these metafunctions. My classes have huge
numbers of small vectors/matrices which would likely kill performance and
prevent loop unrolling if I didn't have information on the static sizes. In
the end, I also do a runtime assertion that they have the correct size().

Among other reasons, it allows you to properly allocate static temporaries if
they are available from the vector type rather than being forced to use
heap allocated ones.