Next: MV++ Classes
Previous: About MV++
MV++ provides two basic classes: a numerical vector (1-d array),
and column (Fortran) oriented dense matrix. Indexing is performed
via the operator(), as in A(i,j).
Subvectors and submatrices can be accessed through MV_VecIndex
classes. In other words,
B is the vector
then B(MV_VecIndex(1,5)) = 9.9 sets B to
and is equivalent to
for (i=1; i<=5; B[i++] = 9.9 )
- efficient indexing as fast as native C arrays
- supports only unit strides (for efficient indexing)
- copy-by-value semantics
- optional "share" semantics allows vectors to be constructed as
"views", or "references" of an existing memory, using
MV_Vector_::ref modifier in the constructor. (see note below.)
- vector views can assign and references sections of vector, but
cannot modify their size.
- block-range indexing via MV_VecIndex class (e.g. A(I) = B; )
(note for the above to work, A(I) must return a vector view.)
- optional range checking (compile switch)
- support for both  and () style indexing ( not available
- Unrolling of loops (depth=4) for copying and assigning vectors.
Thus on some machines, it may be faster
to execute A=scalar, than to manually assign a native C
array using an explicit for loop:
for (i=0; i<N; d[i++] = scalar);
- function code for the () and  operators has been
inlined into the class declaration, for compilers
that refuse to inline otherwise.
- optinal share semnatics.
To create a view of (or reference to) an existing MV++ matrix or
MV_Vector_double A( &d, n, MV_Vector_::ref );
This allows one to construct vectors as views of any contiguous C
array. It will not release the memory space when the vector
is destroyed or goes out of scope.
Tue Nov 7 18:40:56 EST 1995