|
Ublas : |
Subject: Re: [ublas] numeric bindings
From: Andreas Hehn (hehn_at_[hidden])
Date: 2010-10-29 06:07:19
Hi!
On 10/26/2010 07:57 PM, Rutger ter Borg wrote:
> The property_map should tell the bindings all it can about your matrix
> class using key-value property entries. This is compile-time stuff. The
> run-time stuff is in the accessor functions, which is accessed by the
> bindings routines to gather pointers and sizes and stuff (but only if it
> isn't defined by the compile-time stuff already, like static sizes).
>
> For examples of these adaptors, see, e.g., std/vector or ublas/matrix.
>
> Hope this helps, if you have further questions, please don't hesitate to
> ask.
Thank you very much, I got the adaptor working for my matrix class now.
I have a small problem though:
My matrix class uses std::size_t for the number of rows and columns. If
I give the adaptor the information
struct adaptor<...>{
typedef std::size_t size_type;
mpl::map<
...
mpl::pair< tag::size_type<1>, size_type >
mpl::pair< tag::size_type<2>, size_type >
... > property_map;
static size_type size1(const Id& id)
{
return id.size1();
}
static size_type size2(const Id& id)
{
return id.size2();
}
...
}
the parameters n,m,k reported to the actual blas function call (e.g.
DGEMM) are all 0. If however I change the typedef to
typedef std::ptrdiff_t size_type;
everything works just fine. But this doesn't really represent the size
type of my matrix type.
The same also happens for the stride() functions.
What's the right way to go?
Regards,
Andreas