|
Ublas : |
Subject: Re: [ublas] Numeric traits for ublas bounded_vector and matrix
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-02-19 02:01:19
Jesse Perla wrote:
> I have started to use the numeric traits for some of my
> own meta-programming and ended up with the need for detection of the
> value_type for bounded_matrix and bounded_vector.
Hello Jesse,
I guess you didn't check out for a while? bounded_matrix and bounded_vector
have been in svn for a couple of weeks now.
> Here are modified
> traits files for consideration:
I see you implemented strides for the bounded_matrix, which is not necessary
for stuff known at compile time.
> Also, I ended up needing meta-functions to get the static sizes for
> bounded_matrices and vectors, but I am not happy with my solution. Should
> these be added to the numeric traits?
bounded_matrices do not have static sizes, they have static strides -- or is
this what you mean?
> Maybe add a tag to the property_map? Something like
> tag::static_vector_size
> which is a boost::mpl::size_t ? And if the vector is dynamic, the value
> would be -1 or NaN or something that could be tested at compile time? My
> guess is that there are a lot of optimizations people would want to do
> given statically sized numeric types.
Thanks for the advertisement for the bindings :-) -- what's used in the
property maps for sizes is just one key type, tag::size_type<N>. The
possible value types for sizes and strides are mpl::int_<> for static sizes,
and std::ptrdiff_t for dynamic sizes. Only if dynamic, the static functions
are called for the run-time values. Otherwise, everything that can be done
at compile time, is done at compile time.
E.g., result_of::size< double[10] >::type will be an mpl::int_<10>.
If you end up using traits-related stuff other than that available directly
under bindings/, please drop us a message.
Cheers,
Rutger