casa
$Rev:20696$
|
Iterate a Matrix cursor through another Array. More...
#include <MatrixIter.h>
Public Member Functions | |
MatrixIterator (Array< T > &a) | |
Iterate by matrices through array "a". | |
MatrixIterator (Array< T > &a, uInt cursorAxis1, uInt cursorAxis2) | |
Iterate by matrices through array "a". | |
Matrix< T > & | matrix () |
Return the matrix at the current position. | |
Private Member Functions | |
MatrixIterator (const MatrixIterator< T > &) | |
Not implemented. | |
MatrixIterator< T > & | operator= (const MatrixIterator< T > &) |
Not implemented. |
Iterate a Matrix cursor through another Array.
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. <br><strong>Tip:</strong><em> The origin of the cursor, i;e; the subarray that moves through the larger array, is always zero; </em><br> 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
Definition at line 69 of file MatrixIter.h.
casa::MatrixIterator< T >::MatrixIterator | ( | Array< T > & | a | ) | [explicit] |
Iterate by matrices through array "a".
The first 2 axes form the cursor axes.
casa::MatrixIterator< T >::MatrixIterator | ( | Array< T > & | a, |
uInt | cursorAxis1, | ||
uInt | cursorAxis2 | ||
) |
Iterate by matrices through array "a".
The given axes form the cursor axes.
casa::MatrixIterator< T >::MatrixIterator | ( | const MatrixIterator< T > & | ) | [private] |
Not implemented.
Matrix<T>& casa::MatrixIterator< T >::matrix | ( | ) | [inline] |
Return the matrix at the current position.
Definition at line 81 of file MatrixIter.h.
References casa::ArrayIterator< T >::ap_p.
MatrixIterator<T>& casa::MatrixIterator< T >::operator= | ( | const MatrixIterator< T > & | ) | [private] |
Not implemented.