Subject: Re: [ublas] Numeric traits for ublas bounded_vector and matrix
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-02-23 03:21:38
Jesse Perla wrote:
> Rutger ter Borg <rutger <at> terborg.net> writes:
>> E.g., result_of::size< double >::type will be an mpl::int_<10>.
> Can you explain the rationale behind the result_of:: style with
> metafunctions? I have seen it in a few places and don't understand it.
It's usually used when there is both a compile-time and a run-time version
of the same function, to make it a bit easier to figure out the result type
of the function call. I.e., it's a replacement for 'auto' in this case. Also
see the result_of in boost.utility.
> Another few useful ones I had to write that I can't find in the bindings
> are: is_vector<ublas::vector<double>> == true
> is_vector<ublas::bounded_vector<double, 3>> == true
> is_vector<ublas::vector_range<ublas::vector<double>>> == true
would has_rank be appropriate in this case? It's has_rank<T,N> for type T
and rank N.
has_rank< ublas::vector<double>, 1 > == true_
has_rank< ublas::matrix<double>, 2 > == true_
we don't provide is_matrix etc. because it's misleading in our case: a
vector may be interpreted as a matrix.
> Last, I haven't needed it yet but eventually will: Consider numeric
> traits for
> boost::multi_array of dimension 1 and 2 as vectors and matrices. I know
> that a lot of people need interoperability of multi_array, ublas, and
> lapack, and this might be a cheap way to get it.
Ok. A first draft would help, though :-).
> BTW, I think the numeric bindings may be close for inclusion into boost.
> I am not sure that the LAPACK, etc. ones belong there, but no question
> in my mind that the numeric traits do.
Thanks. To answer with a question: what's the STL without algorithms?