
Ublas : 
Subject: [ublas] bounded_vector redundant storage of size. (is this a bug?)
From: johanngoetz (jgoetz_at_[hidden])
Date: 20081024 11:09:16
for small vectors (geometry vectors is what I have in mind) the
bounded_vector and bounded_matrix look promising. Indeed, if I was only
dealing with a handful of vectors at a time, this would be ideal. However, I
am creating a fieldmap (of a magnetic field, say) which maps 3D vectors
(position) to 3D vectors (the field). The likely size of this map is around
a million points. This should correspond to 6 million numbers stored.
However, if I have something like:
std::map<
ublas::bounded_vector<int, 3>,
ublas::bounded_vector<float, 3> >
Then the size is actually 8 million numbers stored since I am storing the
size of each of the bounded_vectors. While access time to the map is still
very fast, I find that reading in or creating such maps takes much more time
than should be required.
It seems to me that the advantage of having the size as a template parameter
is: not needing to store it as a member variable. Therefore I would like to
say this is a bug (do I have agreement?). Unfortunately, the only solution
for ublas::bounded_vector I can think of would be a complete
reimplementation of ublas::vector just with the size as a template parameter
instead of a member variable. but maybe I don't know enough to suggest the
proper way to handle such situations.
Of course the same applies to ublas::bounded_matrix but the effect there is
not as big and it is hard to imagine offhand a huge array of matrices.
 Johann
 View this message in context: http://www.nabble.com/Helpwithemergingstandardsfortinyvectormatrixlibrariestp19495502p20151927.html Sent from the Boost  uBLAS mailing list archive at Nabble.com.