casacore::MArray< T > Class Template Reference

Class to handle an Array with an optional mask. More...

#include <MArray.h>

Inheritance diagram for casacore::MArray< T >:
casacore::MArrayBase

List of all members.

Public Member Functions

 MArray ()
 Default constructor creates a null array.
 MArray (const Array< T > &array)
 Construct from an array without a mask.
 MArray (const Array< T > &array, const Array< Bool > &mask, Bool isNull=False)
 Construct from an array and a mask.
 MArray (const Array< T > &array, const MArrayBase &marray)
 Construct from an array with the mask and null from another MArray.
 MArray (const MArray< T > &array, const MArray< Bool > &mask)
 Construct from two MArrays, one the array, the other the mask.
void reference (const MArray< T > &other)
 Reference another array.
void resize (const IPosition &shape, Bool useMask)
 Resize the array and optionally the mask.
template<typename U >
void fill (const MArray< U > &from)
 Copy the array data and possible mask from another one.
template<typename U >
void fill (const Array< U > &from)
 Copy the array from a normal Array.
const Array< T > & array () const
 Get access to the array.
Array< T > & array ()
Vector< T > flatten () const
 Flatten the unmasked elements of the array to a vector.
size_t flatten (T *out, size_t size) const
 Copy the unmasked elements to the out.
MArray< T > operator() (const IPosition &start, const IPosition &end, const IPosition &stride)
 Get a subset of the array.

Private Attributes

Array< T > itsArray

Detailed Description

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

Class to handle an Array with an optional mask.

Intended use:

Internal

Review Status

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

Prerequisite

Synopsis

This class makes it easier to handle arrays with ot without mask. The array is always present, but the mask is optional. The mask is contained in the non-templated base class MArrayBase and functions to operate on the mask are defined there.
The class is primarily developed for TaQL masked arrays, but could be used elsewhere as well.

A mask value True means that the corresponding value is masked off, thus not taken into account in reduction functions like sum. This is the same as the numpy masked array.

MArrayMath.h contains many functions to operate on MArray objects (addition, sin, etc.).

Definition at line 69 of file MArray.h.


Constructor & Destructor Documentation

template<typename T>
casacore::MArray< T >::MArray (  )  [inline]

Default constructor creates a null array.

Definition at line 73 of file MArray.h.

template<typename T>
casacore::MArray< T >::MArray ( const Array< T > &  array  )  [inline, explicit]

Construct from an array without a mask.

It references the given array.

Definition at line 79 of file MArray.h.

template<typename T>
casacore::MArray< T >::MArray ( const Array< T > &  array,
const Array< Bool > &  mask,
Bool  isNull = False 
) [inline]

Construct from an array and a mask.

It references the given arrays. isNull=True requires the arrays to be empty.

Definition at line 89 of file MArray.h.

template<typename T>
casacore::MArray< T >::MArray ( const Array< T > &  array,
const MArrayBase marray 
) [inline]

Construct from an array with the mask and null from another MArray.

It references the given arrays. The shapes of both arrays must match.

Definition at line 97 of file MArray.h.

template<typename T>
casacore::MArray< T >::MArray ( const MArray< T > &  array,
const MArray< Bool > &  mask 
) [inline]

Construct from two MArrays, one the array, the other the mask.

If one of them is null, the constructed MArray is null.

Definition at line 104 of file MArray.h.


Member Function Documentation

template<typename T>
Array<T>& casacore::MArray< T >::array (  )  [inline]

Definition at line 155 of file MArray.h.

template<typename T>
const Array<T>& casacore::MArray< T >::array (  )  const [inline]

Get access to the array.

Definition at line 153 of file MArray.h.

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::abs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::acos(), casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::amplitude(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::asin(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::ceil(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::conj(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::cos(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::cosh(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::cube(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::exp(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fabs(), casacore::MArray< MVTime >::fill(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::floor(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile(), casacore::TableExprNode::get(), casacore::TableExprGroupAggr::getArray(), casacore::TableExprNode::getArrayBool(), casacore::TableExprNode::getArrayDate(), casacore::TableExprNode::getArrayDComplex(), casacore::TableExprNode::getArrayDouble(), casacore::TableExprNode::getArrayInt(), casacore::TableExprNode::getArrayString(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::imag(), casacore::MArrayLogical_global_functions_MArray_logical_operations::isFinite(), casacore::MArrayLogical_global_functions_MArray_logical_operations::isInf(), casacore::MArrayLogical_global_functions_MArray_logical_operations::isNaN(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::log(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::log10(), casacore::MArray< MVTime >::MArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::mean(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::median(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::near(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nfalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator%(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator&(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator&&(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator*(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator+(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator-(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator/(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator==(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator^(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator|(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator||(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator~(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::phase(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::product(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::real(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::round(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sign(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sin(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sinh(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sqrt(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::square(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sum(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::tan(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::tanh(), casacore::TableExprNodeSet::toArray(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().

template<typename T>
template<typename U >
void casacore::MArray< T >::fill ( const Array< U > &  from  )  [inline]

Copy the array from a normal Array.

The possible mask is removed. The shapes do not need to match. The array data is always copied.

Definition at line 144 of file MArray.h.

template<typename T>
template<typename U >
void casacore::MArray< T >::fill ( const MArray< U > &  from  )  [inline]

Copy the array data and possible mask from another one.

The shapes do not need to match. The array data is copied, but the new mask references the possible mask in from.

Definition at line 133 of file MArray.h.

template<typename T>
size_t casacore::MArray< T >::flatten ( T *  out,
size_t  size 
) const [inline]

Copy the unmasked elements to the out.

The argument size gives the size of the output buffer which should be at least the size of the array. It returns the nr of unmasked elements.

No mask, so copy all elements.

Copy only the valid elements.

Definition at line 193 of file MArray.h.

References casacore::Array< T >::begin(), casacore::Array< T >::cbegin(), casacore::ArrayBase::contiguousStorage(), casacore::MArrayBase::hasMask(), casacore::MArray< T >::itsArray, casacore::MArrayBase::mask(), casacore::SHARE, casacore::ArrayBase::size(), and casacore::String::toString().

template<typename T >
Vector< T > casacore::MArray< T >::flatten (  )  const [inline]

Flatten the unmasked elements of the array to a vector.

We lie about the size, because we know the buffer has the right size.

Definition at line 184 of file MArray.h.

References casacore::Array< T >::data(), casacore::MArray< T >::itsArray, and casacore::MArrayBase::nvalid().

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::median().

template<typename T>
MArray<T> casacore::MArray< T >::operator() ( const IPosition start,
const IPosition end,
const IPosition stride 
) [inline]

Get a subset of the array.

Definition at line 167 of file MArray.h.

template<typename T>
void casacore::MArray< T >::reference ( const MArray< T > &  other  )  [inline]

Reference another array.

Definition at line 114 of file MArray.h.

Referenced by casacore::TableExprNodeSet::getArray().

template<typename T>
void casacore::MArray< T >::resize ( const IPosition shape,
Bool  useMask 
) [inline]

Member Data Documentation

template<typename T>
Array<T> casacore::MArray< T >::itsArray [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1