Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-06-28 10:41:25


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. Of course you
have to write your own linear algebra routines. Maybe there is already a
"tensor"-library out there on the web ...

(You could even try std::map< boost::tuple<int, int, int>, double> ...)

mfg
Gunter

PS: Do you really want to use a 3d data structure? Or do you just need a
collection of 2d data?