casacore
|
A module implementing multidimensional arrays and operations. More...
Modules | |
Arrays_module_internal_classes | |
Internal Arrays_module classes and functions. | |
Classes | |
class | casacore::Array< T, Alloc > |
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses. More... | |
class | casacore::ArrayAccessor< T, U > |
Fast 1D accessor/iterator for nD array classes. More... | |
class | casacore::ArrayAccessor< T, AxisN > |
Specialization for run-time axes. More... | |
class | casacore::ArrayBase |
Non-templated base class for templated Array class. More... | |
class | casacore::ArrayError |
The base class for all Array exception classes. More... | |
class | casacore::ArrayIndexError |
An error thrown when an index is out of range. More... | |
class | casacore::ArrayConformanceError |
An error thrown when two arrays do not conform. More... | |
class | casacore::ArrayNDimError |
Thrown when two arrays have different dimensionality. More... | |
class | casacore::ArrayShapeError |
An error thrown when two arrays have different shapes. More... | |
class | casacore::ArrayIteratorError |
An error thrown by an ArrayIterator. More... | |
class | casacore::ArraySlicerError |
An error thrown by an Slicer member function. More... | |
class | casacore::ArrayIterator< T, Alloc > |
Iterate an Array cursor through another Array. More... | |
class | casacore::ReadOnlyArrayIterator< T, Alloc > |
Iterate a const Array cursor through a const Array. More... | |
struct | casacore::ArrayLogical_global_functions_Array_logical_operations |
Logical operations for Arrays. More... | |
struct | casacore::ArrayMath_global_functions_Array_mathematical_operations |
Mathematical operations for Arrays. More... | |
class | casacore::ArrayFunctorBase< T, RES > |
Basic class for math on Array objects. More... | |
struct | casacore::ArrayOpsDiffShapes_global_functions_OpsDiff_functions |
Operations for 2 Arrays with possibly different shapes. More... | |
struct | casacore::ArrayPartMath_global_functions_Array_partial_operations |
Mathematical and logical operations for Array parts. More... | |
class | casacore::ArrayPositionIterator |
Iterate an IPosition through the shape of an Array. More... | |
struct | casacore::ArrayUtil_global_functions_stringToVector |
Split a std::string into its elements. More... | |
struct | casacore::ArrayUtil_global_functions_concatenateArray |
Concatenate two Arrays. More... | |
struct | casacore::ArrayUtil_global_functions_partialFuncHelper |
Helper function for partialX functions. More... | |
struct | casacore::ArrayUtil_global_functions_reverseArray |
Reverse the order of one or more axes of an array. More... | |
struct | casacore::ArrayUtil_global_functions_reorderArray |
Reorder the axes of an array. More... | |
class | casacore::AxesSpecifier |
Specification of axes to keep or remove. More... | |
class | casacore::Cube< T, Alloc > |
A 3-D Specialization of the Array class. More... | |
class | casacore::IPosition |
A Vector of integers, for indexing into Array<T> objects. More... | |
struct | casacore::IPosition_global_functions_IPosition_Arithmetic |
Arithmetic Operations for IPosition's Element by element arithmetic on IPositions. More... | |
struct | casacore::IPosition_global_functions_IPosition_Logical |
Logical operations for IPosition's Element by element boolean operations on IPositions. More... | |
struct | casacore::IPosition_global_functions_IPosition_Indexing |
Indexing functions for IPosition's Convert between IPosition and offset in an array. More... | |
struct | casacore::LogiArray_global_functions_LogicalArray |
Logical valued Arrays. More... | |
struct | casacore::LogiCube_global_functions_LogicalCube |
Logical valued Cubes. More... | |
struct | casacore::LogiMatrix_global_functions_LogicalMatrix |
Logical valued Matrices. More... | |
struct | casacore::LogiVector_global_functions_LogicalVector |
Logical valued Vectors. More... | |
struct | casacore::MaskArrIO_global_functions_MaskedArray_IO |
Ascii input/output operations for MaskedArrays. More... | |
struct | casacore::MaskArrLogi_global_functions_MaskedArray_logical_operations |
Logical operations for MaskedArrays, and between MaskedArrays and Arrays. More... | |
struct | casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations |
Mathematical operations for MaskedArrays (and with Arrays) More... | |
class | casacore::MaskedArray< T, ArrayAlloc, MaskAlloc > |
Class for masking an Array for operations on that Array. More... | |
struct | casacore::MaskedArray_global_functions_MaskedArray_general_global_functions |
General global functions for MaskedArrays, and MaskedArrays and Arrays. More... | |
struct | casacore::MaskLogiArr_global_functions_MaskedLogicalArray |
Masked LogicalArrays. More... | |
struct | casacore::MaskLogiArrFwd_global_functions_MaskedLogicalArray_forwards |
Forward declarations for MaskedLogicalArrays. More... | |
class | casacore::Matrix< T, Alloc > |
A 2-D Specialization of the Array class. More... | |
class | casacore::MatrixIterator< T, Alloc > |
Iterate a Matrix cursor through another Array. More... | |
class | casacore::ReadOnlyMatrixIterator< T > |
Iterate a Matrix cursor through a R/O Array. More... | |
struct | casacore::MatrixMath_global_functions_Linear_Algebra |
Linear algebra functions on Vectors and Matrices. More... | |
class | casacore::Slice |
define a (start,length,increment) along an axis More... | |
class | casacore::Slicer |
Specify which elements to extract from an n-dimensional array. More... | |
struct | casacore::Slicer_global_functions_Slicer_IO |
IO functions for Slicer's. More... | |
class | casacore::Vector< T, Alloc > |
A 1-D Specialization of the Array class. More... | |
class | casacore::VectorIterator< T, Alloc > |
Iterate an Vector cursor through another Array. More... | |
class | casacore::ReadOnlyVectorIterator< T, Alloc > |
Iterate a Vector cursor through another Array. More... | |
class | casacore::VectorSTLIterator< T, Alloc > |
Casacore Vector iterator. More... | |
Enumerations | |
enum | casacore::StorageInitPolicy { casacore::COPY, casacore::TAKE_OVER, casacore::SHARE } |
A global enum used by some Array constructors. More... | |
size_t | casacore::ArrayVolume (size_t Ndim, const int *Shape) |
General global functions for Arrays. More... | |
size_t | casacore::ArrayIndexOffset (size_t Ndim, const ssize_t *Shape, const ssize_t *Origin, const ssize_t *Inc, const IPosition &Index) |
What is the linear index into an "Ndim" dimensional array of the given "Shape", "Origin", and "Increment" for a given IPosition Index. More... | |
size_t | casacore::ArrayIndexOffset (size_t Ndim, const ssize_t *Shape, const ssize_t *Inc, const IPosition &Index) |
void | casacore::throwArrayShapes (const IPosition &shape1, const IPosition &shape2, const char *name) |
Function to check the shapes. More... | |
void | casacore::checkArrayShapes (const ArrayBase &left, const ArrayBase &right, const char *name) |
A module implementing multidimensional arrays and operations.
See below for an overview of the classes in this module.
This module provides classes and global functions for multidimensional arrays.
Arrays have traditionally played an important role in scientific computation. While it is certainly true that some of the reliance on arrays was due to the paucity of other data structures in FORTRAN, it is also true that computation on arrays reflects the common occurrence of regularly sampled multi-dimensioned data in science.
The Lattices are a generalization of Arrays. They can handle memory- and disk-based arrays as well as other types of arrays (eg. expressions).
The module consists of various parts:
Array is the basic array class. It is only templated on data type, not on dimensionality like the array classes in Blitz and boost. It has a non-templated base class ArrayBase.
Vector, Matrix, and Cube are the one, two, and three dimensional specializations respectively of Array.
MaskedArray is the class used to mask an Array for operations on that Array.
ArrayError is the base class for all Array exception classes.
There are several ways o iterate through an array:
Mathematical, logical, chunked mathematical and logical, IO, and other useful operations are provided for Arrays and MaskedArrays.
ArrayMath also defines various STL-style transform functions that use the Array iterators and functors like Plus to apply the mathematical and logical operations. They can, however, also be used directly on arrays of different types making it possible to, say, add a Complex and double array with a DComplex result.
It also has a transformInPlace
to avoid needless incrementing of iterators which have to be done when using std::transform
for in-place operations.
The IPosition class name is a concatenation of "Integer Position." IPosition objects are normally used to index into, and define the shapes of, Arrays and Lattices. For example, if you have a 5-dimensional array, you need an IPosition of length 5 to index into the array (or to define its shape, etc.). It is essentially a vector of integers. The IPosition vector may point to the "top right corner" of some shape, or it may be an indicator of a specific position in n-space. The interpretation is context dependent. The constructor consists of an initial argument which specifies the number of axes, followed by the appropriate number of respective axis lengths. Thus the constructor needs N+1 arguments for an IPosition of length N. IPositions have the standard integer math relationships defined. The dimensionality of the operator arguments must be the same.
The Slicer class name may be thought of as a short form of "n-Dimensional Slice Specifier." This object is used to bundle into one place all the information necessary to specify a regular subregion within an Array or Lattice. In other words, Slicer holds the location of a "slice" of a greater whole. Construction is with up to 3 IPositions: the start location of the subspace within the greater space; the shape or end location of the subspace within the greater space; and the stride, or multiplier to be used for each axis. The stride gives the user the chance to use every i-th piece of data, rather than every position on the axis.
It is possible to leave some values in the given start or end/length unspecified. Such unspecified values default to the boundaries of the array to which the slicer will be applied. It is also possible to use a non-zero origin when applying the slicer to an array.
The detailed discussions for the classes and global functions will describe how to use them.
A global enum used by some Array constructors.
StorageInitPolicy is used in functions where an array is formed from a shape and an ordinary pointer. This enum should be in Array but that causes gcc to be unhappy.
Enumerator | |
---|---|
COPY |
COPY is used when an internal copy of the storage is to be made. The array is NOT responsible for deleting the external storage. |
TAKE_OVER |
TAKE_OVER is used to indicate that the Array should just use the external storage (i.e., no copy is made). The Array class is now responsible for deleting the storage (hence it must have come from a call to new[]). |
SHARE |
Share means that the Array will just use the pointer (no copy), however the Array will NOT delete it upon destruction. |
Definition at line 51 of file ArrayBase.h.
size_t casacore::ArrayIndexOffset | ( | size_t | Ndim, |
const ssize_t * | Shape, | ||
const ssize_t * | Origin, | ||
const ssize_t * | Inc, | ||
const IPosition & | Index | ||
) |
size_t casacore::ArrayIndexOffset | ( | size_t | Ndim, |
const ssize_t * | Shape, | ||
const ssize_t * | Inc, | ||
const IPosition & | Index | ||
) |
size_t casacore::ArrayVolume | ( | size_t | Ndim, |
const int * | Shape | ||
) |
General global functions for Arrays.
These are generally useful global functions which operate on all Arrays.
What is the volume of an N-dimensional array. Shape[0]*Shape[1]*...*Shape[N-1]. An Array helper function.
|
inline |
Definition at line 325 of file ArrayBase.h.
References casacore::IPosition::isEqual(), casacore::ArrayBase::shape(), and casacore::throwArrayShapes().
Referenced by casacore::ArrayMath_global_functions_Array_mathematical_operations::operator*(), casacore::ArrayMath_global_functions_Array_mathematical_operations::operator*=(), casacore::ArrayMath_global_functions_Array_mathematical_operations::operator/(), and casacore::ArrayMath_global_functions_Array_mathematical_operations::operator/=().
void casacore::throwArrayShapes | ( | const IPosition & | shape1, |
const IPosition & | shape2, | ||
const char * | name | ||
) |
Function to check the shapes.
It throws an exception if not equal.
Referenced by casacore::checkArrayShapes().