|
Ublas : |
From: Jeronimo Pellegrini (pellegrini_at_[hidden])
Date: 2006-06-28 10:50:22
On Wed, Jun 28, 2006 at 04:41:25PM +0200, Gunter Winkler wrote:
> Hallo,
> On Wednesday 28 June 2006 14:11, Jeronimo Pellegrini wrote:
> > cmatrix<cvector<double> > m;
>
> > Also tried cvector<cvector<cvector<double> > >, and got similar
> > problems.
>
> such constructrions usually don't work because all ublas containers assume
> that they store "scalars". That means the elements to be stored must behave a
> a scalar. (e.g., a scalar must be constructible from zero: z = SCALAR(0))
> This is especially important for sparse types.
>
> I would suggest to try a std::map<int, compressed_matrix<...> > or std::map<
> std::pair<int, int>, compressed_vector<...> > for your purpose.
That's what I was using, but I thought I could get something cleaner
(and maybe with faster access than std::map).
> (You could even try std::map< boost::tuple<int, int, int>, double> ...)
That seems interesting.
> mfg
> Gunter
>
> PS: Do you really want to use a 3d data structure? Or do you just need a
> collection of 2d data?
It's a representation of a function with three arguments (the transition
probability function in a Markov Decision Process:
int x int x int -> double).
Thanks,
J.