|
| Matrix () |
| A Matrix of length zero in each dimension; zero origin. More...
|
|
| Matrix (size_t l1, size_t l2) |
| A Matrix with "l1" rows and "l2" columns. More...
|
|
| Matrix (size_t l1, size_t l2, ArrayInitPolicy initPolicy) |
| A Matrix with "l1" rows and "l2" columns. More...
|
|
| Matrix (size_t l1, size_t l2, const T &initialValue) |
| A Matrix with "l1" rows and "l2" columns. More...
|
|
| Matrix (const IPosition &len) |
| A matrix of shape with shape "len". More...
|
|
| Matrix (const IPosition &len, ArrayInitPolicy initPolicy) |
| A matrix of shape with shape "len". More...
|
|
| Matrix (const IPosition &len, const T &initialValue) |
| A matrix of shape with shape "len". More...
|
|
| Matrix (const Matrix< T > &other) |
| The copy constructor uses reference semantics. More...
|
|
| Matrix (const Array< T > &other) |
| Construct a Matrix by reference from "other". More...
|
|
| Matrix (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY) |
| Create an Matrix of a given shape from a pointer. More...
|
|
| Matrix (const IPosition &shape, T *storage, StorageInitPolicy policy, AbstractAllocator< T > const &allocator) |
| Create an Matrix of a given shape from a pointer. More...
|
|
| Matrix (const IPosition &shape, const T *storage) |
| Create an Matrix of a given shape from a pointer. More...
|
|
virtual | ~Matrix () |
| Define a destructor, otherwise the (SUN) compiler makes a static one. More...
|
|
virtual void | assign (const Array< T > &other) |
| Assign the other array (which must be dimension 2) to this matrix. More...
|
|
virtual void | reference (const Array< T > &other) |
| Make this matrix a reference to other. More...
|
|
void | resize (size_t nx, size_t ny, Bool copyValues=False) |
|
void | resize (size_t nx, size_t ny, Bool copyValues, ArrayInitPolicy policy) |
|
virtual void | resize () |
|
virtual void | resize (const IPosition &newShape, Bool copyValues, ArrayInitPolicy policy) |
|
Matrix< T > & | operator= (const Matrix< T > &other) |
| Copy the values from other to this Matrix. More...
|
|
virtual Array< T > & | operator= (const Array< T > &other) |
|
Array< T > & | operator= (const T &val) |
| Copy val into every element of this Matrix; i.e. More...
|
|
Matrix< T > & | operator= (const MaskedArray< T > &marray) |
| Copy to this those values in marray whose corresponding elements in marray's mask are True. More...
|
|
T & | operator() (const IPosition &i) |
| Single-pixel addressing. More...
|
|
const T & | operator() (const IPosition &i) const |
|
T & | operator() (size_t i1, size_t i2) |
|
const T & | operator() (size_t i1, size_t i2) const |
|
MaskedArray< T > | operator() (const LogicalArray &mask) const |
| The array is masked by the input LogicalArray. More...
|
|
MaskedArray< T > | operator() (const LogicalArray &mask) |
| Return a MaskedArray. More...
|
|
MaskedArray< T > | operator() (const MaskedLogicalArray &mask) const |
| The array is masked by the input MaskedLogicalArray. More...
|
|
MaskedArray< T > | operator() (const MaskedLogicalArray &mask) |
| Return a MaskedArray. More...
|
|
Vector< T > | row (size_t i) |
| Returns a reference to the i'th row. More...
|
|
const Vector< T > | row (size_t i) const |
|
Vector< T > | column (size_t j) |
| Returns a reference to the j'th column. More...
|
|
const Vector< T > | column (size_t j) const |
|
Vector< T > | diagonal (Int64 n=0) |
| Returns a diagonal from the Matrix. More...
|
|
const Vector< T > | diagonal (Int64 n=0) const |
|
Matrix< T > | operator() (const Slice &sliceX, const Slice &sliceY) |
| Take a slice of this matrix. More...
|
|
const Matrix< T > | operator() (const Slice &sliceX, const Slice &sliceY) const |
|
Array< T > | operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr) |
| Slice using IPositions. More...
|
|
const Array< T > | operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr) const |
|
Array< T > | operator() (const IPosition &blc, const IPosition &trc) |
|
const Array< T > | operator() (const IPosition &blc, const IPosition &trc) const |
|
Array< T > | operator() (const Slicer &slicer) |
|
const Array< T > | operator() (const Slicer &slicer) const |
|
const IPosition & | shape () const |
| The length of each axis of the Matrix. More...
|
|
void | shape (Int &s1, Int &s2) const |
|
size_t | nrow () const |
| The number of rows in the Matrix, i.e. More...
|
|
size_t | ncolumn () const |
| The number of columns in the Matrix, i.e. More...
|
|
virtual Bool | ok () const |
| Checks that the Matrix is consistent (invariants check out). More...
|
|
template<class T>
class casacore::Matrix< T >
A 2-D Specialization of the Array class.
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Matrix objects are two-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 Matrix versions which take a pair of integers where the array needs an IPosition. Since the Matrix is two-dimensional, the IPositions are overkill, although you may use those versions if you want to.
Matrix<Int> mi(100,100);
mi.resize(50,50);
Slices may be taken with the Slice class. To take a slice, one "indexes" with one Slice(start, length, inc) for each axis, where end and inc are optional. Additionally, there are row(), column() and diagonal() member functions which return Vector's which refer to the storage back in the Matrix:
Matrix<Float> mf(100, 100);
mf.diagonal() = 1;
Correct indexing order of a matrix is:
Matrix<Int> mi(n1,n2)
for (
uInt j=0; j<mi.ncolumn(); j++) {
for (
uInt i=0; i<mi.nrow(); i++) {
mi(i,j) = i*j;
}
}
Element-by-element arithmetic and logical operations are available (in aips/ArrayMath.h and aips/ArrayLogical.h). Other Matrix operations (e.g. LU decomposition) are available, and more appear periodically.
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.
Definition at line 50 of file Array.h.