[Insight-users] vnl_vector class

Bjorn Hanch Sollie bhs at pvv . org
Sun, 1 Sep 2002 19:15:08 +0200 (CEST)


Hi all!

I'm currently trying to use the vnl_vector class to automatically
create a vector containing a variable number of vectors of variable
length (based on input data).  Since I'm having some problems with
this, I'd appreciate some advice on how to do it, if possible.

For example, if I specify that I want a vector with 3 elements,
containing 3 vectors of length 2, 3 and 4 respectively, I would like
my program to initialize this automatically.  The problem seems to be
that all the vectors have names, and keeping track of all the names of
the "sub-vectors" seems to be a rather cumbersome task, plus my
program would have to generate those names in some way.

While it is possible to use the vnl_matrix class to this end, I'd
rather not, because one of the vectors will often tend to be very
large, and there are often a lot of smaller vectors; thus such a
(sparse) matrix would waste a lot of memory (in the order of tens of
megabytes in my application).

If doing this with the vnl_vector class is nontrivial, can anyone
please give me any hints about memory-preserving alternatives?

Thanks in advance!

-Bjorn
-- 
The History of the Universe
Chapter 1: Bang!  Chapter 2: Sss...  Chapter 3: Crunch!
The End