28 #ifndef CASA_MARRAYLOGICAL_H
29 #define CASA_MARRAYLOGICAL_H
96 template<
typename T,
typename RES=
size_t>
102 template<
typename T,
typename RES=
size_t>
108 template<
typename T>
class MAllFunc :
public MArrayFunctorBase<T,Bool> {
113 template<
typename T>
class MAnyFunc :
public MArrayFunctorBase<T,Bool> {
131 {
return (left.isNull() || right.isNull() ?
MArray<Bool>() :
133 left.combineMask(right))); }
137 {
return (left.isNull() || right.isNull() ?
MArray<Bool>() :
139 left.combineMask(right))); }
301 template <
typename T>
309 right.
mask().
begin(), std::equal_to<T>());
322 template <
typename T>
330 template <
typename T>
332 {
return allEQ (array, value); }
338 template <
typename T>
346 right.
mask().
begin(), std::equal_to<T>());
359 template <
typename T>
367 template <
typename T>
369 {
return anyEQ (array, value); }
374 {
return allEQ (array,
True); }
450 partialArrayMath (res, a, collapseAxes,
MAllFunc<T>());
466 partialArrayMath (res, a, collapseAxes,
MAnyFunc<T>());
A Vector of integers, for indexing into Array<T> objects.
MArray< Bool > isInf(const MArray< T > &arr)
Test which elements are infinite.
Class to handle an Array with an optional mask.
bool contiguousStorage() const
Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a cop...
Bool allEQ(const MArray< T > &left, const MArray< T > &right)
Are all unmasked elements equal? The result is True if there are no unmasked elements.
MArray< Bool > nearAbs(const MArray< T > &left, const MArray< T > &right, Double tol)
Bool allTrue(const MArray< Bool > &array)
Are all unmasked elements true?
Bool allEQ(const MArray< T > &array, const T &value)
Bool isNull() const
Is the array null?
MArray< Bool > nearAbs(const T &left, const MArray< T > &right, Double tol)
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Define functors to perform a reduction function on an MArray object.
MArray< Bool > near(const MArray< T > &left, const T &right, Double tol)
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
LatticeExprNode ntrue(const LatticeExprNode &expr)
Logical functor to test if all elements are true.
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
size_t nfalse(const MArray< T > &a)
Count the number of unmasked elements that are False.
MArray< Bool > partialAnys(const MArray< T > &a, const IPosition &collapseAxes)
Get partial any.
Logical functor to test if any elements are true.
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...
MArray< Bool > near(const T &left, const MArray< T > &right, Double tol)
MArray< Bool > isNaN(const MArray< T > &arr)
Test which elements are NaN.
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
MArray< size_t > partialNTrue(const MArray< T > &a, const IPosition &collapseAxes)
Get partial ntrues.
MArray< Bool > slidingAlls(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding all.
LatticeExprNode nfalse(const LatticeExprNode &expr)
LatticeExprNode operator!(const LatticeExprNode &expr)
Array< Bool > combineMask(const MArrayBase &other) const
Combine this and the other mask.
MArray< uInt > boxedNTrue(const MArray< T > &a, const IPosition &boxSize)
Get boxed ntrues.
MArray< Bool > nearAbs(const MArray< T > &left, const T &right, Double tol)
TableExprNode isInf(const TableExprNode &node)
Bool allEQ(const T &value, const MArray< T > &array)
Logical functor to count the number of false elements.
MArray< Bool > boxedAlls(const MArray< T > &a, const IPosition &boxSize)
Get boxed all.
MArray< Bool > slidingAnys(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding any.
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
bool Bool
Define the standard types used by Casacore.
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.
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
MArray< uInt > slidingNTrue(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding ntrues.
MArray< Bool > isFinite(const MArray< T > &arr)
Test which elements have a finite value.
MArray< size_t > partialNFalse(const MArray< T > &a, const IPosition &collapseAxes)
Get partial nfalses.
const Array< T > & array() const
Get access to the array.
MArray< uInt > slidingNFalse(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding nfalses.
MArray< uInt > boxedNFalse(const MArray< T > &a, const IPosition &boxSize)
Get boxed nfalses.
Bool hasMask() const
Is there a mask?
Bool anyTrue(const MArray< Bool > &array)
Is any unmasked element true?
iterator begin()
Get the begin iterator object for any array.
Bool anyEQ(const TableVector< T > &l, const TableVector< T > &r)
size_t ntrue(const MArray< T > &a)
Count the number of unmasked elements that are True.
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
MArray< Bool > boxedAnys(const MArray< T > &a, const IPosition &boxSize)
Get boxed any.
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
contiter cbegin()
Get the begin iterator object for a contiguous array.
Bool anyEQ(const MArray< T > &left, const MArray< T > &right)
Is any unmasked element equal? The result is False if there are no unmasked elements.
MArray< Bool > partialAlls(const MArray< T > &a, const IPosition &collapseAxes)
Get partial all.
MArray< Bool > near(const MArray< T > &left, const MArray< T > &right, Double tol)
Compare with a given relative or absolute tolerance.
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Logical functor to count the number of true elements.
Bool anyEQ(const T &value, const MArray< T > &array)
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
Bool anyEQ(const MArray< T > &array, const T &value)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
const Array< Bool > & mask() const
Get the mask.