Loading...
Searching...
No Matches
MArrayMath.h
Go to the documentation of this file.
//# MArrayMath.h: Mathematical operations on MArray objects
//# Copyright (C) 2012
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef CASA_MARRAYMATH_H
#define CASA_MARRAYMATH_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/tables/TaQL/MArray.h>
#include <casacore/tables/TaQL/MArrayMathBase.h>
#include <casacore/casa/Arrays/ArrayPartMath.h>
#include <casacore/casa/Arrays/ArrayIter.h>
#include <casacore/casa/BasicMath/Functors.h>
#include <casacore/casa/Exceptions/Error.h>
#include <casacore/casa/Utilities/Assert.h>
#include <casacore/casa/Containers/Block.h>
namespace casacore {
// <summary>
// Mathematical operations for MArray objects.
// </summary>
//
// <reviewed reviewer="UNKNOWN" date="" tests="tMArrayMath">
//
// <prerequisite>
// <li> <linkto class=MArray>MArray</linkto>
// </prerequisite>
//
// <synopsis>
// These functions perform element by element mathematical operations on
// optionally masked arrays and/or scalars.
// If two arrays are used, the arrays must conform, except for allEQ which
// returns False if the arrays do not conform.
//
// The functions in this file can be divided in 3 groups:
// <ul>
// <li> Full array operations like ==, near, etc.
// They are defined for array-array and array-scalar operations. Arrays
// shapes have to be conformant. They operate on all elements
// (also the masked ones). The result is an MArray with the same
// shape as the input array(s). It will have a mask if one of the
// operands has a mask. If both operands have a mask, the resulting
// mask is the OR of both masks.
// <li> Full reduction functions like ntrue, all, allEQ, etc.
// They operate on the unmasked elements only. If there are no unmasked
// elements, the results is 0 or True.
// <li> Reduction functions working on unmasked elements in parts of the
// input array. The result is an MArray that has a mask if the input
// array has a mask. An output element is masked off if its input
// part has no unmasked elements.
// The functors defined at the beginning of this file are used to
// operate on each part.
// There are 3 flavours:
// <ul>
// <li> partialXXX reduces one or more axes. E.g. one can count the
// number of True elements for particular array axes.
// The result is an array with a lower dimensionality.
// They can be seen as a special versions of the boxedXXX functions.
// <li> slidingXXX operates in a sliding window over the array. So the
// result is an array with the same shape as the input, although
// the output array is smaller if the edge is not filled.
// <li> boxedXXX divides the input array in boxes with the given size
// and operates on each box. The result is an array with the same
// dimensionality, but with a smaller size.
// If the box size does not fit integrally, the edge box is smaller.
// </ul>
// </ul>
// </synopsis>
//
// <group name="MArray mathematical operations">
// Define functors to perform a reduction function on an MArray object.
// <group>
template<typename T> class MSumFunc : public MArrayFunctorBase<T> {
public:
virtual ~MSumFunc() {}
T operator() (const MArray<T>& arr) const { return sum(arr); }
};
template<typename T> class MSumSqrFunc : public MArrayFunctorBase<T> {
public:
virtual ~MSumSqrFunc() {}
T operator() (const MArray<T>& arr) const { return sumsqr(arr); }
};
template<typename T> class MProductFunc : public MArrayFunctorBase<T> {
public:
virtual ~MProductFunc() {}
T operator() (const MArray<T>& arr) const { return product(arr); }
};
template<typename T> class MMinFunc : public MArrayFunctorBase<T> {
public:
virtual ~MMinFunc() {}
T operator() (const MArray<T>& arr) const { return min(arr); }
};
template<typename T> class MMaxFunc : public MArrayFunctorBase<T> {
public:
virtual ~MMaxFunc() {}
T operator() (const MArray<T>& arr) const { return max(arr); }
};
template<typename T> class MMeanFunc : public MArrayFunctorBase<T> {
public:
virtual ~MMeanFunc() {}
T operator() (const MArray<T>& arr) const { return mean(arr); }
};
template<typename T> class MVarianceFunc : public MArrayFunctorBase<T> {
public:
explicit MVarianceFunc(uInt ddof=0)
: itsDdof(ddof) {}
virtual ~MVarianceFunc() {}
T operator() (const MArray<T>& arr) const { return variance(arr, itsDdof); }
private:
uInt itsDdof;
};
template<typename T> class MStddevFunc : public MArrayFunctorBase<T> {
public:
explicit MStddevFunc(uInt ddof=0)
: itsDdof(ddof) {}
~MStddevFunc() {}
T operator() (const MArray<T>& arr) const { return stddev(arr, itsDdof); }
private:
uInt itsDdof;
};
template<typename T> class MAvdevFunc : public MArrayFunctorBase<T> {
public:
virtual ~MAvdevFunc() {}
T operator() (const MArray<T>& arr) const { return avdev(arr); }
};
template<typename T> class MRmsFunc : public MArrayFunctorBase<T> {
public:
virtual ~MRmsFunc() {}
T operator() (const MArray<T>& arr) const { return rms(arr); }
};
template<typename T> class MMedianFunc : public MArrayFunctorBase<T> {
public:
explicit MMedianFunc (Bool sorted=False, Bool takeEvenMean=True,
Bool inPlace = False)
: itsSorted(sorted), itsTakeEvenMean(takeEvenMean), itsInPlace(inPlace) {}
virtual ~MMedianFunc() {}
T operator() (const MArray<T>& arr) const
{ return median(arr, itsSorted, itsTakeEvenMean, itsInPlace); }
private:
Bool itsSorted;
Bool itsTakeEvenMean;
Bool itsInPlace;
};
template<typename T> class MFractileFunc : public MArrayFunctorBase<T> {
public:
explicit MFractileFunc (Float fraction,
Bool sorted = False, Bool inPlace = False)
: itsFraction(fraction), itsSorted(sorted), itsInPlace(inPlace) {}
virtual ~MFractileFunc() {}
T operator() (const MArray<T>& arr) const
{ return fractile(arr, itsFraction, itsSorted, itsInPlace); }
private:
float itsFraction;
Bool itsSorted;
Bool itsInPlace;
};
// Do partial reduction of an MArray object. I.e., perform the operation
// on a subset of the array axes (the collapse axes).
template<typename T>
inline MArray<T> partialArrayMath (const MArray<T>& a,
const IPosition& collapseAxes,
const MArrayFunctorBase<T>& funcObj)
{
MArray<T> res;
partialArrayMath (res, a, collapseAxes, funcObj);
return res;
}
template<typename T, typename RES>
void partialArrayMath (MArray<RES>& res,
const MArray<T>& a,
const IPosition& collapseAxes,
const MArrayFunctorBase<T,RES>& funcObj)
{
AlwaysAssert (a.hasMask(), AipsError);
// This can also be done as boxedArrayMath with a removeDegenerate thereafter.
//
// It should be possible to parallelize this loop.
// Determine nr of iteration steps and iterate over that as an int.
// Do not use Array slicing, because that is not thread-safe.
// Instead create ArraySTLIterator directly from Array and blc,trc,
// so funcObj should accept iterators instead of Array.
// However, ArraySTLIterator needs the sliced array, not original.
// Maybe keep ref of itsSteps in iterator instead of array.
// Hmm, tricky for median and fractile.
// Better to make Array copy ctor thread-safe (thus use boost shared_ptr).
ReadOnlyArrayIterator<T> aiter(a.array(), collapseAxes);
ReadOnlyArrayIterator<Bool> miter(a.mask(), collapseAxes);
IPosition shape(a.array().shape().removeAxes (collapseAxes));
/*
Int64 nr = 1;
for (uInt i=0; i<collapseAxes.size(); ++i) {
nr *= a.array().shape()[collapseAxes[i]];
}
for (Int64 i=0; i<nr; ++i) {
IPosition pos = findPos(i);
IPosition endPos = pos + cursorShape - 1;
*data[pos] = funcObj(MArray<T>(a.array()(pos,endPos), a.mask()(pos,endpos)));
}
*/
res.resize (shape, False);
Array<Bool> resMask(shape);
RES* data = res.array().data();
Bool* mask = resMask.data();
while (!aiter.pastEnd()) {
if (allTrue(miter.array())) {
*mask++ = True;
*data++ = RES();
} else {
*mask++ = False;
*data++ = funcObj(MArray<T> (aiter.array(), miter.array()));
}
aiter.next();
miter.next();
}
res.setMask (resMask);
}
// </group>
template<typename T>
inline MArray<T> boxedArrayMath (const MArray<T>& a,
const IPosition& boxShape,
const MArrayFunctorBase<T>& funcObj)
{
MArray<T> res;
boxedArrayMath (res, a, boxShape, funcObj);
return res;
}
template<typename T, typename RES>
void boxedArrayMath (MArray<RES>& res,
const MArray<T>& array,
const IPosition& boxShape,
const MArrayFunctorBase<T,RES>& funcObj)
{
AlwaysAssert (array.hasMask(), AipsError);
const IPosition& shape = array.shape();
uInt ndim = shape.size();
IPosition fullBoxShape, resShape;
fillBoxedShape (shape, boxShape, fullBoxShape, resShape);
res.resize (resShape, False);
Array<Bool> resMask(resShape);
RES* data = res.array().data();
Bool* mask = resMask.data();
// Loop through all data and assemble as needed.
IPosition blc(ndim, 0);
IPosition trc(fullBoxShape-1);
while (True) {
Array<Bool> subMask (array.mask()(blc,trc));
if (allTrue(subMask)) {
*data++ = RES();
*mask++ = True;
} else {
*data++ = funcObj (MArray<T>(array.array()(blc,trc), subMask));
*mask++ = False;
}
uInt ax;
for (ax=0; ax<ndim; ++ax) {
blc[ax] += fullBoxShape[ax];
if (blc[ax] < shape[ax]) {
trc[ax] += fullBoxShape[ax];
if (trc[ax] >= shape[ax]) {
trc[ax] = shape[ax]-1;
}
break;
}
blc[ax] = 0;
trc[ax] = fullBoxShape[ax]-1;
}
if (ax == ndim) {
break;
}
}
res.setMask (resMask);
}
template <typename T>
inline MArray<T> slidingArrayMath (const MArray<T>& array,
const IPosition& halfBoxShape,
const MArrayFunctorBase<T>& funcObj,
Bool fillEdge=True)
{
MArray<T> res;
slidingArrayMath (res, array, halfBoxShape, funcObj, fillEdge);
return res;
}
template <typename T, typename RES>
void slidingArrayMath (MArray<RES>& res,
const MArray<T>& array,
const IPosition& halfBoxShape,
const MArrayFunctorBase<T,RES>& funcObj,
Bool fillEdge=True)
{
AlwaysAssert (array.hasMask(), AipsError);
const IPosition& shape = array.shape();
uInt ndim = shape.size();
IPosition boxEnd, resShape;
Bool empty = fillSlidingShape (shape, halfBoxShape, boxEnd, resShape);
if (fillEdge) {
res.resize (shape, False);
res.array() = RES();
Array<Bool> mask(shape, True);
res.setMask (mask);
} else {
res.resize (resShape, True);
}
if (!empty) {
Array<RES> resa (res.array());
Array<Bool> resm (res.mask());
if (fillEdge) {
IPosition boxEnd2 (boxEnd/2);
resa.reference (resa(boxEnd2, resShape+boxEnd2-1));
resm.reference (resm(boxEnd2, resShape+boxEnd2-1));
}
typename Array<RES>::iterator iterarr(resa.begin());
typename Array<Bool>::iterator itermask(resm.begin());
// Loop through all data and assemble as needed.
IPosition blc(ndim, 0);
IPosition trc(boxEnd);
IPosition pos(ndim, 0);
while (True) {
Array<Bool> subMask (array.mask()(blc,trc));
if (allTrue(subMask)) {
*iterarr = RES();
*itermask = True;
} else {
*iterarr = funcObj (MArray<T>(array.array()(blc,trc), subMask));
*itermask = False;
}
++iterarr;
++itermask;
uInt ax;
for (ax=0; ax<ndim; ++ax) {
if (++pos[ax] < resShape[ax]) {
blc[ax]++;
trc[ax]++;
break;
}
pos(ax) = 0;
blc[ax] = 0;
trc[ax] = boxEnd[ax];
}
if (ax == ndim) {
break;
}
}
}
}
// Add, subtract, etc. 2 arrays or array and scalar.
// <group>
template<typename T>
MArray<T> operator+ (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() + right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator- (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() - right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator* (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() * right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator/ (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() / right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator% (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() % right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator& (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() & right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator| (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() | right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator^ (const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (left.array() ^ right.array(),
left.combineMask(right))); }
template<typename T>
MArray<T> operator+ (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() + right, left); }
template<typename T>
MArray<T> operator- (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() - right, left); }
template<typename T>
MArray<T> operator* (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() * right, left); }
template<typename T>
MArray<T> operator/ (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() / right, left); }
template<typename T>
MArray<T> operator% (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() % right, left); }
template<typename T>
MArray<T> operator& (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() & right, left); }
template<typename T>
MArray<T> operator| (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() | right, left); }
template<typename T>
MArray<T> operator^ (const MArray<T>& left, const T& right)
{ return MArray<T> (left.array() ^ right, left); }
template<typename T>
MArray<T> operator+ (const T& left, const MArray<T>& right)
{ return MArray<T> (left + right.array(), right); }
template<typename T>
MArray<T> operator- (const T& left, const MArray<T>& right)
{ return MArray<T> (left - right.array(), right); }
template<typename T>
MArray<T> operator* (const T& left, const MArray<T>& right)
{ return MArray<T> (left * right.array(), right); }
template<typename T>
MArray<T> operator/ (const T& left, const MArray<T>& right)
{ return MArray<T> (left / right.array(), right); }
template<typename T>
MArray<T> operator% (const T& left, const MArray<T>& right)
{ return MArray<T> (left % right.array(), right); }
template<typename T>
MArray<T> operator& (const T& left, const MArray<T>& right)
{ return MArray<T> (left & right.array(), right); }
template<typename T>
MArray<T> operator| (const T& left, const MArray<T>& right)
{ return MArray<T> (left | right.array(), right); }
template<typename T>
MArray<T> operator^ (const T& left, const MArray<T>& right)
{ return MArray<T> (left ^ right.array(), right); }
// </group>
// Negate the elements in an array.
template<typename T>
MArray<T> operator- (const MArray<T>& a)
{ return MArray<T> (-a.array(), a); }
// Take the complement of the elements in an array.
template<typename T>
MArray<T> operator~ (const MArray<T>& a)
{ return MArray<T> (~a.array(), a); }
// Perform mathematical function on each element in an array.
// <group>
template<typename T>
MArray<T> sin(const MArray<T>& a)
{ return MArray<T> (sin(a.array()), a); }
template<typename T>
MArray<T> cos(const MArray<T>& a)
{ return MArray<T> (cos(a.array()), a); }
template<typename T>
MArray<T> tan(const MArray<T>& a)
{ return MArray<T> (tan(a.array()), a); }
template<typename T>
MArray<T> sinh(const MArray<T>& a)
{ return MArray<T> (sinh(a.array()), a); }
template<typename T>
MArray<T> cosh(const MArray<T>& a)
{ return MArray<T> (cosh(a.array()), a); }
template<typename T>
MArray<T> tanh(const MArray<T>& a)
{ return MArray<T> (tanh(a.array()), a); }
template<typename T>
MArray<T> asin(const MArray<T>& a)
{ return MArray<T> (asin(a.array()), a); }
template<typename T>
MArray<T> acos(const MArray<T>& a)
{ return MArray<T> (acos(a.array()), a); }
template<typename T>
MArray<T> atan(const MArray<T>& a)
{ return MArray<T> (atan(a.array()), a); }
template<typename T>
MArray<T> atan2(const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (atan2(left.array(), right.array()),
left.combineMask(right))); }
template<typename T>
MArray<T> atan2(const MArray<T>& left, const T& right)
{ return MArray<T> (atan2(left.array(), right), left); }
template<typename T>
MArray<T> atan2(const T& left, const MArray<T>& right)
{ return MArray<T> (atan2(left, right.array()), right); }
template<typename T>
MArray<T> exp(const MArray<T>& a)
{ return MArray<T> (exp(a.array()), a); }
template<typename T>
MArray<T> log(const MArray<T>& a)
{ return MArray<T> (log(a.array()), a); }
template<typename T>
MArray<T> log10(const MArray<T>& a)
{ return MArray<T> (log10(a.array()), a); }
template<typename T>
MArray<T> sqrt(const MArray<T>& a)
{ return MArray<T> (sqrt(a.array()), a); }
template<typename T>
MArray<T> square(const MArray<T>& a)
{ return MArray<T> (square(a.array()), a); }
template<typename T>
MArray<T> cube(const MArray<T>& a)
{ return MArray<T> (cube(a.array()), a); }
template<typename T>
MArray<T> pow(const MArray<T>& a, const MArray<T>& exp)
{ return (a.isNull() || exp.isNull() ? MArray<T>() :
MArray<T> (pow(a.array(), exp.array()),
a.combineMask(exp))); }
template<typename T>
MArray<T> pow(const T& a, const MArray<T>& exp)
{ return MArray<T> (pow(a, exp.array()), exp); }
template<typename T>
MArray<T> pow(const MArray<T>& a, const T& exp)
{ return MArray<T> (pow(a.array(), exp), a); }
template<typename T>
MArray<std::complex<T>> pow(const MArray<std::complex<T>>& a, const T& exp)
{ return MArray<std::complex<T>> (pow(a.array(), exp), a); }
template<typename T>
MArray<T> min(const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (min(left.array(), right.array()),
left.combineMask(right))); }
template<typename T>
MArray<T> min(const MArray<T>& left, const T& right)
{ return MArray<T> (min(left.array(), right), left); }
template<typename T>
MArray<T> min(const T& left, const MArray<T>& right)
{ return MArray<T> (min(left, right.array()), right); }
template<typename T>
MArray<T> max(const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (max(left.array(), right.array()),
left.combineMask(right))); }
template<typename T>
MArray<T> max(const MArray<T>& left, const T& right)
{ return MArray<T> (max(left.array(), right), left); }
template<typename T>
MArray<T> max(const T& left, const MArray<T>& right)
{ return MArray<T> (max(left, right.array()), right); }
template<typename T>
MArray<T> ceil(const MArray<T>& a)
{ return MArray<T> (ceil(a.array()), a); }
template<typename T>
MArray<T> floor(const MArray<T>& a)
{ return MArray<T> (floor(a.array()), a); }
template<typename T>
MArray<T> round(const MArray<T>& a)
{ return MArray<T> (round(a.array()), a); }
template<typename T>
MArray<T> sign(const MArray<T>& a)
{ return MArray<T> (sign(a.array()), a); }
template<typename T>
MArray<T> abs(const MArray<T>& a)
{ return MArray<T> (abs(a.array()), a); }
template<typename T>
MArray<T> fabs(const MArray<T>& a)
{ return MArray<T> (fabs(a.array()), a); }
template<typename T>
MArray<T> fmod(const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (fmod(left.array(), right.array()),
left.combineMask(right))); }
template<typename T>
MArray<T> fmod(const MArray<T>& left, const T& right)
{ return MArray<T> (fmod(left.array(), right), left); }
template<typename T>
MArray<T> fmod(const T& left, const MArray<T>& right)
{ return MArray<T> (fmod(left, right.array()), right); }
template<typename T>
MArray<T> floormod(const MArray<T>& left, const MArray<T>& right)
{ return (left.isNull() || right.isNull() ? MArray<T>() :
MArray<T> (floormod(left.array(), right.array()),
left.combineMask(right))); }
template<typename T>
MArray<T> floormod(const MArray<T>& left, const T& right)
{ return MArray<T> (floormod(left.array(), right), left); }
template<typename T>
MArray<T> floormod(const T& left, const MArray<T>& right)
{ return MArray<T> (floormod(left, right.array()), right); }
template<typename T>
MArray<T> conj(const MArray<T>& arr)
{ return MArray<T> (conj(arr.array()), arr); }
inline MArray<Float> real(const MArray<Complex> &arr)
{ return MArray<Float> (real(arr.array()), arr); }
inline MArray<Float> imag(const MArray<Complex> &arr)
{ return MArray<Float> (imag(arr.array()), arr); }
inline MArray<Float> amplitude(const MArray<Complex> &arr)
{ return MArray<Float> (amplitude(arr.array()), arr); }
inline MArray<Float> phase(const MArray<Complex> &arr)
{ return MArray<Float> (phase(arr.array()), arr); }
inline MArray<Double> real(const MArray<DComplex> &arr)
{ return MArray<Double> (real(arr.array()), arr); }
inline MArray<Double> imag(const MArray<DComplex> &arr)
{ return MArray<Double> (imag(arr.array()), arr); }
inline MArray<Double> amplitude(const MArray<DComplex> &arr)
{ return MArray<Double> (amplitude(arr.array()), arr); }
inline MArray<Double> phase(const MArray<DComplex> &arr)
{ return MArray<Double> (phase(arr.array()), arr); }
// </group>
// Reduce an array to a scalar using the unmasked elements only.
// The result is 0 if there are no unmasked elements.
// <group>
template<typename T>
T sum(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T(), std::plus<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T(), std::plus<T>());
}
return sum(a.array());
}
template<typename T>
T sumsqr(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T(), SumSqr<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T(), SumSqr<T>());
}
return sumsqr(a.array());
}
template<typename T>
T product(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), std::multiplies<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), std::multiplies<T>());
}
return product(a.array());
}
template<typename T>
T min(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), Min<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), Min<T>());
}
return min(a.array());
}
template<typename T>
T max(const MArray<T>& a)
{
if (a.hasMask()) {
return a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), Max<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), Max<T>());
}
return max(a.array());
}
template<typename T>
T mean(const MArray<T>& a)
{
Int64 nv = a.nvalid();
if (nv == 0) return T();
if (! a.hasMask()) return mean(a.array());
return T(sum(a) / (1.0*nv));
}
template<typename T>
T variance(const MArray<T>& a, T mean, uInt ddof)
{
Int64 nv = a.nvalid();
if (nv < ddof+1) return T();
if (! a.hasMask()) return pvariance(a.array(), mean, ddof);
T sum = a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T(), SumSqrDiff<T>(mean)) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T(), SumSqrDiff<T>(mean));
return T(sum / (1.0*nv - ddof));
}
template<typename T>
T variance(const MArray<T>& a, uInt ddof)
{
return variance(a, mean(a), ddof);
}
template<typename T>
T stddev(const MArray<T>& a, uInt ddof)
{
return sqrt(variance(a, ddof));
}
template<typename T>
T stddev(const MArray<T>& a, T mean, uInt ddof)
{
return sqrt(variance(a, mean, ddof));
}
template<typename T>
T avdev(const MArray<T>& a, T mean)
{
Int64 nv = a.nvalid();
if (nv == 0) return T();
if (! a.hasMask()) return avdev(a.array(), mean);
T sum = a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T(), SumAbsDiff<T>(mean)) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T(), SumAbsDiff<T>(mean));
return T(sum / (1.0*nv));
}
template<typename T>
T avdev(const MArray<T>& a)
{
return avdev(a, mean(a));
}
template<typename T>
T rms(const MArray<T>& a)
{
Int64 nv = a.nvalid();
if (nv == 0) return T();
if (! a.hasMask()) return rms(a.array());
T sum = a.array().contiguousStorage() && a.mask().contiguousStorage() ?
accumulateMasked<T>(a.array().cbegin(), a.array().cend(),
a.mask().cbegin(), T(), SumSqr<T>()) :
accumulateMasked<T>(a.array().begin(), a.array().end(),
a.mask().begin(), T(), SumSqr<T>());
return T(sqrt(sum / (1.0*nv)));
}
template<typename T>
T median(const MArray<T> &a, Bool sorted, Bool takeEvenMean,
Bool inPlace=False)
{
// The normal median function needs at least one element, so shortcut.
if (a.empty()) return T();
if (! a.hasMask()) return median(a.array(), sorted, takeEvenMean, inPlace);
Block<T> buf(a.size());
Int64 nv = a.flatten (buf.storage(), buf.size());
if (nv == 0) return T();
Array<T> arr(IPosition(1, nv), buf.storage(), SHARE);
// Median can be taken in place.
return median (arr, sorted, takeEvenMean, True);
}
template<typename T>
inline T median(const MArray<T> &a)
{ return median (a, False, (a.size() <= 100), False); }
template<typename T>
inline T median(const MArray<T> &a, Bool sorted)
{ return median (a, sorted, (a.nelements() <= 100), False); }
template<typename T>
inline T medianInPlace(const MArray<T> &a, Bool sorted = False)
{ return median (a, sorted, (a.nelements() <= 100), True); }
// Return the fractile of an array.
// It returns the value at the given fraction of the array.
// A fraction of 0.5 is the same as the median, be it that no mean of
// the two middle elements is taken if the array has an even nr of elements.
// It uses kthLargest if the array is not sorted yet.
template<typename T>
T fractile(const MArray<T> &a, Float fraction, Bool sorted=False,
Bool inPlace=False)
{
// The normal fractile function needs at least one element, so shortcut.
if (a.empty()) return T();
if (! a.hasMask()) return fractile(a.array(), fraction, sorted, inPlace);
Block<T> buf(a.size());
Int64 nv = a.flatten (buf.storage(), a.size());
if (nv == 0) return T();
Array<T> arr(IPosition(1, nv), buf.storage(), SHARE);
return fractile (arr, fraction, sorted, True);
}
// </group>
// Get partial sums, etc.
// <group>
template<typename T>
MArray<T> partialSums (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialSums (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MSumFunc<T>());
}
template<typename T>
MArray<T> partialSumSqrs (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialArrayMath (a.array(), collapseAxes,
SumSqrFunc<T>()));
}
return partialArrayMath (a, collapseAxes, MSumSqrFunc<T>());
}
template<typename T>
MArray<T> partialProducts (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialProducts (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MProductFunc<T>());
}
template<typename T>
MArray<T> partialMins (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialMins (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MMinFunc<T>());
}
template<typename T>
MArray<T> partialMaxs (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialMaxs (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MMaxFunc<T>());
}
template<typename T>
MArray<T> partialMeans (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialMeans (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MMeanFunc<T>());
}
template<typename T>
MArray<T> partialVariances (const MArray<T>& a,
const IPosition& collapseAxes,
uInt ddof)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialVariances (a.array(), collapseAxes, ddof));
}
return partialArrayMath (a, collapseAxes, MVarianceFunc<T>(ddof));
}
template<typename T>
MArray<T> partialStddevs (const MArray<T>& a,
const IPosition& collapseAxes,
uInt ddof)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialStddevs (a.array(), collapseAxes, ddof));
}
return partialArrayMath (a, collapseAxes, MStddevFunc<T>(ddof));
}
template<typename T>
MArray<T> partialAvdevs (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialAvdevs (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MAvdevFunc<T>());
}
template<typename T>
MArray<T> partialRmss (const MArray<T>& a,
const IPosition& collapseAxes)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialRmss (a.array(), collapseAxes));
}
return partialArrayMath (a, collapseAxes, MRmsFunc<T>());
}
template<typename T>
MArray<T> partialMedians (const MArray<T>& a,
const IPosition& collapseAxes,
Bool takeEvenMean=False,
Bool inPlace=False)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialMedians (a.array(), collapseAxes,
takeEvenMean, inPlace));
}
return partialArrayMath (a, collapseAxes,
MMedianFunc<T>(False, takeEvenMean, inPlace));
}
template<typename T>
MArray<T> partialFractiles (const MArray<T>& a,
const IPosition& collapseAxes,
Float fraction,
Bool inPlace=False)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(partialFractiles (a.array(), collapseAxes,
fraction, inPlace));
}
return partialArrayMath (a, collapseAxes,
MFractileFunc<T>(fraction, False, inPlace));
}
// </group>
// Get sliding sums.
// <group>
template<typename T>
MArray<T> slidingSums (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
SumFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MSumFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingSumSqrs (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
SumSqrFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MSumSqrFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingProducts (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
ProductFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MProductFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingMins (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
MinFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MMinFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingMaxs (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
MaxFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MMaxFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingMeans (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
MeanFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MMeanFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingVariances (const MArray<T>& a,
const IPosition& halfBoxSize,
uInt ddof,
Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
VarianceFunc<T>(ddof), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MVarianceFunc<T>(ddof), fillEdge);
}
template<typename T>
MArray<T> slidingStddevs (const MArray<T>& a,
const IPosition& halfBoxSize,
uInt ddof,
Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
StddevFunc<T>(ddof), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MStddevFunc<T>(ddof), fillEdge);
}
template<typename T>
MArray<T> slidingAvdevs (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
AvdevFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MAvdevFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingRmss (const MArray<T>& a,
const IPosition& halfBoxSize, Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
RmsFunc<T>(), fillEdge));
}
return slidingArrayMath (a, halfBoxSize, MRmsFunc<T>(), fillEdge);
}
template<typename T>
MArray<T> slidingMedians (const MArray<T>& a,
const IPosition& halfBoxSize,
Bool takeEvenMean=False,
Bool inPlace=False,
Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
MedianFunc<T>(False, takeEvenMean,
inPlace),
fillEdge));
}
return slidingArrayMath (a, halfBoxSize,
MMedianFunc<T>(False, takeEvenMean, inPlace),
fillEdge);
}
template<typename T>
MArray<T> slidingFractiles (const MArray<T>& a,
const IPosition& halfBoxSize,
Float fraction,
Bool inPlace=False,
Bool fillEdge=True)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(slidingArrayMath (a.array(), halfBoxSize,
FractileFunc<T>(fraction, False,
inPlace),
fillEdge));
}
return slidingArrayMath (a, halfBoxSize,
MFractileFunc<T>(fraction, False, inPlace),
fillEdge);
}
// </group>
// Get boxed sums.
// <group>
template<typename T>
MArray<T> boxedSums (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, SumFunc<T>()));
}
return boxedArrayMath (a, boxSize, MSumFunc<T>());
}
template<typename T>
MArray<T> boxedSumSqrs (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, SumSqrFunc<T>()));
}
return boxedArrayMath (a, boxSize, MSumSqrFunc<T>());
}
template<typename T>
MArray<T> boxedProducts (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, ProductFunc<T>()));
}
return boxedArrayMath (a, boxSize, MProductFunc<T>());
}
template<typename T>
MArray<T> boxedMins (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, MinFunc<T>()));
}
return boxedArrayMath (a, boxSize, MMinFunc<T>());
}
template<typename T>
MArray<T> boxedMaxs (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, MaxFunc<T>()));
}
return boxedArrayMath (a, boxSize, MMaxFunc<T>());
}
template<typename T>
MArray<T> boxedMeans (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, MeanFunc<T>()));
}
return boxedArrayMath (a, boxSize, MMeanFunc<T>());
}
template<typename T>
MArray<T> boxedVariances (const MArray<T>& a,
const IPosition& boxSize,
uInt ddof)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, VarianceFunc<T>(ddof)));
}
return boxedArrayMath (a, boxSize, MVarianceFunc<T>(ddof));
}
template<typename T>
MArray<T> boxedStddevs (const MArray<T>& a,
const IPosition& boxSize,
uInt ddof)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, StddevFunc<T>(ddof)));
}
return boxedArrayMath (a, boxSize, MStddevFunc<T>(ddof));
}
template<typename T>
MArray<T> boxedAvdevs (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, AvdevFunc<T>()));
}
return boxedArrayMath (a, boxSize, MAvdevFunc<T>());
}
template<typename T>
MArray<T> boxedRmss (const MArray<T>& a,
const IPosition& boxSize)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize, RmsFunc<T>()));
}
return boxedArrayMath (a, boxSize, MRmsFunc<T>());
}
template<typename T>
MArray<T> boxedMedians (const MArray<T>& a,
const IPosition& boxSize,
Bool takeEvenMean=False,
Bool inPlace=False)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize,
MedianFunc<T>(False, takeEvenMean,
inPlace)));
}
return boxedArrayMath (a, boxSize,
MMedianFunc<T>(False, takeEvenMean, inPlace));
}
template<typename T>
MArray<T> boxedFractiles (const MArray<T>& a,
const IPosition& boxSize,
Float fraction,
Bool inPlace=False)
{
if (a.isNull()) {
return MArray<T>();
} else if (! a.hasMask()) {
return MArray<T>(boxedArrayMath (a.array(), boxSize,
FractileFunc<T>(fraction, False,
inPlace)));
}
return boxedArrayMath (a, boxSize,
MFractileFunc<T>(fraction, False, inPlace));
}
// </group>
// </group>
} //# end namespace
#endif
AlwaysAssert
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
Definition Assert.h:155
casacore::AipsError
Definition Error.h:133
casacore::ArrayBase::contiguousStorage
bool contiguousStorage() const
Are the array data contiguous?
Definition ArrayBase.h:114
casacore::Array
Definition Array.h:155
casacore::Array::iterator
IteratorSTL iterator
Definition Array.h:837
casacore::Array::data
T * data()
Get a pointer to the beginning of the array.
Definition Array.h:592
casacore::Array::begin
iterator begin()
Get the begin iterator object for any array.
Definition Array.h:844
casacore::Array::cbegin
contiter cbegin()
Get the begin iterator object for a contiguous array.
Definition Array.h:856
casacore::Array::reference
virtual void reference(const Array< T > &other)
After invocation, this array and other reference the same storage.
casacore::Block
simple 1-D array
Definition Block.h:198
casacore::Block::storage
T * storage()
If you really, really, need a "raw" pointer to the beginning of the storage area this will give it to...
Definition Block.h:603
casacore::Block::size
size_t size() const
Definition Block.h:610
casacore::IPosition
Definition IPosition.h:117
casacore::MArrayBase::nvalid
Int64 nvalid() const
Return the number of valid array values, thus unflagged elements.
Definition MArrayBase.h:130
casacore::MArrayBase::empty
Bool empty() const
Is the array empty?
Definition MArrayBase.h:137
casacore::MArrayBase::combineMask
Array< Bool > combineMask(const MArrayBase &other) const
Combine this and the other mask.
casacore::MArrayBase::nelements
size_t nelements() const
Definition MArrayBase.h:152
casacore::MArrayBase::isNull
Bool isNull() const
Is the array null?
Definition MArrayBase.h:109
casacore::MArrayBase::setMask
void setMask(const Array< Bool > &mask)
Set the mask.
casacore::MArrayBase::mask
const Array< Bool > & mask() const
Get the mask.
Definition MArrayBase.h:124
casacore::MArrayBase::size
size_t size() const
Get the size.
Definition MArrayBase.h:150
casacore::MArrayBase::hasMask
Bool hasMask() const
Is there a mask?
Definition MArrayBase.h:117
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MAvdevFunc
Definition MArrayMath.h:145
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MAvdevFunc::~MAvdevFunc
virtual ~MAvdevFunc()
Definition MArrayMath.h:147
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MAvdevFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:148
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc
Definition MArrayMath.h:168
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::itsSorted
Bool itsSorted
Definition MArrayMath.h:178
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::~MFractileFunc
virtual ~MFractileFunc()
Definition MArrayMath.h:173
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::MFractileFunc
MFractileFunc(Float fraction, Bool sorted=False, Bool inPlace=False)
Definition MArrayMath.h:170
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:174
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::itsInPlace
Bool itsInPlace
Definition MArrayMath.h:179
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MFractileFunc::itsFraction
float itsFraction
Definition MArrayMath.h:177
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMaxFunc
Definition MArrayMath.h:117
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMaxFunc::~MMaxFunc
virtual ~MMaxFunc()
Definition MArrayMath.h:119
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMaxFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:120
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMeanFunc
Definition MArrayMath.h:122
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMeanFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:125
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMeanFunc::~MMeanFunc
virtual ~MMeanFunc()
Definition MArrayMath.h:124
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc
Definition MArrayMath.h:155
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::itsTakeEvenMean
Bool itsTakeEvenMean
Definition MArrayMath.h:165
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::itsInPlace
Bool itsInPlace
Definition MArrayMath.h:166
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::~MMedianFunc
virtual ~MMedianFunc()
Definition MArrayMath.h:160
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::MMedianFunc
MMedianFunc(Bool sorted=False, Bool takeEvenMean=True, Bool inPlace=False)
Definition MArrayMath.h:157
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::itsSorted
Bool itsSorted
Definition MArrayMath.h:164
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMedianFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:161
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMinFunc
Definition MArrayMath.h:112
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMinFunc::~MMinFunc
virtual ~MMinFunc()
Definition MArrayMath.h:114
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MMinFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:115
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MProductFunc
Definition MArrayMath.h:107
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MProductFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:110
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MProductFunc::~MProductFunc
virtual ~MProductFunc()
Definition MArrayMath.h:109
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MRmsFunc
Definition MArrayMath.h:150
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MRmsFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:153
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MRmsFunc::~MRmsFunc
virtual ~MRmsFunc()
Definition MArrayMath.h:152
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MStddevFunc
Definition MArrayMath.h:136
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MStddevFunc::MStddevFunc
MStddevFunc(uInt ddof=0)
Definition MArrayMath.h:138
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MStddevFunc::~MStddevFunc
~MStddevFunc()
Definition MArrayMath.h:140
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MStddevFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:141
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MStddevFunc::itsDdof
uInt itsDdof
Definition MArrayMath.h:143
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumFunc
Define functors to perform a reduction function on an MArray object.
Definition MArrayMath.h:97
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:100
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumFunc::~MSumFunc
virtual ~MSumFunc()
Definition MArrayMath.h:99
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumSqrFunc
Definition MArrayMath.h:102
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumSqrFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:105
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MSumSqrFunc::~MSumSqrFunc
virtual ~MSumSqrFunc()
Definition MArrayMath.h:104
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MVarianceFunc
Definition MArrayMath.h:127
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MVarianceFunc::itsDdof
uInt itsDdof
Definition MArrayMath.h:134
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MVarianceFunc::~MVarianceFunc
virtual ~MVarianceFunc()
Definition MArrayMath.h:131
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MVarianceFunc::MVarianceFunc
MVarianceFunc(uInt ddof=0)
Definition MArrayMath.h:129
casacore::MArrayMath_global_functions_MArray_mathematical_operations::MVarianceFunc::operator()
T operator()(const MArray< T > &arr) const
Definition MArrayMath.h:132
casacore::MArray
Definition MArray.h:68
casacore::MArray::flatten
Vector< T > flatten() const
Flatten the unmasked elements of the array to a vector.
Definition MArray.h:182
casacore::MArray::array
const Array< T > & array() const
Get access to the array.
Definition MArray.h:151
casacore::MArray::resize
void resize(const IPosition &shape, Bool useMask)
Resize the array and optionally the mask.
Definition MArray.h:120
casacore::ReadOnlyArrayIterator
Iterate a const Array cursor through a const Array.
Definition ArrayIter.h:170
casacore::ReadOnlyArrayIterator::array
const Array< T > & array()
Return the cursor.
Definition ArrayIter.h:202
casacore::ReadOnlyArrayIterator::next
void next()
Move the cursor to the next position.
Definition ArrayIter.h:182
casacore::ReadOnlyArrayIterator::pastEnd
bool pastEnd() const
Definition ArrayIter.h:207
casacore::SHARE
@ SHARE
Share means that the Array will just use the pointer (no copy), however the Array will NOT delete it ...
Definition ArrayBase.h:60
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::fractile
LatticeExprNode fractile(const LatticeExprNode &expr, const LatticeExprNode &fraction)
Determine the value of the element at the part fraction from the beginning of the given lattice.
casacore::False
const Bool False
Definition aipstype.h:42
casacore::exp
LatticeExprNode exp(const LatticeExprNode &expr)
casacore::operator|
TableExprNode operator|(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1190
casacore::asin
LatticeExprNode asin(const LatticeExprNode &expr)
casacore::fmod
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::acos
LatticeExprNode acos(const LatticeExprNode &expr)
casacore::ndim
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
casacore::mean
LatticeExprNode mean(const LatticeExprNode &expr)
casacore::boxedArrayMath
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.
casacore::max
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::cosh
LatticeExprNode cosh(const LatticeExprNode &expr)
casacore::atan
LatticeExprNode atan(const LatticeExprNode &expr)
casacore::operator&
TableExprNode operator&(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1185
casacore::tanh
LatticeExprNode tanh(const LatticeExprNode &expr)
casacore::sign
LatticeExprNode sign(const LatticeExprNode &expr)
casacore::log10
LatticeExprNode log10(const LatticeExprNode &expr)
casacore::conj
LatticeExprNode conj(const LatticeExprNode &expr)
casacore::operator%
LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
Definition LatticeExprNode.h:840
casacore::sinh
LatticeExprNode sinh(const LatticeExprNode &expr)
casacore::sum
LatticeExprNode sum(const LatticeExprNode &expr)
casacore::operator+
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
casacore::array
TYPE * array
the allocated array
Definition hdu.h:491
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::min
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::abs
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type.
casacore::amplitude
TableExprNode amplitude(const TableExprNode &node)
The amplitude (i.e.
Definition ExprNode.h:1444
casacore::phase
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition ExprNode.h:1452
casacore::operator-
LatticeExprNode operator-(const LatticeExprNode &expr)
casacore::tan
LatticeExprNode tan(const LatticeExprNode &expr)
casacore::mask
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
casacore::sin
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
casacore::operator/
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::atan2
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
casacore::variance
LatticeExprNode variance(const LatticeExprNode &expr)
casacore::Int64
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
casacore::square
TableExprNode square(const TableExprNode &node)
Definition ExprNode.h:1350
casacore::sqrt
LatticeExprNode sqrt(const LatticeExprNode &expr)
casacore::shape
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
casacore::Float
float Float
Definition aipstype.h:52
casacore::product
T product(const TableVector< T > &tv)
Definition TabVecMath.h:383
casacore::cube
TableExprNode cube(const TableExprNode &node)
Definition ExprNode.h:1355
casacore::avdev
LatticeExprNode avdev(const LatticeExprNode &expr)
casacore::empty
bool empty() const
Is the record empty?
Definition RecordInterface.h:229
casacore::pow
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
casacore::log
LatticeExprNode log(const LatticeExprNode &expr)
casacore::operator*
T & operator*()
Provide access to the field's value.
Definition RecordField.h:142
casacore::fillSlidingShape
bool fillSlidingShape(const IPosition &shape, const IPosition &halfBoxSize, IPosition &boxEnd, IPosition &resultShape)
Determine the box end and shape of result for a sliding operation.
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::operator^
LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
Definition LatticeExprNode.h:843
casacore::cos
LatticeExprNode cos(const LatticeExprNode &expr)
casacore::floor
LatticeExprNode floor(const LatticeExprNode &expr)
casacore::True
const Bool True
Definition aipstype.h:41
casacore::median
LatticeExprNode median(const LatticeExprNode &expr)
casacore::round
LatticeExprNode round(const LatticeExprNode &expr)
casacore::ceil
LatticeExprNode ceil(const LatticeExprNode &expr)
casacore::real
LatticeExprNode real(const LatticeExprNode &expr)
casacore::slidingArrayMath
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...
casacore::imag
LatticeExprNode imag(const LatticeExprNode &expr)
casacore::fillBoxedShape
void fillBoxedShape(const IPosition &shape, const IPosition &boxShape, IPosition &fullBoxShape, IPosition &resultShape)
Helper functions for boxed and sliding functions.
casacore::rms
TableExprNode rms(const TableExprNode &array)
Definition ExprNode.h:1684
casacore::MArrayMath_global_functions_MArray_mathematical_operations
Definition MArrayMath.h:94
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sqrt
MArray< T > sqrt(const MArray< T > &a)
Definition MArrayMath.h:568
casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2
MArray< T > atan2(const MArray< T > &left, const T &right)
Definition MArrayMath.h:548
casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod
MArray< T > floormod(const MArray< T > &left, const T &right)
Definition MArrayMath.h:670
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator^
MArray< T > operator^(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:423
casacore::MArrayMath_global_functions_MArray_mathematical_operations::medianInPlace
T medianInPlace(const MArray< T > &a, Bool sorted=False)
Definition MArrayMath.h:871
casacore::MArrayMath_global_functions_MArray_mathematical_operations::floor
MArray< T > floor(const MArray< T > &a)
Definition MArrayMath.h:630
casacore::MArrayMath_global_functions_MArray_mathematical_operations::amplitude
MArray< Double > amplitude(const MArray< DComplex > &arr)
Definition MArrayMath.h:699
casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod
MArray< T > fmod(const MArray< T > &left, const T &right)
Definition MArrayMath.h:656
casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2
MArray< T > atan2(const T &left, const MArray< T > &right)
Definition MArrayMath.h:552
casacore::MArrayMath_global_functions_MArray_mathematical_operations::max
MArray< T > max(const T &left, const MArray< T > &right)
Definition MArrayMath.h:622
casacore::MArrayMath_global_functions_MArray_mathematical_operations::phase
MArray< Double > phase(const MArray< DComplex > &arr)
Definition MArrayMath.h:702
casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow
MArray< T > pow(const MArray< T > &a, const T &exp)
Definition MArrayMath.h:590
casacore::MArrayMath_global_functions_MArray_mathematical_operations::product
T product(const MArray< T > &a)
Definition MArrayMath.h:737
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialRmss
MArray< T > partialRmss(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:999
casacore::MArrayMath_global_functions_MArray_mathematical_operations::tan
MArray< T > tan(const MArray< T > &a)
Definition MArrayMath.h:514
casacore::MArrayMath_global_functions_MArray_mathematical_operations::cube
MArray< T > cube(const MArray< T > &a)
Definition MArrayMath.h:576
casacore::MArrayMath_global_functions_MArray_mathematical_operations::max
MArray< T > max(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:612
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath
void slidingArrayMath(MArray< RES > &res, const MArray< T > &array, const IPosition &halfBoxShape, const MArrayFunctorBase< T, RES > &funcObj, Bool fillEdge=True)
Definition MArrayMath.h:315
casacore::MArrayMath_global_functions_MArray_mathematical_operations::log10
MArray< T > log10(const MArray< T > &a)
Definition MArrayMath.h:564
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialFractiles
MArray< T > partialFractiles(const MArray< T > &a, const IPosition &collapseAxes, Float fraction, Bool inPlace=False)
Definition MArrayMath.h:1025
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator+
MArray< T > operator+(const MArray< T > &left, const MArray< T > &right)
Add, subtract, etc.
Definition MArrayMath.h:381
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sum
T sum(const MArray< T > &a)
Reduce an array to a scalar using the unmasked elements only.
Definition MArrayMath.h:711
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMedians
MArray< T > slidingMedians(const MArray< T > &a, const IPosition &halfBoxSize, Bool takeEvenMean=False, Bool inPlace=False, Bool fillEdge=True)
Definition MArrayMath.h:1168
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedProducts
MArray< T > boxedProducts(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1232
casacore::MArrayMath_global_functions_MArray_mathematical_operations::square
MArray< T > square(const MArray< T > &a)
Definition MArrayMath.h:572
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingAvdevs
MArray< T > slidingAvdevs(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1144
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingVariances
MArray< T > slidingVariances(const MArray< T > &a, const IPosition &halfBoxSize, uInt ddof, Bool fillEdge=True)
Definition MArrayMath.h:1116
casacore::MArrayMath_global_functions_MArray_mathematical_operations::cosh
MArray< T > cosh(const MArray< T > &a)
Definition MArrayMath.h:522
casacore::MArrayMath_global_functions_MArray_mathematical_operations::min
MArray< T > min(const MArray< T > &left, const T &right)
Definition MArrayMath.h:604
casacore::MArrayMath_global_functions_MArray_mathematical_operations::phase
MArray< Float > phase(const MArray< Complex > &arr)
Definition MArrayMath.h:690
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath
MArray< T > partialArrayMath(const MArray< T > &a, const IPosition &collapseAxes, const MArrayFunctorBase< T > &funcObj)
Do partial reduction of an MArray object.
Definition MArrayMath.h:186
casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow
MArray< std::complex< T > > pow(const MArray< std::complex< T > > &a, const T &exp)
Definition MArrayMath.h:594
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator%
MArray< T > operator%(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:405
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMedians
MArray< T > boxedMedians(const MArray< T > &a, const IPosition &boxSize, Bool takeEvenMean=False, Bool inPlace=False)
Definition MArrayMath.h:1322
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSums
MArray< T > partialSums(const MArray< T > &a, const IPosition &collapseAxes)
Get partial sums, etc.
Definition MArrayMath.h:897
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator/
MArray< T > operator/(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:399
casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev
T avdev(const MArray< T > &a)
Definition MArrayMath.h:831
casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod
MArray< T > fmod(const T &left, const MArray< T > &right)
Definition MArrayMath.h:660
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sign
MArray< T > sign(const MArray< T > &a)
Definition MArrayMath.h:638
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath
MArray< T > boxedArrayMath(const MArray< T > &a, const IPosition &boxShape, const MArrayFunctorBase< T > &funcObj)
Definition MArrayMath.h:249
casacore::MArrayMath_global_functions_MArray_mathematical_operations::abs
MArray< T > abs(const MArray< T > &a)
Definition MArrayMath.h:642
casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod
MArray< T > floormod(const T &left, const MArray< T > &right)
Definition MArrayMath.h:674
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMeans
MArray< T > boxedMeans(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1265
casacore::MArrayMath_global_functions_MArray_mathematical_operations::cos
MArray< T > cos(const MArray< T > &a)
Definition MArrayMath.h:510
casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms
T rms(const MArray< T > &a)
Definition MArrayMath.h:837
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedAvdevs
MArray< T > boxedAvdevs(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1300
casacore::MArrayMath_global_functions_MArray_mathematical_operations::log
MArray< T > log(const MArray< T > &a)
Definition MArrayMath.h:560
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSumSqrs
MArray< T > slidingSumSqrs(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1056
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSumSqrs
MArray< T > partialSumSqrs(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:908
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator&
MArray< T > operator&(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:411
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath
MArray< T > slidingArrayMath(const MArray< T > &array, const IPosition &halfBoxShape, const MArrayFunctorBase< T > &funcObj, Bool fillEdge=True)
Definition MArrayMath.h:305
casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance
T variance(const MArray< T > &a, T mean, uInt ddof)
Definition MArrayMath.h:785
casacore::MArrayMath_global_functions_MArray_mathematical_operations::median
T median(const MArray< T > &a, Bool sorted)
Definition MArrayMath.h:868
casacore::MArrayMath_global_functions_MArray_mathematical_operations::imag
MArray< Double > imag(const MArray< DComplex > &arr)
Definition MArrayMath.h:696
casacore::MArrayMath_global_functions_MArray_mathematical_operations::acos
MArray< T > acos(const MArray< T > &a)
Definition MArrayMath.h:534
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMaxs
MArray< T > slidingMaxs(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1092
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMedians
MArray< T > partialMedians(const MArray< T > &a, const IPosition &collapseAxes, Bool takeEvenMean=False, Bool inPlace=False)
Definition MArrayMath.h:1010
casacore::MArrayMath_global_functions_MArray_mathematical_operations::exp
MArray< T > exp(const MArray< T > &a)
Definition MArrayMath.h:556
casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod
MArray< T > fmod(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:650
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedFractiles
MArray< T > boxedFractiles(const MArray< T > &a, const IPosition &boxSize, Float fraction, Bool inPlace=False)
Definition MArrayMath.h:1338
casacore::MArrayMath_global_functions_MArray_mathematical_operations::max
T max(const MArray< T > &a)
Definition MArrayMath.h:763
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sin
MArray< T > sin(const MArray< T > &a)
Perform mathematical function on each element in an array.
Definition MArrayMath.h:506
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMaxs
MArray< T > partialMaxs(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:942
casacore::MArrayMath_global_functions_MArray_mathematical_operations::real
MArray< Double > real(const MArray< DComplex > &arr)
Definition MArrayMath.h:693
casacore::MArrayMath_global_functions_MArray_mathematical_operations::tanh
MArray< T > tanh(const MArray< T > &a)
Definition MArrayMath.h:526
casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev
T avdev(const MArray< T > &a, T mean)
Definition MArrayMath.h:817
casacore::MArrayMath_global_functions_MArray_mathematical_operations::min
MArray< T > min(const T &left, const MArray< T > &right)
Definition MArrayMath.h:608
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMeans
MArray< T > slidingMeans(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1104
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSumSqrs
MArray< T > boxedSumSqrs(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1221
casacore::MArrayMath_global_functions_MArray_mathematical_operations::round
MArray< T > round(const MArray< T > &a)
Definition MArrayMath.h:634
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingFractiles
MArray< T > slidingFractiles(const MArray< T > &a, const IPosition &halfBoxSize, Float fraction, Bool inPlace=False, Bool fillEdge=True)
Definition MArrayMath.h:1187
casacore::MArrayMath_global_functions_MArray_mathematical_operations::ceil
MArray< T > ceil(const MArray< T > &a)
Definition MArrayMath.h:626
casacore::MArrayMath_global_functions_MArray_mathematical_operations::min
T min(const MArray< T > &a)
Definition MArrayMath.h:750
casacore::MArrayMath_global_functions_MArray_mathematical_operations::amplitude
MArray< Float > amplitude(const MArray< Complex > &arr)
Definition MArrayMath.h:687
casacore::MArrayMath_global_functions_MArray_mathematical_operations::imag
MArray< Float > imag(const MArray< Complex > &arr)
Definition MArrayMath.h:684
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingStddevs
MArray< T > slidingStddevs(const MArray< T > &a, const IPosition &halfBoxSize, uInt ddof, Bool fillEdge=True)
Definition MArrayMath.h:1130
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialStddevs
MArray< T > partialStddevs(const MArray< T > &a, const IPosition &collapseAxes, uInt ddof)
Definition MArrayMath.h:976
casacore::MArrayMath_global_functions_MArray_mathematical_operations::stddev
T stddev(const MArray< T > &a, T mean, uInt ddof)
Definition MArrayMath.h:811
casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2
MArray< T > atan2(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:542
casacore::MArrayMath_global_functions_MArray_mathematical_operations::asin
MArray< T > asin(const MArray< T > &a)
Definition MArrayMath.h:530
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedVariances
MArray< T > boxedVariances(const MArray< T > &a, const IPosition &boxSize, uInt ddof)
Definition MArrayMath.h:1276
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr
T sumsqr(const MArray< T > &a)
Definition MArrayMath.h:724
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMaxs
MArray< T > boxedMaxs(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1254
casacore::MArrayMath_global_functions_MArray_mathematical_operations::mean
T mean(const MArray< T > &a)
Definition MArrayMath.h:776
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMins
MArray< T > slidingMins(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1080
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialAvdevs
MArray< T > partialAvdevs(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:988
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSums
MArray< T > boxedSums(const MArray< T > &a, const IPosition &boxSize)
Get boxed sums.
Definition MArrayMath.h:1210
casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan
MArray< T > atan(const MArray< T > &a)
Definition MArrayMath.h:538
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMins
MArray< T > partialMins(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:931
casacore::MArrayMath_global_functions_MArray_mathematical_operations::max
MArray< T > max(const MArray< T > &left, const T &right)
Definition MArrayMath.h:618
casacore::MArrayMath_global_functions_MArray_mathematical_operations::median
T median(const MArray< T > &a)
Definition MArrayMath.h:865
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath
void boxedArrayMath(MArray< RES > &res, const MArray< T > &array, const IPosition &boxShape, const MArrayFunctorBase< T, RES > &funcObj)
Definition MArrayMath.h:258
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator-
MArray< T > operator-(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:387
casacore::MArrayMath_global_functions_MArray_mathematical_operations::conj
MArray< T > conj(const MArray< T > &arr)
Definition MArrayMath.h:678
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingProducts
MArray< T > slidingProducts(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1068
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedRmss
MArray< T > boxedRmss(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1311
casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow
MArray< T > pow(const MArray< T > &a, const MArray< T > &exp)
Definition MArrayMath.h:580
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingRmss
MArray< T > slidingRmss(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Definition MArrayMath.h:1156
casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile
T fractile(const MArray< T > &a, Float fraction, Bool sorted=False, Bool inPlace=False)
Return the fractile of an array.
Definition MArrayMath.h:880
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMeans
MArray< T > partialMeans(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:953
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator|
MArray< T > operator|(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:417
casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow
MArray< T > pow(const T &a, const MArray< T > &exp)
Definition MArrayMath.h:586
casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator~
MArray< T > operator~(const MArray< T > &a)
Take the complement of the elements in an array.
Definition MArrayMath.h:500
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialVariances
MArray< T > partialVariances(const MArray< T > &a, const IPosition &collapseAxes, uInt ddof)
Definition MArrayMath.h:964
casacore::MArrayMath_global_functions_MArray_mathematical_operations::fabs
MArray< T > fabs(const MArray< T > &a)
Definition MArrayMath.h:646
casacore::MArrayMath_global_functions_MArray_mathematical_operations::min
MArray< T > min(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:598
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath
void partialArrayMath(MArray< RES > &res, const MArray< T > &a, const IPosition &collapseAxes, const MArrayFunctorBase< T, RES > &funcObj)
Definition MArrayMath.h:195
casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialProducts
MArray< T > partialProducts(const MArray< T > &a, const IPosition &collapseAxes)
Definition MArrayMath.h:920
casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance
T variance(const MArray< T > &a, uInt ddof)
Definition MArrayMath.h:799
casacore::MArrayMath_global_functions_MArray_mathematical_operations::sinh
MArray< T > sinh(const MArray< T > &a)
Definition MArrayMath.h:518
casacore::MArrayMath_global_functions_MArray_mathematical_operations::stddev
T stddev(const MArray< T > &a, uInt ddof)
Definition MArrayMath.h:805
casacore::MArrayMath_global_functions_MArray_mathematical_operations::median
T median(const MArray< T > &a, Bool sorted, Bool takeEvenMean, Bool inPlace=False)
Definition MArrayMath.h:851
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedStddevs
MArray< T > boxedStddevs(const MArray< T > &a, const IPosition &boxSize, uInt ddof)
Definition MArrayMath.h:1288
casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMins
MArray< T > boxedMins(const MArray< T > &a, const IPosition &boxSize)
Definition MArrayMath.h:1243
casacore::MArrayMath_global_functions_MArray_mathematical_operations::real
MArray< Float > real(const MArray< Complex > &arr)
Definition MArrayMath.h:681
casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSums
MArray< T > slidingSums(const MArray< T > &a, const IPosition &halfBoxSize, Bool fillEdge=True)
Get sliding sums.
Definition MArrayMath.h:1044
casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod
MArray< T > floormod(const MArray< T > &left, const MArray< T > &right)
Definition MArrayMath.h:664
casacore::Max
Functor to get maximum of two values.
Definition Functors.h:588
casacore::Min
Functor to get minimum of two values.
Definition Functors.h:580
casacore::SumAbsDiff
Functor to add absolute diff of right and base value to left.
Definition Functors.h:634
casacore::SumSqrDiff
Functor to add squared diff of right and base value to left.
Definition Functors.h:606
casacore::SumSqr
Functor to add square of right to left.
Definition Functors.h:596