casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::MArrayBase Class Reference

Base class for an array with an optional mask. More...

#include <MArrayBase.h>

Inheritance diagram for casacore::MArrayBase:
casacore::MArray< T > casacore::MArray< Bool > casacore::MArray< casacore::MVTime > casacore::MArray< casacore::String > casacore::MArray< DComplex > casacore::MArray< Double > casacore::MArray< Int64 >

Public Member Functions

Bool isNull () const
 Is the array null? More...
 
void removeMask ()
 Remove the mask. More...
 
Bool hasMask () const
 Is there a mask? More...
 
void setMask (const Array< Bool > &mask)
 Set the mask. More...
 
const Array< Bool > & mask () const
 Get the mask. More...
 
Array< Bool > & wmask ()
 
Int64 nvalid () const
 Return the number of valid array values, thus unflagged elements. More...
 
Bool empty () const
 Is the array empty? More...
 
uInt ndim () const
 Get the dimensionality. More...
 
const IPositionshape () const
 Get the shape. More...
 
size_t size () const
 Get the size. More...
 
size_t nelements () const
 
Array< BoolcombineMask (const MArrayBase &other) const
 Combine this and the other mask. More...
 

Protected Member Functions

 MArrayBase (Bool isNull)
 The default constructor creates an empty mask. More...
 
 MArrayBase (const ArrayBase &arr, const Array< Bool > &mask, Bool isNull)
 Construct from a given array shape and mask. More...
 
 MArrayBase (const ArrayBase &arr, const MArrayBase &marray)
 Construct from a given array shape and mask from another MArray. More...
 
void setBase (const ArrayBase &arr, const Array< Bool > &mask)
 Reference the mask and set the shape. More...
 
void referenceBase (const MArrayBase &other)
 Reference another MArray. More...
 
void resizeBase (const ArrayBase &arr, Bool useMask)
 Set the array shape and resize the mask. More...
 

Private Member Functions

void init ()
 Initialize and check. More...
 
void fillNValid () const
 Fill the number of valid values. More...
 

Private Attributes

Array< BoolitsMask
 
IPosition itsShape
 
size_t itsSize
 
Int64 itsNValid
 
Bool itsNull
 

Detailed Description

Base class for an array with an optional mask.

Intended use:

Internal

Review Status

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

Prerequisite

Synopsis

This class is the base class of the templated class MArray. It contains the functions that are not template dependent.

MArray is developed to make it easier to handle arrays with an optional mask. The array is always present, but the mask is optional. MArrayMath contains functions to operate on such arrays.

Similar to numpy.masked_array and the MeasurementSet FLAG definition, a mask value True means that the corresponding value is masked off, thus is not taken into account in reduction functions like sum. on a masked array. In operations like addition, masked off values are processed because testing the mask value is more expensive than an addition (even if the value is a NaN). For an operation with multiple operands, the mask of the result is the OR of the operand masks.

MArray can be null meaning that the array is a null value. It can be used to indicate that a table cell does not contain an array. A null MArray has an empty array and mask. Operations where an operand is a null MArray, result in a null MArray.

Definition at line 84 of file MArrayBase.h.

Constructor & Destructor Documentation

casacore::MArrayBase::MArrayBase ( Bool  isNull)
inlineexplicitprotected

The default constructor creates an empty mask.

Definition at line 88 of file MArrayBase.h.

casacore::MArrayBase::MArrayBase ( const ArrayBase arr,
const Array< Bool > &  mask,
Bool  isNull 
)
protected

Construct from a given array shape and mask.

casacore::MArrayBase::MArrayBase ( const ArrayBase arr,
const MArrayBase marray 
)
protected

Construct from a given array shape and mask from another MArray.

Member Function Documentation

Array<Bool> casacore::MArrayBase::combineMask ( const MArrayBase other) const

Combine this and the other mask.

One or both MArray-s can be unmasked.

Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), 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::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||(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow().

Bool casacore::MArrayBase::empty ( ) const
inline
void casacore::MArrayBase::fillNValid ( ) const
private

Fill the number of valid values.

Referenced by nvalid().

Bool casacore::MArrayBase::hasMask ( ) const
inline

Is there a mask?

Definition at line 119 of file MArrayBase.h.

References casacore::ArrayBase::empty(), and itsMask.

Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), 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::fractile(), casacore::TableExprGroupAggr::getArray(), 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::nfalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue(), casacore::MArray< casacore::String >::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::product(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), 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::sum(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr(), casacore::TableExprNodeSet::toArray(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().

void casacore::MArrayBase::init ( )
private

Initialize and check.

Bool casacore::MArrayBase::isNull ( ) const
inline

Is the array null?

Definition at line 111 of file MArrayBase.h.

References itsNull.

Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAnys(), 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::floormod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod(), casacore::TableExprGroupAggr::getArray(), casacore::MArray< casacore::String >::MArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), 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::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::MArrayLogical_global_functions_MArray_logical_operations::partialAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAnys(), 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::pow(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAnys(), 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(), and casacore::TableExprNodeSet::toArray().

const Array<Bool>& casacore::MArrayBase::mask ( ) const
inline

Get the mask.

The returned array is empty if there is no mask.

Definition at line 126 of file MArrayBase.h.

References itsMask.

Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::TableExprGroupAggr::getArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nfalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue(), casacore::MArray< casacore::String >::operator()(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::product(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sum(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr(), casacore::TableExprNodeSet::toArray(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().

uInt casacore::MArrayBase::ndim ( ) const
inline

Get the dimensionality.

Definition at line 143 of file MArrayBase.h.

References itsShape, and casacore::IPosition::size().

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

size_t casacore::MArrayBase::nelements ( ) const
inline
Int64 casacore::MArrayBase::nvalid ( ) const
inline
void casacore::MArrayBase::referenceBase ( const MArrayBase other)
protected

Reference another MArray.

Referenced by casacore::MArray< casacore::String >::reference().

void casacore::MArrayBase::removeMask ( )
inline

Remove the mask.

Definition at line 115 of file MArrayBase.h.

References itsMask, itsNValid, itsSize, and casacore::Array< T >::resize().

void casacore::MArrayBase::resizeBase ( const ArrayBase arr,
Bool  useMask 
)
protected
void casacore::MArrayBase::setBase ( const ArrayBase arr,
const Array< Bool > &  mask 
)
protected

Reference the mask and set the shape.

Referenced by casacore::MArray< casacore::String >::fill(), and casacore::MArray< casacore::String >::MArray().

void casacore::MArrayBase::setMask ( const Array< Bool > &  mask)
const IPosition& casacore::MArrayBase::shape ( ) const
inline
size_t casacore::MArrayBase::size ( ) const
inline
Array<Bool>& casacore::MArrayBase::wmask ( )
inline

Definition at line 128 of file MArrayBase.h.

References itsMask.

Member Data Documentation

Array<Bool> casacore::MArrayBase::itsMask
private

Definition at line 170 of file MArrayBase.h.

Referenced by hasMask(), mask(), removeMask(), and wmask().

Bool casacore::MArrayBase::itsNull
private

Definition at line 174 of file MArrayBase.h.

Referenced by isNull().

Int64 casacore::MArrayBase::itsNValid
mutableprivate

Definition at line 173 of file MArrayBase.h.

Referenced by nvalid(), and removeMask().

IPosition casacore::MArrayBase::itsShape
private

Definition at line 171 of file MArrayBase.h.

Referenced by ndim(), and shape().

size_t casacore::MArrayBase::itsSize
private

Definition at line 172 of file MArrayBase.h.

Referenced by empty(), nelements(), removeMask(), and size().


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