26#ifndef CASA_MARRAYMATHBASE_H 
   27#define CASA_MARRAYMATHBASE_H 
   29#include <casacore/casa/aips.h> 
   30#include <casacore/casa/Arrays/ArrayMathBase.h> 
   35  template<
typename T> 
class MArray;
 
   70  template<
typename T, 
typename ARRAYITER, 
typename MASKITER, 
typename OPER>
 
   75    for (; abegin!=aend; ++abegin, ++mbegin) {
 
   76      if (!*mbegin) { accum = *abegin; ++abegin; ++mbegin; 
break; }
 
   78    for (; abegin!=aend; ++abegin, ++mbegin) {
 
   79      if (!*mbegin) accum = oper(accum, *abegin);
 
 
   86  template<
typename T, 
typename ARRAYITER, 
typename MASKITER, 
typename OPER>
 
   90    for (; abegin!=aend; ++abegin, ++mbegin) {
 
   91      if (!*mbegin) accum = oper(accum, *abegin);
 
 
   99  template<
typename T, 
typename ARRAYITER, 
typename MASKITER>
 
  100    size_t countMasked (ARRAYITER abegin, ARRAYITER aend, MASKITER mbegin,
 
  104      for (; abegin!=aend; ++abegin, ++mbegin) {
 
  105        if (!*mbegin  &&  *abegin == 
value) ++n;
 
 
  112  template<
typename T, 
typename ARRAYITER, 
typename MASKITER>
 
  117      for (; abegin!=aend; ++abegin, ++mbegin) {
 
  118        if (!*mbegin  &&  *abegin != 
value) ++n;
 
 
  128  template<
typename InputIterator1, 
typename InputIterator2,
 
  129           typename MaskIterator, 
typename CompareOperator>
 
  131                                InputIterator2 first2,
 
  132                                MaskIterator mask1, MaskIterator mask2,
 
  135    for (; first1!=last1; ++first1, ++first2, ++mask1, ++mask2) {
 
  136      if (!*mask1 && !*mask2) {
 
  137        if (!op(*first1, *first2)) 
return False;
 
 
  142  template<
typename InputIterator1, 
typename InputIterator2,
 
  143           typename MaskIterator, 
typename CompareOperator>
 
  145                                InputIterator2 first2,
 
  149    for (; first1!=last1; ++first1, ++first2, ++mask1) {
 
  151        if (!op(*first1, *first2)) 
return False;
 
 
  159  template<
typename InputIterator1, 
typename T,
 
  160           typename MaskIterator, 
typename CompareOperator>
 
  162                                    T left, MaskIterator mask1,
 
  165    for (; first1!=last1; ++first1, ++mask1) {
 
  167        if (!op(left, *first1)) 
return False;
 
 
  175  template<
typename InputIterator1, 
typename T,
 
  176           typename MaskIterator, 
typename CompareOperator>
 
  178                                    T right, MaskIterator mask1,
 
  181    for (; first1!=last1; ++first1, ++mask1) {
 
  183        if (!op(*first1, right)) 
return False;
 
 
  195  template<
typename InputIterator1, 
typename InputIterator2,
 
  196           typename MaskIterator, 
typename CompareOperator>
 
  198                                InputIterator2 first2,
 
  199                                MaskIterator mask1, MaskIterator mask2,
 
  202    for (; first1!=last1; ++first1, ++first2, ++mask1, ++mask2) {
 
  203      if (!*mask1 && !*mask2) {
 
  204        if (op(*first1, *first2)) 
return true;
 
 
  209  template<
typename InputIterator1, 
typename InputIterator2,
 
  210           typename MaskIterator, 
typename CompareOperator>
 
  212                                InputIterator2 first2,
 
  216    for (; first1!=last1; ++first1, ++first2, ++mask1) {
 
  218        if (op(*first1, *first2)) 
return true;
 
 
  226  template<
typename InputIterator1, 
typename T,
 
  227           typename MaskIterator, 
typename CompareOperator>
 
  229                                    T left, MaskIterator mask1,
 
  232    for (; first1!=last1; ++first1, ++mask1) {
 
  234        if (op(left, *first1)) 
return true;
 
 
  242  template<
typename InputIterator1, 
typename T,
 
  243           typename MaskIterator, 
typename CompareOperator>
 
  245                                    T right, MaskIterator mask1,
 
  248    for (; first1!=last1; ++first1, ++mask1) {
 
  250        if (op(*first1, right)) 
return true;
 
 
 
Define the base class for functors to perform a reduction function on an MArray object.
virtual ~MArrayFunctorBase()
virtual RES operator()(const MArray< T > &) const =0
this file contains all the compiler specific defines
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
T accumulateMasked(ARRAYITER abegin, ARRAYITER aend, MASKITER mbegin, OPER oper)
Define STL-like accumulate function operating on arrays with masks.
bool compareAnyRightMasked(InputIterator1 first1, InputIterator1 last1, T right, MaskIterator mask1, CompareOperator op)
For use with a constant right value.
bool compareAnyLeftMasked(InputIterator1 first1, InputIterator1 last1, T left, MaskIterator mask1, CompareOperator op)
For use with a constant left value.
bool compareAllRightMasked(InputIterator1 first1, InputIterator1 last1, T right, MaskIterator mask1, CompareOperator op)
For use with a constant right value.
size_t countNEMasked(ARRAYITER abegin, ARRAYITER aend, MASKITER mbegin, const T &value)
Count the number of unmasked values not matching the given value.
bool compareAllMasked(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, MaskIterator mask1, MaskIterator mask2, CompareOperator op)
Define a function to compare the unmasked elements of two sequences.
bool compareAnyMasked(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, MaskIterator mask1, MaskIterator mask2, CompareOperator op)
Define a function to compare the unmasked elements of two sequences.
T accumulateMasked(ARRAYITER abegin, ARRAYITER aend, MASKITER mbegin, T accum, OPER oper)
The second function uses an externally initialized accumulator (e.g.
bool compareAllMasked(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, MaskIterator mask1, CompareOperator op)
bool compareAllLeftMasked(InputIterator1 first1, InputIterator1 last1, T left, MaskIterator mask1, CompareOperator op)
For use with a constant left value.
bool compareAnyMasked(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, MaskIterator mask1, CompareOperator op)
size_t countMasked(ARRAYITER abegin, ARRAYITER aend, MASKITER mbegin, const T &value)
Count the number of unmasked values matching the given value.