--- In [email protected], "Sheri" <[EMAIL PROTECTED]> wrote:
>
> Hi Bruce,
> 
> Suppose you have a 1d vector where all the elements are in the 
proper
> order for viewing as a 2d vector once you know the number of rows 
and
> columns. Is there some way to re-purpose the existing vector as a 2d
> vector? I'm trying to avoid duplicating the contents by copying over
> each element into a new vector just to load it into 2d.

A 1d vector is stored internally as a contiguous list of pointers to 
strings.

If your 1d vector is represents a 2d vector arranged by rows, with 
ncol columns, then you can access element i, j with v[j*ncol +i].   
You cannot use v[i,j] once the vector is declared as 1d as PowerPro 
needs to know the number of rows when the vector is declared.

Vectors of vectors are supported as v[i][j] but are something 
different.  You have to declare each v[i] using vec.create.  The 
vector v is a list of pointers to handles to vectors. 

2D vectors, on the other hand, are a contiguous list of pointers to 
the vector elements.  PowerPro knows the number of columnsso it can 
figure out where v[i,j] is in the list.

Note that you _can_ reference a 2d vector as a 1d vector.  But is has 
to be declared as 2d first.

The bottom line is that the number of columns in a  vector to be 
referenced by 2d [i,j] is fixed at declaration and cannot be changed 
later.

Reply via email to