casacore
Loading...
Searching...
No Matches
MArrayLogical.h
Go to the documentation of this file.
1// # MArrayLogical.h: Logical operations on MArray objects
2// # Copyright (C) 2012
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef CASA_MARRAYLOGICAL_H
27#define CASA_MARRAYLOGICAL_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/MArrayMathBase.h>
32#include <casacore/casa/Arrays/ArrayLogical.h>
33#include <casacore/casa/Arrays/ArrayPartMath.h>
34#include <casacore/casa/BasicMath/Functors.h>
35
36namespace casacore {
37
38// <summary>
39// Logical operations for MArray objects.
40// </summary>
41//
42// <reviewed reviewer="UNKNOWN" date="" tests="tMArrayMath">
43//
44// <prerequisite>
45// <li> <linkto class=MArray>MArray</linkto>
46// </prerequisite>
47//
48// <synopsis>
49// These functions perform element by element logical operations on
50// optionally masked arrays and/or scalars.
51// If two arrays are used, the arrays must conform, except for allEQ which
52// returns False if the arrays do not conform.
53//
54// The functions in this file can be divided in 3 groups:
55// <ul>
56// <li> Full array operations like ==, near, etc.
57// They are defined for array-array and array-scalar operations. Arrays
58// shapes have to be conformant. They operate on all elements
59// (also the masked ones). The result is an MArray with the same
60// shape as the input array(s). It will have a mask if one of the
61// operands has a mask. If both operands have a mask, the resulting
62// mask is the OR of both masks.
63// <li> Full reduction functions like ntrue, all, allEQ, etc.
64// They operate on the unmasked elements only. If there are no unmasked
65// elements, the results is 0 or True.
66// <li> Reduction functions working on unmasked elements in parts of the
67// input array. The result is an MArray that has a mask if the input
68// array has a mask. An output element is masked off if its input
69// part has no unmasked elements.
70// The functors defined at the beginning of this file are used to
71// operate on each part.
72// There are 3 flavours:
73// <ul>
74// <li> partialXXX reduces one or more axes. E.g. one can count the
75// number of True elements for particular array axes.
76// The result is an array with a lower dimensionality.
77// They can be seen as a special versions of the boxedXXX functions.
78// <li> slidingXXX operates in a sliding window over the array. So the
79// result is an array with the same shape as the input, although
80// the output array is smaller if the edge is not filled.
81// <li> boxedXXX divides the input array in boxes with the given size
82// and operates on each box. The result is an array with the same
83// dimensionality, but with a smaller size.
84// If the box size does not fit integrally, the edge box is smaller.
85// </ul>
86// </ul>
87// </synopsis>
88//
89// <group name="MArray logical operations">
91// Define functors to perform a reduction function on an MArray object.
92// <group>
93template <typename T, typename RES = size_t>
94class MNTrueFunc : public MArrayFunctorBase<T, RES> {
95 public:
96 virtual ~MNTrueFunc() {}
97 RES operator()(const MArray<T>& arr) const { return ntrue(arr); }
98};
99template <typename T, typename RES = size_t>
100class MNFalseFunc : public MArrayFunctorBase<T, RES> {
101 public:
102 virtual ~MNFalseFunc() {}
103 RES operator()(const MArray<T>& arr) const { return nfalse(arr); }
104};
105template <typename T>
106class MAllFunc : public MArrayFunctorBase<T, Bool> {
107 public:
108 virtual ~MAllFunc() {}
109 Bool operator()(const MArray<T>& arr) const { return allTrue(arr); }
110};
111template <typename T>
112class MAnyFunc : public MArrayFunctorBase<T, Bool> {
113 public:
114 virtual ~MAnyFunc() {}
115 Bool operator()(const MArray<T>& arr) const { return anyTrue(arr); }
116};
117// </group>
118
119// Define comparison functions between 2 MArray objects and
120// between MArray object and scalar.
121// <group>
122template <typename T>
123MArray<Bool> operator==(const MArray<T>& left, const MArray<T>& right) {
124 return (left.isNull() || right.isNull()
125 ? MArray<Bool>()
126 : MArray<Bool>(left.array() == right.array(), left.combineMask(right)));
127}
128
129template <typename T>
130MArray<Bool> operator<=(const MArray<T>& left, const MArray<T>& right) {
131 return (left.isNull() || right.isNull()
132 ? MArray<Bool>()
133 : MArray<Bool>(left.array() <= right.array(), left.combineMask(right)));
134}
135
136template <typename T>
137MArray<Bool> operator<(const MArray<T>& left, const MArray<T>& right) {
138 return (left.isNull() || right.isNull()
139 ? MArray<Bool>()
140 : MArray<Bool>(left.array() < right.array(), left.combineMask(right)));
141}
142
143template <typename T>
144MArray<Bool> operator>=(const MArray<T>& left, const MArray<T>& right) {
145 return (left.isNull() || right.isNull()
146 ? MArray<Bool>()
147 : MArray<Bool>(left.array() >= right.array(), left.combineMask(right)));
148}
149
150template <typename T>
151MArray<Bool> operator>(const MArray<T>& left, const MArray<T>& right) {
152 return (left.isNull() || right.isNull()
153 ? MArray<Bool>()
154 : MArray<Bool>(left.array() > right.array(), left.combineMask(right)));
155}
156
157template <typename T>
158MArray<Bool> operator!=(const MArray<T>& left, const MArray<T>& right) {
159 return (left.isNull() || right.isNull()
160 ? MArray<Bool>()
161 : MArray<Bool>(left.array() != right.array(), left.combineMask(right)));
162}
163
164template <typename T>
165MArray<Bool> operator||(const MArray<T>& left, const MArray<T>& right) {
166 return (left.isNull() || right.isNull()
167 ? MArray<Bool>()
168 : MArray<Bool>(left.array() || right.array(), left.combineMask(right)));
169}
170
171template <typename T>
172MArray<Bool> operator&&(const MArray<T>& left, const MArray<T>& right) {
173 return (left.isNull() || right.isNull()
174 ? MArray<Bool>()
175 : MArray<Bool>(left.array() && right.array(), left.combineMask(right)));
176}
177
178template <typename T>
179MArray<Bool> operator==(const MArray<T>& left, const T& right) {
180 return MArray<Bool>(left.array() == right, left);
181}
182
183template <typename T>
184MArray<Bool> operator<=(const MArray<T>& left, const T& right) {
185 return MArray<Bool>(left.array() <= right, left);
186}
187
188template <typename T>
189MArray<Bool> operator<(const MArray<T>& left, const T& right) {
190 return MArray<Bool>(left.array() < right, left);
191}
192
193template <typename T>
194MArray<Bool> operator>=(const MArray<T>& left, const T& right) {
195 return MArray<Bool>(left.array() >= right, left);
196}
197
198template <typename T>
199MArray<Bool> operator>(const MArray<T>& left, const T& right) {
200 return MArray<Bool>(left.array() > right, left);
201}
202
203template <typename T>
204MArray<Bool> operator!=(const MArray<T>& left, const T& right) {
205 return MArray<Bool>(left.array() != right, left);
206}
207
208template <typename T>
209MArray<Bool> operator||(const MArray<T>& left, const T& right) {
210 return MArray<Bool>(left.array() || right, left);
211}
212
213template <typename T>
214MArray<Bool> operator&&(const MArray<T>& left, const T& right) {
215 return MArray<Bool>(left.array() && right, left);
216}
217
218template <typename T>
219MArray<Bool> operator==(const T& left, const MArray<T>& right) {
220 return MArray<Bool>(left == right.array(), right);
221}
222
223template <typename T>
224MArray<Bool> operator<=(const T& left, const MArray<T>& right) {
225 return MArray<Bool>(left <= right.array(), right);
226}
227
228template <typename T>
229MArray<Bool> operator<(const T& left, const MArray<T>& right) {
230 return MArray<Bool>(left < right.array(), right);
231}
232
233template <typename T>
234MArray<Bool> operator>=(const T& left, const MArray<T>& right) {
235 return MArray<Bool>(left >= right.array(), right);
236}
237
238template <typename T>
239MArray<Bool> operator>(const T& left, const MArray<T>& right) {
240 return MArray<Bool>(left > right.array(), right);
241}
242
243template <typename T>
244MArray<Bool> operator!=(const T& left, const MArray<T>& right) {
245 return MArray<Bool>(left != right.array(), right);
246}
247// </group>
248
249// The logical OR of 2 MArray objects (normally Bool type)
250template <typename T>
251MArray<Bool> operator||(const T& left, const MArray<T>& right) {
252 return MArray<Bool>(left || right.array(), right);
253}
254
255// The logical AND of 2 MArray objects (normally Bool type).
256template <typename T>
257MArray<Bool> operator&&(const T& left, const MArray<T>& right) {
258 return MArray<Bool>(left && right.array(), right);
259}
260
261// The logical NOT of an MArray object (normally Bool type).
262template <typename T>
264 return MArray<Bool>(!a.array(), a);
265}
266
267// Compare with a given relative or absolute tolerance.
268// <group>
269template <typename T>
270MArray<Bool> near(const MArray<T>& left, const MArray<T>& right, Double tol) {
271 return (left.isNull() || right.isNull()
272 ? MArray<Bool>()
273 : MArray<Bool>(near(left.array(), right.array(), tol), left.combineMask(right)));
274}
275
276template <typename T>
277MArray<Bool> nearAbs(const MArray<T>& left, const MArray<T>& right, Double tol) {
278 return (left.isNull() || right.isNull()
279 ? MArray<Bool>()
280 : MArray<Bool>(nearAbs(left.array(), right.array(), tol), left.combineMask(right)));
281}
282
283template <typename T>
284MArray<Bool> near(const MArray<T>& left, const T& right, Double tol) {
285 return MArray<Bool>(near(left.array(), right, tol), left);
286}
287
288template <typename T>
289MArray<Bool> nearAbs(const MArray<T>& left, const T& right, Double tol) {
290 return MArray<Bool>(nearAbs(left.array(), right, tol), left);
291}
292
293template <typename T>
294MArray<Bool> near(const T& left, const MArray<T>& right, Double tol) {
295 return MArray<Bool>(near(left, right.array(), tol), right);
296}
297
298template <typename T>
299MArray<Bool> nearAbs(const T& left, const MArray<T>& right, Double tol) {
300 return MArray<Bool>(nearAbs(left, right.array(), tol), right);
301}
302// </group>
303
304// Test which elements are NaN.
305template <typename T>
307 return MArray<Bool>(isNaN(arr.array()), arr);
308}
309
310// Test which elements are infinite.
311template <typename T>
313 return MArray<Bool>(isInf(arr.array()), arr);
314}
315
316// Test which elements have a finite value.
317template <typename T>
319 return MArray<Bool>(isFinite(arr.array()), arr);
320}
321
322// Are all unmasked elements equal?
323// The result is True if there are no unmasked elements.
324// <group>
325template <typename T>
326Bool allEQ(const MArray<T>& left, const MArray<T>& right) {
327 if (left.isNull() || right.isNull()) {
328 return False;
329 } else if (left.hasMask()) {
330 if (right.hasMask()) {
331 return compareAllMasked(left.array().begin(), left.array().end(), right.array.begin(),
332 left.mask().begin(), right.mask().begin(), std::equal_to<T>());
333 } else {
334 return compareAllMasked(left.array().begin(), left.array().end(), right.array.begin(),
335 left.mask().begin(), std::equal_to<T>());
336 }
337 } else if (right.hasMask()) {
338 return compareAllMasked(left.array().begin(), left.array().end(), right.array.begin(),
339 right.mask().begin(), std::equal_to<T>());
340 }
341 return allEQ(left.array(), right.array());
342}
343template <typename T>
344Bool allEQ(const MArray<T>& array, const T& value) {
345 return array.isNull() ? False
346 : array.hasMask() ? compareAllRightMasked(array.array().begin(), array.array().end(),
347 value, array.mask().begin(), std::equal_to<T>())
348 : allEQ(array.array(), value);
349}
350template <typename T>
351inline Bool allEQ(const T& value, const MArray<T>& array) {
352 return allEQ(array, value);
353}
354// </group>
355
356// Is any unmasked element equal?
357// The result is False if there are no unmasked elements.
358// <group>
359template <typename T>
360Bool anyEQ(const MArray<T>& left, const MArray<T>& right) {
361 if (left.isNull() || right.isNull()) {
362 return False;
363 } else if (left.hasMask()) {
364 if (right.hasMask()) {
365 return compareAnyMasked(left.array().begin(), left.array().end(), right.array.begin(),
366 left.mask().begin(), right.mask().begin(), std::equal_to<T>());
367 } else {
368 return compareAnyMasked(left.array().begin(), left.array().end(), right.array.begin(),
369 left.mask().begin(), std::equal_to<T>());
370 }
371 } else if (right.hasMask()) {
372 return compareAnyMasked(left.array().begin(), left.array().end(), right.array.begin(),
373 right.mask().begin(), std::equal_to<T>());
374 }
375 return anyEQ(left.array(), right.array());
376}
377template <typename T>
378Bool anyEQ(const MArray<T>& array, const T& value) {
379 return array.isNull() ? False
380 : array.hasMask() ? compareAnyRightMasked(array.array().begin(), array.array().end(),
381 value, array.mask().begin(), std::equal_to<T>())
382 : anyEQ(array.array(), value);
383}
384template <typename T>
385inline Bool anyEQ(const T& value, const MArray<T>& array) {
386 return anyEQ(array, value);
387}
388// </group>
389
390// Are all unmasked elements true?
391inline Bool allTrue(const MArray<Bool>& array) { return allEQ(array, True); }
392
393// Is any unmasked element true?
394inline Bool anyTrue(const MArray<Bool>& array) { return anyEQ(array, True); }
395
396// Count the number of unmasked elements that are True.
397template <typename T>
398size_t ntrue(const MArray<T>& a) {
399 if (a.hasMask()) {
400 return a.array().contiguousStorage() && a.mask().contiguousStorage()
401 ? countNEMasked<T>(a.array().cbegin(), a.array().cend(), a.mask().cbegin(), T())
402 : countNEMasked<T>(a.array().begin(), a.array().end(), a.mask().begin(), T());
403 }
404 return ntrue(a.array());
405}
406
407// Count the number of unmasked elements that are False.
408template <typename T>
409size_t nfalse(const MArray<T>& a) {
410 if (a.hasMask()) {
411 return a.array().contiguousStorage() && a.mask().contiguousStorage()
412 ? countMasked<T>(a.array().cbegin(), a.array().cend(), a.mask().cbegin(), T())
413 : countMasked<T>(a.array().begin(), a.array().end(), a.mask().begin(), T());
414 }
415 return nfalse(a.array());
416}
417
418// Get partial ntrues.
419template <typename T>
420MArray<size_t> partialNTrue(const MArray<T>& a, const IPosition& collapseAxes) {
421 if (a.isNull()) {
422 return MArray<size_t>();
423 } else if (!a.hasMask()) {
424 return MArray<size_t>(partialNTrue(a.array(), collapseAxes));
425 }
426 MArray<size_t> res;
427 partialArrayMath(res, a, collapseAxes, MNTrueFunc<T, size_t>());
428 return res;
429}
430// Get partial nfalses.
431template <typename T>
432MArray<size_t> partialNFalse(const MArray<T>& a, const IPosition& collapseAxes) {
433 if (a.isNull()) {
434 return MArray<size_t>();
435 } else if (!a.hasMask()) {
436 return MArray<size_t>(partialNFalse(a.array(), collapseAxes));
437 }
438 MArray<size_t> res;
439 partialArrayMath(res, a, collapseAxes, MNFalseFunc<T, size_t>());
440 return res;
441}
442// Get partial all.
443template <typename T>
444MArray<Bool> partialAlls(const MArray<T>& a, const IPosition& collapseAxes) {
445 if (a.isNull()) {
446 return MArray<Bool>();
447 } else if (!a.hasMask()) {
448 Array<Bool> res;
449 partialArrayMath(res, a.array(), collapseAxes, AllFunc<T>());
450 return MArray<Bool>(res);
451 }
452 MArray<Bool> res;
453 partialArrayMath(res, a, collapseAxes, MAllFunc<T>());
454 return res;
455}
456// Get partial any.
457template <typename T>
458MArray<Bool> partialAnys(const MArray<T>& a, const IPosition& collapseAxes) {
459 if (a.isNull()) {
460 return MArray<Bool>();
461 } else if (!a.hasMask()) {
462 Array<Bool> res;
463 partialArrayMath(res, a.array(), collapseAxes, AnyFunc<T>());
464 return MArray<Bool>(res);
465 }
466 MArray<Bool> res;
467 partialArrayMath(res, a, collapseAxes, MAnyFunc<T>());
468 return res;
469}
470
471// Get sliding ntrues.
472template <typename T>
473MArray<uInt> slidingNTrue(const MArray<T>& a, const IPosition& halfBoxSize, Bool fillEdge = True) {
474 if (a.isNull()) {
475 return MArray<uInt>();
476 } else if (!a.hasMask()) {
477 Array<uInt> res;
478 slidingArrayMath(res, a.array(), halfBoxSize, NTrueFunc<T, uInt>(), fillEdge);
479 return MArray<uInt>(res);
480 }
481 MArray<uInt> res;
482 slidingArrayMath(res, a, halfBoxSize, MNTrueFunc<T, uInt>(), fillEdge);
483 return res;
484}
485// Get sliding nfalses.
486template <typename T>
487MArray<uInt> slidingNFalse(const MArray<T>& a, const IPosition& halfBoxSize, Bool fillEdge = True) {
488 if (a.isNull()) {
489 return MArray<uInt>();
490 } else if (!a.hasMask()) {
491 Array<uInt> res;
492 slidingArrayMath(res, a.array(), halfBoxSize, NFalseFunc<T, uInt>(), fillEdge);
493 return MArray<uInt>(res);
494 }
495 MArray<uInt> res;
496 slidingArrayMath(res, a, halfBoxSize, MNFalseFunc<T, uInt>(), fillEdge);
497 return res;
498}
499// Get sliding all.
500template <typename T>
501MArray<Bool> slidingAlls(const MArray<T>& a, const IPosition& halfBoxSize, Bool fillEdge = True) {
502 if (a.isNull()) {
503 return MArray<Bool>();
504 } else if (!a.hasMask()) {
505 Array<Bool> res;
506 slidingArrayMath(res, a.array(), halfBoxSize, AllFunc<T>(), fillEdge);
507 return MArray<Bool>(res);
508 }
509 MArray<Bool> res;
510 slidingArrayMath(res, a, halfBoxSize, MAllFunc<T>(), fillEdge);
511 return res;
512}
513// Get sliding any.
514template <typename T>
515MArray<Bool> slidingAnys(const MArray<T>& a, const IPosition& halfBoxSize, Bool fillEdge = True) {
516 if (a.isNull()) {
517 return MArray<Bool>();
518 } else if (!a.hasMask()) {
519 Array<Bool> res;
520 slidingArrayMath(res, a.array(), halfBoxSize, AnyFunc<T>(), fillEdge);
521 return MArray<Bool>(res);
522 }
523 MArray<Bool> res;
524 slidingArrayMath(res, a, halfBoxSize, MAnyFunc<T>(), fillEdge);
525 return res;
526}
527
528// Get boxed ntrues.
529template <typename T>
530MArray<uInt> boxedNTrue(const MArray<T>& a, const IPosition& boxSize) {
531 if (a.isNull()) {
532 return MArray<uInt>();
533 } else if (!a.hasMask()) {
534 Array<uInt> res;
535 boxedArrayMath(res, a.array(), boxSize, NTrueFunc<T, uInt>());
536 return MArray<uInt>(res);
537 }
538 MArray<uInt> res;
539 boxedArrayMath(res, a, boxSize, MNTrueFunc<T, uInt>());
540 return res;
541}
542// Get boxed nfalses.
543template <typename T>
544MArray<uInt> boxedNFalse(const MArray<T>& a, const IPosition& boxSize) {
545 if (a.isNull()) {
546 return MArray<uInt>();
547 } else if (!a.hasMask()) {
548 Array<uInt> res;
549 boxedArrayMath(res, a.array(), boxSize, NFalseFunc<T, uInt>());
550 return MArray<uInt>(res);
551 }
552 MArray<uInt> res;
553 boxedArrayMath(res, a, boxSize, MNFalseFunc<T, uInt>());
554 return res;
555}
556// Get boxed all.
557template <typename T>
558MArray<Bool> boxedAlls(const MArray<T>& a, const IPosition& boxSize) {
559 if (a.isNull()) {
560 return MArray<Bool>();
561 } else if (!a.hasMask()) {
562 Array<Bool> res;
563 boxedArrayMath(res, a.array(), boxSize, AllFunc<T>());
564 return MArray<Bool>(res);
565 }
566 MArray<Bool> res;
567 boxedArrayMath(res, a, boxSize, MAllFunc<T>());
568 return res;
569}
570// Get boxed any.
571template <typename T>
572MArray<Bool> boxedAnys(const MArray<T>& a, const IPosition& boxSize) {
573 if (a.isNull()) {
574 return MArray<Bool>();
575 } else if (!a.hasMask()) {
576 Array<Bool> res;
577 boxedArrayMath(res, a.array(), boxSize, AnyFunc<T>());
578 return MArray<Bool>(res);
579 }
580 MArray<Bool> res;
581 boxedArrayMath(res, a, boxSize, MAnyFunc<T>());
582 return res;
583}
584
585// </group>
586
587} // namespace casacore
588
589#endif
Logical functor to test if all elements are true.
Logical functor to test if any elements are true.
bool contiguousStorage() const
Are the array data contiguous?
Definition ArrayBase.h:108
iterator begin()
Get the begin iterator object for any array.
Definition Array.h:814
contiter cbegin()
Get the begin iterator object for a contiguous array.
Definition Array.h:822
Array< Bool > combineMask(const MArrayBase &other) const
Combine this and the other mask.
Bool isNull() const
Is the array null?
Definition MArrayBase.h:103
const Array< Bool > & mask() const
Get the mask.
Definition MArrayBase.h:118
Bool hasMask() const
Is there a mask?
Definition MArrayBase.h:112
Define functors to perform a reduction function on an MArray object.
const Array< T > & array() const
Get access to the array.
Definition MArray.h:136
Logical functor to count the number of false elements.
Logical functor to count the number of true elements.
bool operator==(const String &x, const String &y)
Global comparison operators.
Definition String.h:849
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
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.
bool operator<(const String &x, const String &y)
Definition String.h:853
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
Definition ExprNode.h:1400
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1148
T * array
The actual storage.
Definition Block.h:689
TableExprNode isInf(const TableExprNode &node)
Definition ExprNode.h:1397
bool operator<=(const String &x, const String &y)
Definition String.h:854
LatticeExprNode ntrue(const LatticeExprNode &expr)
Bool anyEQ(const TableVector< T > &l, const TableVector< T > &r)
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
double Double
Definition aipstype.h:53
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
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...
LatticeExprNode nfalse(const LatticeExprNode &expr)
MArray< Bool > operator&&(const T &left, const MArray< T > &right)
The logical AND of 2 MArray objects (normally Bool type).
size_t nfalse(const MArray< T > &a)
Count the number of unmasked elements that are False.
MArray< Bool > operator||(const T &left, const MArray< T > &right)
The logical OR of 2 MArray objects (normally Bool type).
Bool allEQ(const MArray< T > &array, const T &value)
size_t ntrue(const MArray< T > &a)
Count the number of unmasked elements that are True.
MArray< Bool > nearAbs(const T &left, const MArray< T > &right, Double tol)
MArray< Bool > operator||(const MArray< T > &left, const T &right)
MArray< Bool > partialAlls(const MArray< T > &a, const IPosition &collapseAxes)
Get partial all.
MArray< Bool > operator!=(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > operator||(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > near(const T &left, const MArray< T > &right, Double tol)
MArray< Bool > nearAbs(const MArray< T > &left, const MArray< T > &right, Double tol)
Bool anyEQ(const MArray< T > &left, const MArray< T > &right)
Is any unmasked element equal?
MArray< Bool > operator>(const T &left, const MArray< T > &right)
MArray< Bool > operator>=(const MArray< T > &left, const T &right)
Bool allEQ(const T &value, const MArray< T > &array)
MArray< Bool > operator==(const MArray< T > &left, const MArray< T > &right)
Define comparison functions between 2 MArray objects and between MArray object and scalar.
MArray< Bool > operator>=(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > slidingAnys(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding any.
MArray< uInt > slidingNTrue(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding ntrues.
MArray< Bool > operator>(const MArray< T > &left, const T &right)
MArray< Bool > isNaN(const MArray< T > &arr)
Test which elements are NaN.
MArray< Bool > operator&&(const MArray< T > &left, const T &right)
MArray< Bool > operator>(const MArray< T > &left, const MArray< T > &right)
MArray< uInt > boxedNFalse(const MArray< T > &a, const IPosition &boxSize)
Get boxed nfalses.
MArray< Bool > slidingAlls(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding all.
Bool anyEQ(const T &value, const MArray< T > &array)
MArray< Bool > boxedAlls(const MArray< T > &a, const IPosition &boxSize)
Get boxed all.
MArray< Bool > near(const MArray< T > &left, const T &right, Double tol)
MArray< Bool > nearAbs(const MArray< T > &left, const T &right, Double tol)
MArray< Bool > operator&&(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > operator<(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > boxedAnys(const MArray< T > &a, const IPosition &boxSize)
Get boxed any.
MArray< uInt > slidingNFalse(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding nfalses.
MArray< size_t > partialNFalse(const MArray< T > &a, const IPosition &collapseAxes)
Get partial nfalses.
Bool anyTrue(const MArray< Bool > &array)
Is any unmasked element true?
MArray< Bool > isInf(const MArray< T > &arr)
Test which elements are infinite.
MArray< Bool > isFinite(const MArray< T > &arr)
Test which elements have a finite value.
MArray< Bool > operator<=(const MArray< T > &left, const MArray< T > &right)
MArray< Bool > partialAnys(const MArray< T > &a, const IPosition &collapseAxes)
Get partial any.
MArray< size_t > partialNTrue(const MArray< T > &a, const IPosition &collapseAxes)
Get partial ntrues.
MArray< Bool > operator!=(const MArray< T > &left, const T &right)
MArray< Bool > operator>=(const T &left, const MArray< T > &right)
MArray< uInt > boxedNTrue(const MArray< T > &a, const IPosition &boxSize)
Get boxed ntrues.
MArray< Bool > operator!(const MArray< T > &a)
The logical NOT of an MArray object (normally Bool type).
MArray< Bool > near(const MArray< T > &left, const MArray< T > &right, Double tol)
Compare with a given relative or absolute tolerance.
Bool allTrue(const MArray< Bool > &array)
Are all unmasked elements true?
MArray< Bool > operator!=(const T &left, const MArray< T > &right)
Bool allEQ(const MArray< T > &left, const MArray< T > &right)
Are all unmasked elements equal?
Bool anyEQ(const MArray< T > &array, const T &value)