Vector objects are one-dimensional specializations (e.g., more convenient and efficient indexing) of the general Array class. You might also want to look at the Array documentation to see inherited functionality. A tutorial on using the array classes in general is available in the "AIPS++ Programming Manual".
Generally the member functions of Array are also available in Vector versions which take an integer where the array needs an IPosition. Since the Vector is one-dimensional, the IPositions are overkill, although you may use those versions if you want to.
Vector<Int> vi(100); // Vector 100 elements long. vi.resize(50); // Now only 50 long.
Slices may be taken with the Slice class. To take a slice, one "indexes" with Slice(start, length, inc) where end and inc are optional.
Vector<Float> vf(100); //... vf(Slice(0,50,2)) = vf(Slice(1,50,2)); // Copy values from odd onto even Vector<Float> firstHalf, secondHalf; firstHalf.reference(vf(Slice(0,50))); secondHalf.reference(vf(Slice(50,50))); // Now we have aliases for two slices into the Vector
Element-by-element arithmetic and logical operations are available (in aips/ArrayMath.h and aips/ArrayLogical.h) as well as dot and cross products (in aips/MatrixMath.h).
As with the Arrays, if the preprocessor symbol AIPS_DEBUG is defined at compile time invariants will be checked on entry to most member functions. Additionally, if AIPS_ARRAY_INDEX_CHECK is defined index operations will be bounds-checked. Neither of these should be defined for production code.
A Vector with a defined length and origin.
A Vector with a defined length and origin.
A Vector with a defined length and origin of zero.
Create a Vector from the given Block "other." Make it length "nr" and copy over that many elements.
Create a reference to other.
The copy constructor should normally be avoided. More details are available under the documentation for Array.
If "other" is of dimension one, create a reference to it. See the warning associated with the copy constructor.
Define a destructor, otherwise the (SUN) compiler makes a static one.
Create a reference to "other", which must be of dimension one.
Resize this Vector to the given length and use the given origin.
Resize this Vector to the given length and use the given origin.
Resize this Vector to the given length. Zero-origin.
Resize this Vector to the given length. Zero-origin.
Assign to this Vector. If this Vector is zero-length, then resize to be the same size as other. Otherwise this and other have to be conformant (same size but not necessarily same origin).
Other must be a 1-dimensional array.
Assign to this Vector. If this Vector is zero-length, then resize to be the same size as other. Otherwise this and other have to be conformant (same size but not necessarily same origin).
Set every element of this Vector to Val.
Copy to this those values in marray whose corresponding elements in marray's mask are True.
Single-pixel addressing. If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.
Single-pixel addressing. If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.
Single-pixel addressing. If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.
Single-pixel addressing. If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.
Take a slice of this vector. Slices are always indexed starting at zero. This uses reference semantics, i.e. changing a value in the slice changes the original.
Vector<Double> vd(100); //... vd(Slice(0,10)) = -1.0; // First 10 elements of vd set to -1
Slice using IPositions. Required to be defined because the base class versions are hidden.
Slice using IPositions. Required to be defined because the base class versions are hidden.
The array is masked by the input LogicalArray. This mask must conform to the array, but it does not need to have the same origin.
Return a MaskedArray.
The array is masked by the input LogicalArray. This mask must conform to the array, but it does not need to have the same origin.
The array is masked by the input ROMaskedLogicalArray. The mask is effectively the AND of the internal LogicalArray and the internal mask of the ROMaskedLogicalArray. The ROMaskedLogicalArray must conform to the array, but it does not need to have the same origin.
Return a MaskedArray.
The array is masked by the input ROMaskedLogicalArray. The mask is effectively the AND of the internal LogicalArray and the internal mask of the ROMaskedLogicalArray. The ROMaskedLogicalArray must conform to the array, but it does not need to have the same origin.
The position of the first element.
The position of the first element.
The length of the Vector.
The length of the Vector.
The position of the last element.
The position of the last element.
Verify that dimensionality is 1 and then call Array
Macro to define the typeinfo member functions
Copyright © 1995 Associated Universities Inc., Washington, D.C.rtti_dcl_mbrf_p1(Vector<T>, Array<T>)
void initVector(const Block<T> &, Int nr)
Helper functions for constructors.