28 #ifndef CASA_ARRAYPARTMATH_2_H
29 #define CASA_ARRAYPARTMATH_2_H
120 template<
typename T,
typename Alloc>
122 const IPosition& collapseAxes,
size_t ddof=1)
124 return partialVariances (
array, collapseAxes,
125 partialMeans (
array, collapseAxes), ddof);
139 return sqrt (partialVariances (
array, collapseAxes,
140 partialMeans (
array, collapseAxes), ddof));
147 return sqrt (partialVariances (
array, collapseAxes,
means, ddof));
152 return partialAvdevs (
array, collapseAxes,
153 partialMeans (
array, collapseAxes));
162 bool takeEvenMean=
false,
166 bool takeEvenMean=
false,
179 {
return partialInterFractileRanges (
array, collapseAxes, 1./6., inPlace); }
183 {
return partialInterFractileRanges (
array, collapseAxes, 0.25, inPlace); }
199 virtual T operator() (
const Array<T, Alloc>& arr)
const final override {
return sumsqr(arr); }
226 virtual T operator() (
const Array<T, Alloc>& arr)
const final override {
return pvariance(arr, itsDdof); }
235 virtual T operator() (
const Array<T, Alloc>& arr)
const final override {
return pstddev(arr, itsDdof); }
251 explicit MedianFunc (
bool sorted=
false,
bool takeEvenMean=
true,
252 bool inPlace =
false)
253 : itsSorted(sorted), itsTakeEvenMean(takeEvenMean), itsInPlace(inPlace) {}
256 {
return median(arr, itsTmp, itsSorted, itsTakeEvenMean, itsInPlace); }
265 explicit MadfmFunc(
bool sorted =
false,
bool takeEvenMean =
true,
266 bool inPlace =
false)
267 : itsSorted(sorted), itsTakeEvenMean(takeEvenMean), itsInPlace(inPlace) {}
270 {
return madfm(arr, itsTmp, itsSorted, itsTakeEvenMean, itsInPlace); }
280 bool sorted =
false,
bool inPlace =
false)
281 : itsFraction(fraction), itsSorted(sorted), itsInPlace(inPlace) {}
284 {
return fractile(arr, itsTmp, itsFraction, itsSorted, itsInPlace); }
294 bool sorted =
false,
bool inPlace =
false)
295 : itsFraction(fraction), itsSorted(sorted), itsInPlace(inPlace) {}
298 {
return interFractileRange(arr, itsTmp, itsFraction,
299 itsSorted, itsInPlace); }
325 template<
typename T,
typename Alloc=std::allocator<T>>
331 partialArrayMath (res, a, collapseAxes, funcObj);
334 template<
typename T,
typename Alloc,
typename RES,
typename RESAlloc>
353 template<
typename T,
typename Alloc>
362 template<
typename T,
typename Alloc,
typename RES,
typename RESAlloc>
392 template<
typename T,
typename Alloc=std::allocator<T>>
402 template<
typename T,
typename Alloc,
typename RES,
typename RESAlloc>
424 #include "ArrayPartMath.tcc"
FractileFunc(float fraction, bool sorted=false, bool inPlace=false)
virtual ~InterFractileRangeFunc()
virtual T operator()(const Array< T, Alloc > &arr) const final override
InterFractileRangeFunc(float fraction, bool sorted=false, bool inPlace=false)
virtual ~InterHexileRangeFunc()
InterHexileRangeFunc(bool sorted=false, bool inPlace=false)
InterQuartileRangeFunc(bool sorted=false, bool inPlace=false)
virtual ~InterQuartileRangeFunc()
MadfmFunc(bool sorted=false, bool takeEvenMean=true, bool inPlace=false)
virtual T operator()(const Array< T, Alloc > &arr) const final override
Define functors to perform a reduction function on an Array object.
VarianceFunc(size_t ddof)
this file contains all the compiler specific defines
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.
TableExprNode means(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
LatticeExprNode mean(const LatticeExprNode &expr)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode sum(const LatticeExprNode &expr)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
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 shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
LatticeExprNode sqrt(const LatticeExprNode &expr)
T product(const TableVector< T > &tv)
LatticeExprNode avdev(const LatticeExprNode &expr)
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 fillSlidingShape(const IPosition &shape, const IPosition &halfBoxSize, IPosition &boxEnd, IPosition &resultShape)
Determine the box end and shape of result for a sliding operation.
LatticeExprNode median(const LatticeExprNode &expr)
void fillBoxedShape(const IPosition &shape, const IPosition &boxShape, IPosition &fullBoxShape, IPosition &resultShape)
Helper functions for boxed and sliding functions.
TableExprNode rms(const TableExprNode &array)
Array< T, Alloc > partialStddevs(const Array< T, Alloc > &array, const IPosition &collapseAxes, size_t ddof=1)
Array< T, Alloc > partialVariances(const Array< T, Alloc > &array, const IPosition &collapseAxes, const Array< T, Alloc > &means)
Array< T, Alloc > partialRmss(const Array< T, Alloc > &array, const IPosition &collapseAxes)
void boxedArrayMath(Array< RES, RESAlloc > &, const Array< T, Alloc > &array, const IPosition &boxSize, const ArrayFunctorBase< T, RES > &funcObj)
Array< T, Alloc > partialVariances(const Array< T, Alloc > &array, const IPosition &collapseAxes, size_t ddof=1)
Array< T, Alloc > partialFractiles(const Array< T, Alloc > &array, const IPosition &collapseAxes, float fraction, bool inPlace=false)
Array< T, Alloc > partialMeans(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Array< T, Alloc > partialInterFractileRanges(const Array< T, Alloc > &array, const IPosition &collapseAxes, float fraction, bool inPlace=false)
Array< T, Alloc > slidingArrayMath(const Array< T, Alloc > &a, const IPosition &halfBoxSize, const ArrayFunctorBase< T > &funcObj, bool fillEdge=true)
Apply for each element in the array the given ArrayMath reduction function object to the box around t...
Array< T, Alloc > partialProducts(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Array< T, Alloc > partialAvdevs(const Array< T, Alloc > &array, const IPosition &collapseAxes, const Array< T, Alloc > &means)
Array< T, Alloc > partialInterHexileRanges(const Array< T, Alloc > &array, const IPosition &collapseAxes, bool inPlace=false)
void partialArrayMath(Array< RES, RESAlloc > &res, const Array< T, Alloc > &a, const IPosition &collapseAxes, const ArrayFunctorBase< T, RES > &funcObj)
Array< T, Alloc > partialSums(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Determine the sum, product, etc.
Array< T, Alloc > partialMins(const Array< T, Alloc > &array, const IPosition &collapseAxes)
void slidingArrayMath(Array< RES, RESAlloc > &res, const Array< T, Alloc > &array, const IPosition &halfBoxSize, const ArrayFunctorBase< T, RES > &funcObj, bool fillEdge=true)
Array< T, Alloc > partialAvdevs(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Array< T, Alloc > partialSumSqrs(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Array< std::complex< T > > partialVariances(const Array< std::complex< T >> &array, const IPosition &collapseAxes, const Array< std::complex< T >> &means, size_t ddof)
Array< T, Alloc > partialMaxs(const Array< T, Alloc > &array, const IPosition &collapseAxes)
Array< T, Alloc > partialInterQuartileRanges(const Array< T, Alloc > &array, const IPosition &collapseAxes, bool inPlace=false)
Array< T, Alloc > partialMedians(const Array< T, Alloc > &array, const IPosition &collapseAxes, bool takeEvenMean=false, bool inPlace=false)
Array< T, Alloc > partialMadfms(const Array< T, Alloc > &array, const IPosition &collapseAxes, bool takeEvenMean=false, bool inPlace=false)
Array< T, Alloc > partialArrayMath(const Array< T, Alloc > &a, const IPosition &collapseAxes, const ArrayFunctorBase< T > &funcObj)
Do partial reduction of an Array object.
Array< T, Alloc > partialVariances(const Array< T, Alloc > &array, const IPosition &collapseAxes, const Array< T, Alloc > &means, size_t ddof)
Array< T, Alloc > boxedArrayMath(const Array< T, Alloc > &a, const IPosition &boxSize, const ArrayFunctorBase< T > &funcObj)
Apply the given ArrayMath reduction function objects to each box in the array.
Array< T, Alloc > partialStddevs(const Array< T, Alloc > &array, const IPosition &collapseAxes, const Array< T, Alloc > &means, size_t ddof=1)