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