Loading...
Searching...
No Matches
MArrayLogical.h
Go to the documentation of this file.
//# MArrayLogical.h: Logical operations on MArray objects
//# Copyright (C) 2012
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef CASA_MARRAYLOGICAL_H
#define CASA_MARRAYLOGICAL_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/tables/TaQL/MArrayMathBase.h>
#include <casacore/casa/Arrays/ArrayLogical.h>
#include <casacore/casa/Arrays/ArrayPartMath.h>
#include <casacore/casa/BasicMath/Functors.h>
namespace casacore {
// <summary>
// Logical operations for MArray objects.
// </summary>
//
// <reviewed reviewer="UNKNOWN" date="" tests="tMArrayMath">
//
// <prerequisite>
// <li> <linkto class=MArray>MArray</linkto>
// </prerequisite>
//
// <synopsis>
// These functions perform element by element logical operations on
// optionally masked arrays and/or scalars.
// If two arrays are used, the arrays must conform, except for allEQ which
// returns False if the arrays do not conform.
//
// The functions in this file can be divided in 3 groups:
// <ul>
// <li> Full array operations like ==, near, etc.
// They are defined for array-array and array-scalar operations. Arrays
// shapes have to be conformant. They operate on all elements
// (also the masked ones). The result is an MArray with the same
// shape as the input array(s). It will have a mask if one of the
// operands has a mask. If both operands have a mask, the resulting
// mask is the OR of both masks.
// <li> Full reduction functions like ntrue, all, allEQ, etc.
// They operate on the unmasked elements only. If there are no unmasked
// elements, the results is 0 or True.
// <li> Reduction functions working on unmasked elements in parts of the
// input array. The result is an MArray that has a mask if the input
// array has a mask. An output element is masked off if its input
// part has no unmasked elements.
// The functors defined at the beginning of this file are used to
// operate on each part.
// There are 3 flavours:
// <ul>
// <li> partialXXX reduces one or more axes. E.g. one can count the
// number of True elements for particular array axes.
// The result is an array with a lower dimensionality.
// They can be seen as a special versions of the boxedXXX functions.
// <li> slidingXXX operates in a sliding window over the array. So the
// result is an array with the same shape as the input, although
// the output array is smaller if the edge is not filled.
// <li> boxedXXX divides the input array in boxes with the given size
// and operates on each box. The result is an array with the same
// dimensionality, but with a smaller size.
// If the box size does not fit integrally, the edge box is smaller.
// </ul>
// </ul>
// </synopsis>
//
// <group name="MArray logical operations">
// Define functors to perform a reduction function on an MArray object.
// <group>
template<typename T, typename RES=size_t>
class MNTrueFunc : public MArrayFunctorBase<T,RES> {
public:
virtual ~MNTrueFunc() {}
RES operator() (const MArray<T>& arr) const { return ntrue(arr); }
};
template<typename T, typename RES=size_t>
class MNFalseFunc : public MArrayFunctorBase<T,RES> {
public:
virtual ~MNFalseFunc() {}
RES operator() (const MArray<T>& arr) const { return nfalse(arr); }
};
template<typename T> class MAllFunc : public MArrayFunctorBase<T,Bool> {
public:
virtual ~MAllFunc() {}
Bool operator() (const MArray<T>& arr) const { return allTrue(arr); }
};
template<typename T> class MAnyFunc : public MArrayFunctorBase<T,Bool> {
public:
virtual ~MAnyFunc() {}
Bool operator() (const MArray<T>& arr) const { return anyTrue(arr); }
};
// </group>
// Define comparison functions between 2 MArray objects and
// between MArray object and scalar.
// <group>
template<typename T>
MArray<Bool> operator== (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() == right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator<= (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() <= right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator< (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() < right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator>= (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() >= right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator> (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() > right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator!= (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() != right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator|| (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() || right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator&& (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (left.array() && right.array(),
left.combineMask(right))); }
template<typename T>
MArray<Bool> operator== (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() == right, left); }
template<typename T>
MArray<Bool> operator<= (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() <= right, left); }
template<typename T>
MArray<Bool> operator< (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() < right, left); }
template<typename T>
MArray<Bool> operator>= (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() >= right, left); }
template<typename T>
MArray<Bool> operator> (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() > right, left); }
template<typename T>
MArray<Bool> operator!= (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() != right, left); }
template<typename T>
MArray<Bool> operator|| (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() || right, left); }
template<typename T>
MArray<Bool> operator&& (const MArray<T>& left, const T& right)
{ return MArray<Bool> (left.array() && right, left); }
template<typename T>
MArray<Bool> operator== (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left == right.array(), right); }
template<typename T>
MArray<Bool> operator<= (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left <= right.array(), right); }
template<typename T>
MArray<Bool> operator< (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left < right.array(), right); }
template<typename T>
MArray<Bool> operator>= (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left >= right.array(), right); }
template<typename T>
MArray<Bool> operator> (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left > right.array(), right); }
template<typename T>
MArray<Bool> operator!= (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left != right.array(), right); }
// </group>
// The logical OR of 2 MArray objects (normally Bool type)
template<typename T>
MArray<Bool> operator|| (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left || right.array(), right); }
// The logical AND of 2 MArray objects (normally Bool type).
template<typename T>
MArray<Bool> operator&& (const T& left, const MArray<T>& right)
{ return MArray<Bool> (left && right.array(), right); }
// The logical NOT of an MArray object (normally Bool type).
template<typename T>
MArray<Bool> operator! (const MArray<T>& a)
{ return MArray<Bool> (!a.array(), a); }
// Compare with a given relative or absolute tolerance.
// <group>
template<typename T>
MArray<Bool> near (const MArray<T>& left, const MArray<T>& right,
Double tol)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (near(left.array(), right.array(), tol),
left.combineMask(right))); }
template<typename T>
MArray<Bool> nearAbs (const MArray<T>& left, const MArray<T>& right,
Double tol)
{ return (left.isNull() || right.isNull() ? MArray<Bool>() :
MArray<Bool> (nearAbs(left.array(), right.array(), tol),
left.combineMask(right))); }
template<typename T>
MArray<Bool> near (const MArray<T>& left, const T& right,
Double tol)
{ return MArray<Bool> (near(left.array(), right, tol), left); }
template<typename T>
MArray<Bool> nearAbs (const MArray<T>& left, const T& right,
Double tol)
{ return MArray<Bool> (nearAbs(left.array(), right, tol), left); }
template<typename T>
MArray<Bool> near (const T& left, const MArray<T>& right,
Double tol)
{ return MArray<Bool> (near(left, right.array(), tol), right); }
template<typename T>
MArray<Bool> nearAbs (const T& left, const MArray<T>& right,
Double tol)
{ return MArray<Bool> (nearAbs(left, right.array(), tol), right); }
// </group>
// Test which elements are NaN.
template<typename T>
MArray<Bool> isNaN (const MArray<T>& arr)
{ return MArray<Bool> (isNaN(arr.array()), arr); }
// Test which elements are infinite.
template<typename T>
MArray<Bool> isInf (const MArray<T>& arr)
{ return MArray<Bool> (isInf(arr.array()), arr); }
// Test which elements have a finite value.
template<typename T>
MArray<Bool> isFinite (const MArray<T>& arr)
{ return MArray<Bool> (isFinite(arr.array()), arr); }
// Are all unmasked elements equal?
// The result is True if there are no unmasked elements.
// <group>
template <typename T>
Bool allEQ (const MArray<T>& left, const MArray<T>& right)
{ if (left.isNull() || right.isNull()) {
return False;
} else if (left.hasMask()) {
if (right.hasMask()) {
return compareAllMasked (left.array().begin(), left.array().end(),
right.array.begin(), left.mask().begin(),
right.mask().begin(), std::equal_to<T>());
} else {
return compareAllMasked (left.array().begin(), left.array().end(),
right.array.begin(), left.mask().begin(),
std::equal_to<T>());
}
} else if (right.hasMask()) {
return compareAllMasked (left.array().begin(), left.array().end(),
right.array.begin(), right.mask().begin(),
std::equal_to<T>());
}
return allEQ (left.array(), right.array());
}
template <typename T>
Bool allEQ (const MArray<T>& array, const T& value)
{ return array.isNull() ? False :
array.hasMask() ?
compareAllRightMasked (array.array().begin(), array.array().end(),
value, array.mask().begin(), std::equal_to<T>())
: allEQ (array.array(), value);
}
template <typename T>
inline Bool allEQ (const T& value, const MArray<T>& array)
{ return allEQ (array, value); }
// </group>
// Is any unmasked element equal?
// The result is False if there are no unmasked elements.
// <group>
template <typename T>
Bool anyEQ (const MArray<T>& left, const MArray<T>& right)
{ if (left.isNull() || right.isNull()) {
return False;
} else if (left.hasMask()) {
if (right.hasMask()) {
return compareAnyMasked (left.array().begin(), left.array().end(),
right.array.begin(), left.mask().begin(),
right.mask().begin(), std::equal_to<T>());
} else {
return compareAnyMasked (left.array().begin(), left.array().end(),
right.array.begin(), left.mask().begin(),
std::equal_to<T>());
}
} else if (right.hasMask()) {
return compareAnyMasked (left.array().begin(), left.array().end(),
right.array.begin(), right.mask().begin(),
std::equal_to<T>());
}
return anyEQ (left.array(), right.array());
}
template <typename T>
Bool anyEQ (const MArray<T>& array, const T& value)
{ return array.isNull() ? False :
array.hasMask() ?
compareAnyRightMasked (array.array().begin(), array.array().end(),
value, array.mask().begin(), std::equal_to<T>())
: anyEQ (array.array(), value);
}
template <typename T>
inline Bool anyEQ (const T& value, const MArray<T>& array)
{ return anyEQ (array, value); }
// </group>
// Are all unmasked elements true?
inline Bool allTrue (const MArray<Bool>& array)
{ return allEQ (array, True); }
// Is any unmasked element true?
inline Bool anyTrue (const MArray<Bool>& array)
{ return anyEQ (array, True); }
// Count the number of unmasked elements that are True.
template<typename T>
size_t ntrue(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
countNEMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T()) :
countNEMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T());
}
return ntrue(a.array());
}
// Count the number of unmasked elements that are False.
template<typename T>
size_t nfalse(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
countMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T()) :
countMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T());
}
return nfalse(a.array());
}
// Get partial ntrues.
template<typename T>
MArray<size_t> partialNTrue (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<size_t>();
} else if (! a.hasMask()) {
return MArray<size_t>(partialNTrue (a.array(), collapseAxes));
}
MArray<size_t> res;
partialArrayMath (res, a, collapseAxes, MNTrueFunc<T,size_t>());
return res;
}
// Get partial nfalses.
template<typename T>
MArray<size_t> partialNFalse (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<size_t>();
} else if (! a.hasMask()) {
return MArray<size_t>(partialNFalse (a.array(), collapseAxes));
}
MArray<size_t> res;
partialArrayMath (res, a, collapseAxes, MNFalseFunc<T,size_t>());
return res;
}
// Get partial all.
template<typename T>
MArray<Bool> partialAlls (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
partialArrayMath (res, a.array(), collapseAxes, AllFunc<T>());
return MArray<Bool>(res);
}
MArray<Bool> res;
partialArrayMath (res, a, collapseAxes, MAllFunc<T>());
return res;
}
// Get partial any.
template<typename T>
MArray<Bool> partialAnys (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
partialArrayMath (res, a.array(), collapseAxes, AnyFunc<T>());
return MArray<Bool>(res);
}
MArray<Bool> res;
partialArrayMath (res, a, collapseAxes, MAnyFunc<T>());
return res;
}
// Get sliding ntrues.
template<typename T>
MArray<uInt> slidingNTrue (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<uInt>();
} else if (! a.hasMask()) {
Array<uInt> res;
slidingArrayMath (res, a.array(), halfBoxSize,
NTrueFunc<T,uInt>(), fillEdge);
return MArray<uInt>(res);
}
MArray<uInt> res;
slidingArrayMath (res, a, halfBoxSize, MNTrueFunc<T,uInt>(), fillEdge);
return res;
}
// Get sliding nfalses.
template<typename T>
MArray<uInt> slidingNFalse (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<uInt>();
} else if (! a.hasMask()) {
Array<uInt> res;
slidingArrayMath (res, a.array(), halfBoxSize,
NFalseFunc<T,uInt>(), fillEdge);
return MArray<uInt>(res);
}
MArray<uInt> res;
slidingArrayMath (res, a, halfBoxSize, MNFalseFunc<T,uInt>(), fillEdge);
return res;
}
// Get sliding all.
template<typename T>
MArray<Bool> slidingAlls (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
slidingArrayMath (res, a.array(), halfBoxSize, AllFunc<T>(), fillEdge);
return MArray<Bool>(res);
}
MArray<Bool> res;
slidingArrayMath (res, a, halfBoxSize, MAllFunc<T>(), fillEdge);
return res;
}
// Get sliding any.
template<typename T>
MArray<Bool> slidingAnys (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
slidingArrayMath (res, a.array(), halfBoxSize, AnyFunc<T>(), fillEdge);
return MArray<Bool>(res);
}
MArray<Bool> res;
slidingArrayMath (res, a, halfBoxSize, MAnyFunc<T>(), fillEdge);
return res;
}
// Get boxed ntrues.
template<typename T>
MArray<uInt> boxedNTrue (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<uInt>();
} else if (! a.hasMask()) {
Array<uInt> res;
boxedArrayMath (res, a.array(), boxSize, NTrueFunc<T,uInt>());
return MArray<uInt>(res);
}
MArray<uInt> res;
boxedArrayMath (res, a, boxSize, MNTrueFunc<T,uInt>());
return res;
}
// Get boxed nfalses.
template<typename T>
MArray<uInt> boxedNFalse (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<uInt>();
} else if (! a.hasMask()) {
Array<uInt> res;
boxedArrayMath (res, a.array(), boxSize, NFalseFunc<T,uInt>());
return MArray<uInt>(res);
}
MArray<uInt> res;
boxedArrayMath (res, a, boxSize, MNFalseFunc<T,uInt>());
return res;
}
// Get boxed all.
template<typename T>
MArray<Bool> boxedAlls (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
boxedArrayMath (res, a.array(), boxSize, AllFunc<T>());
return MArray<Bool>(res);
}
MArray<Bool> res;
boxedArrayMath (res, a, boxSize, MAllFunc<T>());
return res;
}
// Get boxed any.
template<typename T>
MArray<Bool> boxedAnys (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<Bool>();
} else if (! a.hasMask()) {
Array<Bool> res;
boxedArrayMath (res, a.array(), boxSize, AnyFunc<T>());
return MArray<Bool>(res);
}
MArray<Bool> res;
boxedArrayMath (res, a, boxSize, MAnyFunc<T>());
return res;
}
// </group>
} //# end namespace
#endif
casacore::AllFunc
Logical functor to test if all elements are true.
Definition ArrayLogical.h:432
casacore::AnyFunc
Logical functor to test if any elements are true.
Definition ArrayLogical.h:438
casacore::ArrayBase::contiguousStorage
bool contiguousStorage() const
Are the array data contiguous?
Definition ArrayBase.h:114
casacore::Array
Definition Array.h:155
casacore::Array::begin
iterator begin()
Get the begin iterator object for any array.
Definition Array.h:844
casacore::Array::cbegin
contiter cbegin()
Get the begin iterator object for a contiguous array.
Definition Array.h:856
casacore::IPosition
Definition IPosition.h:117
casacore::MArrayBase::combineMask
Array< Bool > combineMask(const MArrayBase &other) const
Combine this and the other mask.
casacore::MArrayBase::isNull
Bool isNull() const
Is the array null?
Definition MArrayBase.h:109
casacore::MArrayBase::mask
const Array< Bool > & mask() const
Get the mask.
Definition MArrayBase.h:124
casacore::MArrayBase::hasMask
Bool hasMask() const
Is there a mask?
Definition MArrayBase.h:117
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAllFunc
Definition MArrayLogical.h:106
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAllFunc::operator()
Bool operator()(const MArray< T > &arr) const
Definition MArrayLogical.h:109
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAllFunc::~MAllFunc
virtual ~MAllFunc()
Definition MArrayLogical.h:108
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAnyFunc
Definition MArrayLogical.h:111
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAnyFunc::~MAnyFunc
virtual ~MAnyFunc()
Definition MArrayLogical.h:113
casacore::MArrayLogical_global_functions_MArray_logical_operations::MAnyFunc::operator()
Bool operator()(const MArray< T > &arr) const
Definition MArrayLogical.h:114
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNFalseFunc
Definition MArrayLogical.h:101
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNFalseFunc::~MNFalseFunc
virtual ~MNFalseFunc()
Definition MArrayLogical.h:103
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNFalseFunc::operator()
RES operator()(const MArray< T > &arr) const
Definition MArrayLogical.h:104
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNTrueFunc
Define functors to perform a reduction function on an MArray object.
Definition MArrayLogical.h:95
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNTrueFunc::operator()
RES operator()(const MArray< T > &arr) const
Definition MArrayLogical.h:98
casacore::MArrayLogical_global_functions_MArray_logical_operations::MNTrueFunc::~MNTrueFunc
virtual ~MNTrueFunc()
Definition MArrayLogical.h:97
casacore::MArray
Definition MArray.h:68
casacore::MArray::array
const Array< T > & array() const
Get access to the array.
Definition MArray.h:151
casacore::NFalseFunc
Logical functor to count the number of false elements.
Definition ArrayLogical.h:452
casacore::NTrueFunc
Logical functor to count the number of true elements.
Definition ArrayLogical.h:445
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::operator<=
Bool operator<=(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:468
casacore::False
const Bool False
Definition aipstype.h:42
casacore::isNaN
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
casacore::operator&&
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
casacore::boxedArrayMath
MaskedArray< T > boxedArrayMath(const MaskedArray< T > &array, const IPosition &boxSize, const FuncType &funcObj)
Apply the given ArrayMath reduction function objects to each box in the array.
casacore::isFinite
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
Definition ExprNode.h:1634
casacore::nearAbs
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1254
casacore::array
TYPE * array
the allocated array
Definition hdu.h:491
casacore::isInf
TableExprNode isInf(const TableExprNode &node)
Definition ExprNode.h:1630
casacore::operator==
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:122
casacore::operator!=
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:128
casacore::operator<
Bool operator<(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:466
casacore::ntrue
LatticeExprNode ntrue(const LatticeExprNode &expr)
casacore::anyEQ
Bool anyEQ(const TableVector< T > &l, const TableVector< T > &r)
Definition TabVecLogic.h:166
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::operator>=
Bool operator>=(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:472
casacore::operator>
Bool operator>(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:470
casacore::operator!
LatticeExprNode operator!(const LatticeExprNode &expr)
casacore::True
const Bool True
Definition aipstype.h:41
casacore::value
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:368
casacore::Double
double Double
Definition aipstype.h:53
casacore::near
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
casacore::slidingArrayMath
Array< T > slidingArrayMath(const MaskedArray< T > &array, const IPosition &halfBoxSize, const FuncType &funcObj, bool fillEdge=true)
Apply for each element in the array the given ArrayMath reduction function object to the box around t...
casacore::operator||
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::nfalse
LatticeExprNode nfalse(const LatticeExprNode &expr)
casacore::MArrayLogical_global_functions_MArray_logical_operations
Definition MArrayLogical.h:90
casacore::MArrayLogical_global_functions_MArray_logical_operations::nfalse
size_t nfalse(const MArray< T > &a)
Count the number of unmasked elements that are False.
Definition MArrayLogical.h:394
casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ
Bool allEQ(const MArray< T > &array, const T &value)
Definition MArrayLogical.h:321
casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue
size_t ntrue(const MArray< T > &a)
Count the number of unmasked elements that are True.
Definition MArrayLogical.h:380
casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs
MArray< Bool > nearAbs(const T &left, const MArray< T > &right, Double tol)
Definition MArrayLogical.h:274
casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAlls
MArray< Bool > partialAlls(const MArray< T > &a, const IPosition &collapseAxes)
Get partial all.
Definition MArrayLogical.h:437
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!=
MArray< Bool > operator!=(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:152
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator||
MArray< Bool > operator||(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:158
casacore::MArrayLogical_global_functions_MArray_logical_operations::near
MArray< Bool > near(const T &left, const MArray< T > &right, Double tol)
Definition MArrayLogical.h:269
casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs
MArray< Bool > nearAbs(const MArray< T > &left, const MArray< T > &right, Double tol)
Definition MArrayLogical.h:252
casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ
Bool anyEQ(const MArray< T > &left, const MArray< T > &right)
Is any unmasked element equal?
Definition MArrayLogical.h:337
casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ
Bool allEQ(const T &value, const MArray< T > &array)
Definition MArrayLogical.h:329
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator==
MArray< Bool > operator==(const MArray< T > &left, const MArray< T > &right)
Define comparison functions between 2 MArray objects and between MArray object and scalar.
Definition MArrayLogical.h:122
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>=
MArray< Bool > operator>=(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:140
casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAnys
MArray< Bool > slidingAnys(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding any.
Definition MArrayLogical.h:520
casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNTrue
MArray< uInt > slidingNTrue(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding ntrues.
Definition MArrayLogical.h:470
casacore::MArrayLogical_global_functions_MArray_logical_operations::isNaN
MArray< Bool > isNaN(const MArray< T > &arr)
Test which elements are NaN.
Definition MArrayLogical.h:282
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>
MArray< Bool > operator>(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:146
casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNFalse
MArray< uInt > boxedNFalse(const MArray< T > &a, const IPosition &boxSize)
Get boxed nfalses.
Definition MArrayLogical.h:553
casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAlls
MArray< Bool > slidingAlls(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding all.
Definition MArrayLogical.h:504
casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ
Bool anyEQ(const T &value, const MArray< T > &array)
Definition MArrayLogical.h:366
casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAlls
MArray< Bool > boxedAlls(const MArray< T > &a, const IPosition &boxSize)
Get boxed all.
Definition MArrayLogical.h:569
casacore::MArrayLogical_global_functions_MArray_logical_operations::near
MArray< Bool > near(const MArray< T > &left, const T &right, Double tol)
Definition MArrayLogical.h:259
casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs
MArray< Bool > nearAbs(const MArray< T > &left, const T &right, Double tol)
Definition MArrayLogical.h:264
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator&&
MArray< Bool > operator&&(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:164
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator<
MArray< Bool > operator<(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:134
casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAnys
MArray< Bool > boxedAnys(const MArray< T > &a, const IPosition &boxSize)
Get boxed any.
Definition MArrayLogical.h:585
casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNFalse
MArray< uInt > slidingNFalse(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding nfalses.
Definition MArrayLogical.h:487
casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNFalse
MArray< size_t > partialNFalse(const MArray< T > &a, const IPosition &collapseAxes)
Get partial nfalses.
Definition MArrayLogical.h:423
casacore::MArrayLogical_global_functions_MArray_logical_operations::anyTrue
Bool anyTrue(const MArray< Bool > &array)
Is any unmasked element true?
Definition MArrayLogical.h:375
casacore::MArrayLogical_global_functions_MArray_logical_operations::isInf
MArray< Bool > isInf(const MArray< T > &arr)
Test which elements are infinite.
Definition MArrayLogical.h:287
casacore::MArrayLogical_global_functions_MArray_logical_operations::isFinite
MArray< Bool > isFinite(const MArray< T > &arr)
Test which elements have a finite value.
Definition MArrayLogical.h:292
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator<=
MArray< Bool > operator<=(const MArray< T > &left, const MArray< T > &right)
Definition MArrayLogical.h:128
casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAnys
MArray< Bool > partialAnys(const MArray< T > &a, const IPosition &collapseAxes)
Get partial any.
Definition MArrayLogical.h:453
casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNTrue
MArray< size_t > partialNTrue(const MArray< T > &a, const IPosition &collapseAxes)
Get partial ntrues.
Definition MArrayLogical.h:409
casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNTrue
MArray< uInt > boxedNTrue(const MArray< T > &a, const IPosition &boxSize)
Get boxed ntrues.
Definition MArrayLogical.h:537
casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!
MArray< Bool > operator!(const MArray< T > &a)
The logical NOT of an MArray object (normally Bool type).
Definition MArrayLogical.h:238
casacore::MArrayLogical_global_functions_MArray_logical_operations::near
MArray< Bool > near(const MArray< T > &left, const MArray< T > &right, Double tol)
Compare with a given relative or absolute tolerance.
Definition MArrayLogical.h:245
casacore::MArrayLogical_global_functions_MArray_logical_operations::allTrue
Bool allTrue(const MArray< Bool > &array)
Are all unmasked elements true?
Definition MArrayLogical.h:371
casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ
Bool allEQ(const MArray< T > &left, const MArray< T > &right)
Are all unmasked elements equal?
Definition MArrayLogical.h:300
casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ
Bool anyEQ(const MArray< T > &array, const T &value)
Definition MArrayLogical.h:358