Loading...
Searching...
No Matches
casacore::MatrixIterator< T > Class Template Reference
casa package (libcasa_casa) » Arrays_module

More...

`#include <MatrixIter.h>`

## Public Member Functions

| MatrixIterator (Array< T > &a)
| Iterate by matrices through array "a".
| MatrixIterator (Array< T > &a, size_t cursorAxis1, size_t cursorAxis2)
| Iterate by matrices through array "a".
Matrix< T > & | matrix ()
| Return the matrix at the current position.
Public Member Functions inherited from casacore::ArrayIterator< T >
| ArrayIterator (const Array< T > &arr, size_t byDim=1)
| Step through array "arr" over the first byDim axes (using a cursor of dimensionality "byDim").
| ArrayIterator (const Array< T > &arr, const IPosition &axes, bool axesAreCursor=true)
| Step through an array using the given axes.
virtual void | next () override
| Move the cursor to the next position.
virtual void | set (const IPosition &cursorPos) override
| Set the cursor to the given position.
virtual void | reset () override
| Reset the cursor to the beginning.
Array< T > & | array ()
| Return the cursor.
virtual ArrayBase & | getArray () override
| Get the array in the cursor.
Public Member Functions inherited from casacore::ArrayPositionIterator
| ArrayPositionIterator (const IPosition &shape, const IPosition &origin, size_t byDim)
| Define the shape and origin of the volume the cursor will step through.
| ArrayPositionIterator (const IPosition &shape, size_t byDim)
| ArrayPositionIterator (const IPosition &shape, const IPosition &axes, bool axesAreCursor=true)
| Step through an array using the given axes.
virtual | ~ArrayPositionIterator ()
void | origin ()
bool | atStart () const
| Returns true of the cursor is at the origin.
bool | pastEnd () const
| Returns true if the cursor has moved past the end of its volume.
const IPosition & | pos () const
| Return the position of the cursor.
IPosition | endPos () const
| Return the end position of the cursor.
size_t | ndim () const
| What is the dimensionality of the volume we are iterating through?
const IPosition & | iterAxes () const
| Return the iteration axes.
const IPosition & | cursorAxes () const
| Return the cursor axes.

## Private Member Functions

| MatrixIterator (const MatrixIterator< T > &)=delete
| Not implemented.
MatrixIterator< T > & | operator= (const MatrixIterator< T > &)=delete
| Not implemented.

## Additional Inherited Members

Protected Member Functions inherited from casacore::ArrayPositionIterator
size_t | nextStep ()
| Advance cursor to its next position and tell which dimension stepped.
size_t | dimIter () const
| What is the dimensionality of the "step" the cursor takes, i.e.
Protected Attributes inherited from casacore::ArrayIterator< T >
std::unique_ptr< Array< T > > | ap_p
| The cursor.

## Detailed Description

template<typename T>
class casacore::MatrixIterator< T >

Iterate a Matrix cursor through another Array.

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

MatrixIterator steps a Matrix (the "cursor") through an array. The cursor "refers" to storage in the array, so that changing the values in the cursor changes values in the original array.

This class is derived from ArrayIterator; basically it only adds the matrix() member function which allows you to access the cursor as a Matrix.

Tip: The origin of the cursor, i;e; the subarray that moves through the larger array, is always zero;

In this example we want to make a "moment" map of a cube, i.e. collapse the "Z" axis by averaging it.

Cube<float> cube;
MatrixIterator planeIter(cube);
Matrix<float> average(planeIter.matrix().copy()); // init with first plane
planeIter.next(); // advance the iterator
while (! planeIter.pastEnd()) {
average += planeIter.matrix(); // Sum the next plane
planeIter.next();
}
average /= float(cube.shape()(2)); // divide by the number of planes
casacore::Cube
Definition Cube.h:72
casacore::MatrixIterator::MatrixIterator
MatrixIterator(Array< T > &a)
Iterate by matrices through array "a".
casacore::Matrix
Definition Matrix.h:87
casacore::cube
TableExprNode cube(const TableExprNode &node)
Definition ExprNode.h:1355

Definition at line 66 of file MatrixIter.h.

## Constructor & Destructor Documentation

## MatrixIterator() [1/3]

template<typename T>

casacore::MatrixIterator< T >::MatrixIterator | ( | Array< T > & | a | ) |

explicit

Iterate by matrices through array "a".

The first 2 axes form the cursor axes.

Referenced by MatrixIterator(), and operator=().

## MatrixIterator() [2/3]

template<typename T>

casacore::MatrixIterator< T >::MatrixIterator | ( | Array< T > & | a,
|  | size_t | cursorAxis1,
|  | size_t | cursorAxis2 )

Iterate by matrices through array "a".

The given axes form the cursor axes.

## MatrixIterator() [3/3]

template<typename T>

casacore::MatrixIterator< T >::MatrixIterator | ( | const MatrixIterator< T > & |  | ) |

private delete

Not implemented.

References MatrixIterator().

## Member Function Documentation

## matrix()

template<typename T>

Matrix< T > & casacore::MatrixIterator< T >::matrix | ( |  | ) |

inline

Return the matrix at the current position.

Definition at line 78 of file MatrixIter.h.

References casacore::ArrayIterator< T >::ap_p.

## operator=()

template<typename T>

MatrixIterator< T > & casacore::MatrixIterator< T >::operator= | ( | const MatrixIterator< T > & |  | ) |

private delete

Not implemented.

References MatrixIterator().

The documentation for this class was generated from the following file:

- casa/Arrays/MatrixIter.h