|
Ublas : |
Subject: Re: [ublas] Create a matrix with the same layout of another matrix
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-07-07 17:57:18
On Wed, Jul 7, 2010 at 3:32 PM, Nasos Iliopoulos <nasos_i_at_[hidden]> wrote:
> Hi Marco,
>
> I think uBlas' traits system needs some refinement (or should I say
> extension?) and I would be very happy to see such changes make it in. The
> layout_type traits you provide are probably the most important ones though.
> Nevertheless I think that we should offer a complete design rather than a
> few trait classes here and there, so that a solid interface is achieved.
> Maybe a good start would be the ublas part of the bindings traits (if those
> are complete would the authors be interested to merge them into uBlas?).
>
> Having a more complete traits mechanism would allow as to scale well in
> complex operations and especially in multi-methods and dispatching kind of
> stuff.
>
Hi Nasos,
I agree with you.
The problem I actually see is that "bindings" are still in "beta"
status, that is they reside in sandbox.
Meanwhile we wait for the release of "bindings" (I hope very soon! :)
), a possible temporary solution might be to allow uBLAS users to
access to the layout type of a matrix through matrix_traits by using a
"layout_type"-like solution.
In particular, one may define the layout_type class in the "detail"
namespace, so that users are warned to not use it in production code.
For instance:
--- [code snip] ---
// file traits.hpp
namespace detail {
template <typename T> layout_type;
//...
} // Namespace detail
//...
template <typename MATRIX>
struct matrix_view_traits : container_view_traits <MATRIX> {
typedef typename detail::layout_type<MATRIX>::type layout_type;
}
--- [/code snip] ---
What do you think?
Cheers,
-- Marco