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
92 // Define functors to perform a reduction function on an MArray object.
93 // <group>
94 template<typename T, typename RES=size_t>
95 class MNTrueFunc : public MArrayFunctorBase<T,RES> {
96 public:
97 virtual ~MNTrueFunc() {}
98 RES operator() (const MArray<T>& arr) const { return ntrue(arr); }
99 };
100 template<typename T, typename RES=size_t>
101 class MNFalseFunc : public MArrayFunctorBase<T,RES> {
102 public:
103 virtual ~MNFalseFunc() {}
104 RES operator() (const MArray<T>& arr) const { return nfalse(arr); }
105 };
106 template<typename T> class MAllFunc : public MArrayFunctorBase<T,Bool> {
107 public:
108 virtual ~MAllFunc() {}
109 Bool operator() (const MArray<T>& arr) const { return allTrue(arr); }
110 };
111 template<typename T> class MAnyFunc : public MArrayFunctorBase<T,Bool> {
112 public:
113 virtual ~MAnyFunc() {}
114 Bool operator() (const MArray<T>& arr) const { return anyTrue(arr); }
115 };
116 // </group>
117
118 // Define comparison functions between 2 MArray objects and
119 // between MArray object and scalar.
120 // <group>
121 template<typename T>
122 MArray<Bool> operator== (const MArray<T>& left, const MArray<T>& right)
123 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
124 MArray<Bool> (left.array() == right.array(),
125 left.combineMask(right))); }
126
127 template<typename T>
128 MArray<Bool> operator<= (const MArray<T>& left, const MArray<T>& right)
129 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
130 MArray<Bool> (left.array() <= right.array(),
131 left.combineMask(right))); }
132
133 template<typename T>
134 MArray<Bool> operator< (const MArray<T>& left, const MArray<T>& right)
135 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
136 MArray<Bool> (left.array() < right.array(),
137 left.combineMask(right))); }
138
139 template<typename T>
140 MArray<Bool> operator>= (const MArray<T>& left, const MArray<T>& right)
141 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
142 MArray<Bool> (left.array() >= right.array(),
143 left.combineMask(right))); }
144
145 template<typename T>
146 MArray<Bool> operator> (const MArray<T>& left, const MArray<T>& right)
147 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
148 MArray<Bool> (left.array() > right.array(),
149 left.combineMask(right))); }
150
151 template<typename T>
152 MArray<Bool> operator!= (const MArray<T>& left, const MArray<T>& right)
153 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
154 MArray<Bool> (left.array() != right.array(),
155 left.combineMask(right))); }
156
157 template<typename T>
158 MArray<Bool> operator|| (const MArray<T>& left, const MArray<T>& right)
159 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
160 MArray<Bool> (left.array() || right.array(),
161 left.combineMask(right))); }
162
163 template<typename T>
164 MArray<Bool> operator&& (const MArray<T>& left, const MArray<T>& right)
165 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
166 MArray<Bool> (left.array() && right.array(),
167 left.combineMask(right))); }
168
169 template<typename T>
170 MArray<Bool> operator== (const MArray<T>& left, const T& right)
171 { return MArray<Bool> (left.array() == right, left); }
172
173 template<typename T>
174 MArray<Bool> operator<= (const MArray<T>& left, const T& right)
175 { return MArray<Bool> (left.array() <= right, left); }
176
177 template<typename T>
178 MArray<Bool> operator< (const MArray<T>& left, const T& right)
179 { return MArray<Bool> (left.array() < right, left); }
180
181 template<typename T>
182 MArray<Bool> operator>= (const MArray<T>& left, const T& right)
183 { return MArray<Bool> (left.array() >= right, left); }
184
185 template<typename T>
186 MArray<Bool> operator> (const MArray<T>& left, const T& right)
187 { return MArray<Bool> (left.array() > right, left); }
188
189 template<typename T>
190 MArray<Bool> operator!= (const MArray<T>& left, const T& right)
191 { return MArray<Bool> (left.array() != right, left); }
192
193 template<typename T>
194 MArray<Bool> operator|| (const MArray<T>& left, const T& right)
195 { return MArray<Bool> (left.array() || right, left); }
196
197 template<typename T>
198 MArray<Bool> operator&& (const MArray<T>& left, const T& right)
199 { return MArray<Bool> (left.array() && right, left); }
200
201 template<typename T>
202 MArray<Bool> operator== (const T& left, const MArray<T>& right)
203 { return MArray<Bool> (left == right.array(), right); }
204
205 template<typename T>
206 MArray<Bool> operator<= (const T& left, const MArray<T>& right)
207 { return MArray<Bool> (left <= right.array(), right); }
208
209 template<typename T>
210 MArray<Bool> operator< (const T& left, const MArray<T>& right)
211 { return MArray<Bool> (left < right.array(), right); }
212
213 template<typename T>
214 MArray<Bool> operator>= (const T& left, const MArray<T>& right)
215 { return MArray<Bool> (left >= right.array(), right); }
216
217 template<typename T>
218 MArray<Bool> operator> (const T& left, const MArray<T>& right)
219 { return MArray<Bool> (left > right.array(), right); }
220
221 template<typename T>
222 MArray<Bool> operator!= (const T& left, const MArray<T>& right)
223 { return MArray<Bool> (left != right.array(), right); }
224 // </group>
225
226 // The logical OR of 2 MArray objects (normally Bool type)
227 template<typename T>
228 MArray<Bool> operator|| (const T& left, const MArray<T>& right)
229 { return MArray<Bool> (left || right.array(), right); }
230
231 // The logical AND of 2 MArray objects (normally Bool type).
232 template<typename T>
233 MArray<Bool> operator&& (const T& left, const MArray<T>& right)
234 { return MArray<Bool> (left && right.array(), right); }
235
236 // The logical NOT of an MArray object (normally Bool type).
237 template<typename T>
239 { return MArray<Bool> (!a.array(), a); }
240
241
242 // Compare with a given relative or absolute tolerance.
243 // <group>
244 template<typename T>
245 MArray<Bool> near (const MArray<T>& left, const MArray<T>& right,
246 Double tol)
247 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
248 MArray<Bool> (near(left.array(), right.array(), tol),
249 left.combineMask(right))); }
250
251 template<typename T>
252 MArray<Bool> nearAbs (const MArray<T>& left, const MArray<T>& right,
253 Double tol)
254 { return (left.isNull() || right.isNull() ? MArray<Bool>() :
255 MArray<Bool> (nearAbs(left.array(), right.array(), tol),
256 left.combineMask(right))); }
257
258 template<typename T>
259 MArray<Bool> near (const MArray<T>& left, const T& right,
260 Double tol)
261 { return MArray<Bool> (near(left.array(), right, tol), left); }
262
263 template<typename T>
264 MArray<Bool> nearAbs (const MArray<T>& left, const T& right,
265 Double tol)
266 { return MArray<Bool> (nearAbs(left.array(), right, tol), left); }
267
268 template<typename T>
269 MArray<Bool> near (const T& left, const MArray<T>& right,
270 Double tol)
271 { return MArray<Bool> (near(left, right.array(), tol), right); }
272
273 template<typename T>
274 MArray<Bool> nearAbs (const T& left, const MArray<T>& right,
275 Double tol)
276 { return MArray<Bool> (nearAbs(left, right.array(), tol), right); }
277 // </group>
278
279
280 // Test which elements are NaN.
281 template<typename T>
283 { return MArray<Bool> (isNaN(arr.array()), arr); }
284
285 // Test which elements are infinite.
286 template<typename T>
288 { return MArray<Bool> (isInf(arr.array()), arr); }
289
290 // Test which elements have a finite value.
291 template<typename T>
293 { return MArray<Bool> (isFinite(arr.array()), arr); }
294
295
296 // Are all unmasked elements equal?
297 // The result is True if there are no unmasked elements.
298 // <group>
299 template <typename T>
300 Bool allEQ (const MArray<T>& left, const MArray<T>& right)
301 { if (left.isNull() || right.isNull()) {
302 return False;
303 } else if (left.hasMask()) {
304 if (right.hasMask()) {
305 return compareAllMasked (left.array().begin(), left.array().end(),
306 right.array.begin(), left.mask().begin(),
307 right.mask().begin(), std::equal_to<T>());
308 } else {
309 return compareAllMasked (left.array().begin(), left.array().end(),
310 right.array.begin(), left.mask().begin(),
311 std::equal_to<T>());
312 }
313 } else if (right.hasMask()) {
314 return compareAllMasked (left.array().begin(), left.array().end(),
315 right.array.begin(), right.mask().begin(),
316 std::equal_to<T>());
317 }
318 return allEQ (left.array(), right.array());
319 }
320 template <typename T>
321 Bool allEQ (const MArray<T>& array, const T& value)
322 { return array.isNull() ? False :
323 array.hasMask() ?
324 compareAllRightMasked (array.array().begin(), array.array().end(),
325 value, array.mask().begin(), std::equal_to<T>())
326 : allEQ (array.array(), value);
327 }
328 template <typename T>
329 inline Bool allEQ (const T& value, const MArray<T>& array)
330 { return allEQ (array, value); }
331 // </group>
332
333 // Is any unmasked element equal?
334 // The result is False if there are no unmasked elements.
335 // <group>
336 template <typename T>
337 Bool anyEQ (const MArray<T>& left, const MArray<T>& right)
338 { if (left.isNull() || right.isNull()) {
339 return False;
340 } else if (left.hasMask()) {
341 if (right.hasMask()) {
342 return compareAnyMasked (left.array().begin(), left.array().end(),
343 right.array.begin(), left.mask().begin(),
344 right.mask().begin(), std::equal_to<T>());
345 } else {
346 return compareAnyMasked (left.array().begin(), left.array().end(),
347 right.array.begin(), left.mask().begin(),
348 std::equal_to<T>());
349 }
350 } else if (right.hasMask()) {
351 return compareAnyMasked (left.array().begin(), left.array().end(),
352 right.array.begin(), right.mask().begin(),
353 std::equal_to<T>());
354 }
355 return anyEQ (left.array(), right.array());
356 }
357 template <typename T>
358 Bool anyEQ (const MArray<T>& array, const T& value)
359 { return array.isNull() ? False :
360 array.hasMask() ?
361 compareAnyRightMasked (array.array().begin(), array.array().end(),
362 value, array.mask().begin(), std::equal_to<T>())
363 : anyEQ (array.array(), value);
364 }
365 template <typename T>
366 inline Bool anyEQ (const T& value, const MArray<T>& array)
367 { return anyEQ (array, value); }
368 // </group>
369
370 // Are all unmasked elements true?
372 { return allEQ (array, True); }
373
374 // Is any unmasked element true?
376 { return anyEQ (array, True); }
377
378 // Count the number of unmasked elements that are True.
379 template<typename T>
380 size_t ntrue(const MArray<T>& a)
381 {
382 if (a.hasMask()) {
383 return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
384 countNEMasked<T>(a.array().cbegin(), a.array().cend(),
385 a.mask().cbegin(), T()) :
386 countNEMasked<T>(a.array().begin(), a.array().end(),
387 a.mask().begin(), T());
388 }
389 return ntrue(a.array());
390 }
391
392 // Count the number of unmasked elements that are False.
393 template<typename T>
394 size_t nfalse(const MArray<T>& a)
395 {
396 if (a.hasMask()) {
397 return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
398 countMasked<T>(a.array().cbegin(), a.array().cend(),
399 a.mask().cbegin(), T()) :
400 countMasked<T>(a.array().begin(), a.array().end(),
401 a.mask().begin(), T());
402 }
403 return nfalse(a.array());
404 }
405
406
407 // Get partial ntrues.
408 template<typename T>
410 const IPosition& collapseAxes)
411 {
412 if (a.isNull()) {
413 return MArray<size_t>();
414 } else if (! a.hasMask()) {
415 return MArray<size_t>(partialNTrue (a.array(), collapseAxes));
416 }
417 MArray<size_t> res;
418 partialArrayMath (res, a, collapseAxes, MNTrueFunc<T,size_t>());
419 return res;
420 }
421 // Get partial nfalses.
422 template<typename T>
424 const IPosition& collapseAxes)
425 {
426 if (a.isNull()) {
427 return MArray<size_t>();
428 } else if (! a.hasMask()) {
429 return MArray<size_t>(partialNFalse (a.array(), collapseAxes));
430 }
431 MArray<size_t> res;
432 partialArrayMath (res, a, collapseAxes, MNFalseFunc<T,size_t>());
433 return res;
434 }
435 // Get partial all.
436 template<typename T>
438 const IPosition& collapseAxes)
439 {
440 if (a.isNull()) {
441 return MArray<Bool>();
442 } else if (! a.hasMask()) {
443 Array<Bool> res;
444 partialArrayMath (res, a.array(), collapseAxes, AllFunc<T>());
445 return MArray<Bool>(res);
446 }
447 MArray<Bool> res;
448 partialArrayMath (res, a, collapseAxes, MAllFunc<T>());
449 return res;
450 }
451 // Get partial any.
452 template<typename T>
454 const IPosition& collapseAxes)
455 {
456 if (a.isNull()) {
457 return MArray<Bool>();
458 } else if (! a.hasMask()) {
459 Array<Bool> res;
460 partialArrayMath (res, a.array(), collapseAxes, AnyFunc<T>());
461 return MArray<Bool>(res);
462 }
463 MArray<Bool> res;
464 partialArrayMath (res, a, collapseAxes, MAnyFunc<T>());
465 return res;
466 }
467
468 // Get sliding ntrues.
469 template<typename T>
471 const IPosition& halfBoxSize, Bool fillEdge=True)
472 {
473 if (a.isNull()) {
474 return MArray<uInt>();
475 } else if (! a.hasMask()) {
476 Array<uInt> res;
477 slidingArrayMath (res, a.array(), halfBoxSize,
478 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.
486 template<typename T>
488 const IPosition& halfBoxSize, Bool fillEdge=True)
489 {
490 if (a.isNull()) {
491 return MArray<uInt>();
492 } else if (! a.hasMask()) {
493 Array<uInt> res;
494 slidingArrayMath (res, a.array(), halfBoxSize,
495 NFalseFunc<T,uInt>(), fillEdge);
496 return MArray<uInt>(res);
497 }
498 MArray<uInt> res;
499 slidingArrayMath (res, a, halfBoxSize, MNFalseFunc<T,uInt>(), fillEdge);
500 return res;
501 }
502 // Get sliding all.
503 template<typename T>
505 const IPosition& halfBoxSize, Bool fillEdge=True)
506 {
507 if (a.isNull()) {
508 return MArray<Bool>();
509 } else if (! a.hasMask()) {
510 Array<Bool> res;
511 slidingArrayMath (res, a.array(), halfBoxSize, AllFunc<T>(), fillEdge);
512 return MArray<Bool>(res);
513 }
514 MArray<Bool> res;
515 slidingArrayMath (res, a, halfBoxSize, MAllFunc<T>(), fillEdge);
516 return res;
517 }
518 // Get sliding any.
519 template<typename T>
521 const IPosition& halfBoxSize, Bool fillEdge=True)
522 {
523 if (a.isNull()) {
524 return MArray<Bool>();
525 } else if (! a.hasMask()) {
526 Array<Bool> res;
527 slidingArrayMath (res, a.array(), halfBoxSize, AnyFunc<T>(), fillEdge);
528 return MArray<Bool>(res);
529 }
530 MArray<Bool> res;
531 slidingArrayMath (res, a, halfBoxSize, MAnyFunc<T>(), fillEdge);
532 return res;
533 }
534
535 // Get boxed ntrues.
536 template<typename T>
538 const IPosition& boxSize)
539 {
540 if (a.isNull()) {
541 return MArray<uInt>();
542 } else if (! a.hasMask()) {
543 Array<uInt> res;
544 boxedArrayMath (res, a.array(), boxSize, NTrueFunc<T,uInt>());
545 return MArray<uInt>(res);
546 }
547 MArray<uInt> res;
548 boxedArrayMath (res, a, boxSize, MNTrueFunc<T,uInt>());
549 return res;
550 }
551 // Get boxed nfalses.
552 template<typename T>
554 const IPosition& boxSize)
555 {
556 if (a.isNull()) {
557 return MArray<uInt>();
558 } else if (! a.hasMask()) {
559 Array<uInt> res;
560 boxedArrayMath (res, a.array(), boxSize, NFalseFunc<T,uInt>());
561 return MArray<uInt>(res);
562 }
563 MArray<uInt> res;
564 boxedArrayMath (res, a, boxSize, MNFalseFunc<T,uInt>());
565 return res;
566 }
567 // Get boxed all.
568 template<typename T>
570 const IPosition& boxSize)
571 {
572 if (a.isNull()) {
573 return MArray<Bool>();
574 } else if (! a.hasMask()) {
575 Array<Bool> res;
576 boxedArrayMath (res, a.array(), boxSize, AllFunc<T>());
577 return MArray<Bool>(res);
578 }
579 MArray<Bool> res;
580 boxedArrayMath (res, a, boxSize, MAllFunc<T>());
581 return res;
582 }
583 // Get boxed any.
584 template<typename T>
586 const IPosition& boxSize)
587 {
588 if (a.isNull()) {
589 return MArray<Bool>();
590 } else if (! a.hasMask()) {
591 Array<Bool> res;
592 boxedArrayMath (res, a.array(), boxSize, AnyFunc<T>());
593 return MArray<Bool>(res);
594 }
595 MArray<Bool> res;
596 boxedArrayMath (res, a, boxSize, MAnyFunc<T>());
597 return res;
598 }
599
600 // </group>
601
602} //# end namespace
603
604#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? If they are not contiguous, getStorage (see below) needs to make a cop...
Definition ArrayBase.h:114
iterator begin()
Get the begin iterator object for any array.
Definition Array.h:844
contiter cbegin()
Get the begin iterator object for a contiguous array.
Definition Array.h:856
Array< Bool > combineMask(const MArrayBase &other) const
Combine this and the other mask.
Bool isNull() const
Is the array null?
Definition MArrayBase.h:109
const Array< Bool > & mask() const
Get the mask.
Definition MArrayBase.h:124
Bool hasMask() const
Is there a mask?
Definition MArrayBase.h:117
Define functors to perform a reduction function on an MArray object.
const Array< T > & array() const
Get access to the array.
Definition MArray.h:151
Logical functor to count the number of false elements.
Logical functor to count the number of true elements.
Bool isNull() const
Does the node contain no actual node?
Definition ExprNode.h:269
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
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.
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
Definition ExprNode.h:1634
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1254
TableExprNode isInf(const TableExprNode &node)
Definition ExprNode.h:1630
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition ExprNode.h:1933
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:127
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:133
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
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode operator!(const LatticeExprNode &expr)
const Bool True
Definition aipstype.h:41
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 operator||(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode nfalse(const LatticeExprNode &expr)
size_t nfalse(const MArray< T > &a)
Count the number of unmasked elements that are False.
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 > 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? The result is False if there are no unmasked elements.
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 > 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 > isNaN(const MArray< T > &arr)
Test which elements are NaN.
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 > 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 > 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< 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?
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.
Bool anyEQ(const MArray< T > &array, const T &value)