28#ifndef CASA_ARRAYMATH_2_H
29#define CASA_ARRAYMATH_2_H
143 template<
typename _InputIterator1,
typename T,
144 typename _OutputIterator,
typename _BinaryOperation>
147 _OutputIterator __result, T left,
148 _BinaryOperation __binary_op)
150 for ( ; __first1 != __last1; ++__first1, ++__result)
151 *__result = __binary_op(left, *__first1);
154 template<
typename _InputIterator1,
typename T,
155 typename _OutputIterator,
typename _BinaryOperation>
158 _OutputIterator __result, T right,
159 _BinaryOperation __binary_op)
161 for ( ; __first1 != __last1; ++__first1, ++__result)
162 *__result = __binary_op(*__first1, right);
165 template<
typename _InputIterator1,
typename T,
166 typename _BinaryOperation>
170 _BinaryOperation __binary_op)
172 for ( ; __first1 != __last1; ++__first1)
173 *__first1 = __binary_op(*__first1, right);
185template<
typename L,
typename AllocL,
typename R,
typename AllocR,
typename RES,
typename AllocRES,
typename BinaryOperator>
201template<
typename L,
typename AllocL,
typename R,
typename RES,
typename AllocRES,
typename BinaryOperator>
208 result.
cbegin(), right, op);
212 myrtransform (left.
begin(), left.
end(),
213 result.
cbegin(), right, op);
221template<
typename L,
typename R,
typename AllocR,
typename RES,
typename AllocRES,
typename BinaryOperator>
228 result.
cbegin(), left, op);
232 myltransform (right.
begin(), right.
end(),
233 result.
cbegin(), left, op);
241template<
typename T,
typename Alloc,
typename RES,
typename AllocRES,
typename UnaryOperator>
255template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename AllocL,
typename AllocR,
typename AllocRES>
261template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename Alloc,
typename AllocRES>
267template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename Alloc,
typename AllocRES>
273template<
typename T,
typename RES,
typename UnaryOperator,
typename Alloc,
typename AllocRES>
279template<
typename T,
typename BinaryOperator,
typename Alloc>
285template<
typename T,
typename BinaryOperator,
typename Alloc>
290template<
typename T,
typename BinaryOperator,
typename Alloc>
295template<
typename T,
typename UnaryOperator,
typename Alloc>
300template<
typename L,
typename R,
typename BinaryOperator,
typename AllocL,
typename AllocR>
313template<
typename L,
typename R,
typename BinaryOperator,
typename Alloc>
317 myiptransform (left.
cbegin(), left.
cend(), right, op);
320 myiptransform (left.
begin(), left.
end(), right, op);
328template<
typename T,
typename UnaryOperator,
typename Alloc>
348 arrayTransformInPlace (left, other, std::multiplies<T>());
354 arrayTransformInPlace (left, other, std::divides<T>());
366template<
typename T,
typename Alloc>
void operator+= (
Array<T, Alloc> &left,
const T &other);
367template<
typename T,
typename Alloc>
void operator-= (
Array<T, Alloc> &left,
const T &other);
368template<
typename T,
typename Alloc>
void operator*= (
Array<T, Alloc> &left,
const T &other)
370 arrayTransformInPlace (left, other, std::multiplies<T>());
372template<
typename T,
typename Alloc>
void operator/= (
Array<T, Alloc> &left,
const T &other)
374 arrayTransformInPlace (left, other, std::divides<T>());
376template<
typename T,
typename Alloc>
void operator%= (
Array<T, Alloc> &left,
const T &other);
377template<
typename T,
typename Alloc>
void operator&= (
Array<T, Alloc> &left,
const T &other);
378template<
typename T,
typename Alloc>
void operator|= (
Array<T, Alloc> &left,
const T &other);
379template<
typename T,
typename Alloc>
void operator^= (
Array<T, Alloc> &left,
const T &other);
393template<
typename T,
typename Alloc>
395template<
typename T,
typename Alloc>
397template<
typename T,
typename Alloc>
401 return arrayTransformResult (left, right, std::multiplies<T>());
403template<
typename T,
typename Alloc>
405template<
typename T,
typename Alloc>
407template<
typename T,
typename Alloc>
409template<
typename T,
typename Alloc>
411template<
typename T,
typename Alloc>
419template<
typename T,
typename Alloc>
421template<
typename T,
typename Alloc>
423template<
class T,
typename Alloc>
426 return arrayTransformResult (left, right, std::multiplies<T>());
428template<
typename T,
typename Alloc>
430template<
typename T,
typename Alloc>
432template<
typename T,
typename Alloc>
434template<
typename T,
typename Alloc>
436template<
typename T,
typename Alloc>
444template<
typename T,
typename Alloc>
446template<
typename T,
typename Alloc>
448template<
class T,
typename Alloc>
451 return arrayTransformResult (left, right, std::multiplies<T>());
454template<
typename T,
typename Alloc>
456template<
typename T,
typename Alloc>
458template<
typename T,
typename Alloc>
460template<
typename T,
typename Alloc>
462template<
typename T,
typename Alloc>
515template<
typename ScalarType,
typename Alloc>
521template<
typename ScalarType,
typename Alloc>
526template<
typename ScalarType,
typename Alloc>
570 {
max (result, b, a); }
577 {
min (result, b, a); }
581 {
return max(b, a); }
585 {
return min(b, a); }
598 {
indgen(a, T(0), T(1)); }
604 {
indgen(a, start, T(1)); }
685 bool takeEvenMean,
bool inPlace=
false);
689 { std::vector<T> scratch;
return median (a, scratch, sorted, takeEvenMean, inPlace); }
704 bool takeEvenMean,
bool inPlace =
false);
708 { std::vector<T> tmp;
return madfm(a, tmp, sorted, takeEvenMean, inPlace); }
710 {
return madfm(a, sorted, (a.
nelements() <= 100),
false); }
712 {
return madfm(a,
false, (a.
nelements() <= 100),
false); }
715 {
return madfm(a, sorted, (a.
nelements() <= 100),
true); }
727 bool sorted=
false,
bool inPlace=
false);
730 bool sorted=
false,
bool inPlace=
false)
731 { std::vector<T> tmp;
return fractile (a, tmp, fraction, sorted, inPlace); }
739 bool sorted=
false,
bool inPlace=
false);
742 bool sorted=
false,
bool inPlace=
false)
743 { std::vector<T> tmp;
return interFractileRange(a, tmp, fraction, sorted, inPlace); }
755 bool sorted=
false,
bool inPlace=
false)
756 {
return interFractileRange(a, tmp, 1./6., sorted, inPlace); }
760 {
return interFractileRange(a, 1./6., sorted, inPlace); }
769 bool sorted=
false,
bool inPlace=
false)
770 {
return interFractileRange(a, tmp, 0.25, sorted, inPlace); }
774 {
return interFractileRange(a, 0.25, sorted, inPlace); }
781template<
typename T,
typename AllocC,
typename AllocR>
785 arrayTransformInPlace (left, other,
786 [](std::complex<T> left, T right) {
return left*right; });
789template<
typename T,
typename Alloc>
790void operator*= (
Array<std::complex<T>, Alloc> &left,
const T &other)
792 arrayTransformInPlace (left, other,
793 [](std::complex<T> left, T right) {
return left*right; });
796template<
typename T,
typename AllocC,
typename AllocR>
800 arrayTransformInPlace (left, other,
801 [](std::complex<T> left, T right) {
return left/right; });
804template<
typename T,
typename Alloc>
805void operator/= (
Array<std::complex<T>, Alloc> &left,
const T &other)
807 arrayTransformInPlace (left, other,
808 [](std::complex<T> left, T right) {
return left/right; });
811template<
typename T,
typename AllocC,
typename AllocR>
817 arrayContTransform (left, right, result,
818 [](std::complex<T> left, T right) {
return left*right; });
821template<
typename T,
typename Alloc>
826 arrayContTransform (left, other, result,
827 [](std::complex<T> left, T right) {
return left*right; });
830template<
typename T,
typename Alloc>
835 arrayContTransform (left, other, result,
836 [](std::complex<T> left, T right) {
return left*right; });
840template<
typename T,
typename AllocC,
typename AllocR>
846 arrayContTransform (left, right, result,
847 [](std::complex<T> l, T r) {
return l/r; });
850template<
typename T,
typename Alloc>
855 arrayContTransform (left, other, result,
856 [](std::complex<T> left, T right) {
return left/right; });
859template<
typename T,
typename Alloc>
864 arrayContTransform (left, other, result,
865 [](std::complex<T> left, T right) {
return left/right; });
875void conj(
Array<std::complex<float>> &rarray,
const Array<std::complex<float>> &carray);
876void conj(
Array<std::complex<double>> &rarray,
const Array<std::complex<double>> &carray);
887template<
typename T,
typename Alloc>
889template<
typename T,
typename Alloc>
891template<
typename T,
typename Alloc>
896template<
typename C,
typename R,
typename AllocC,
typename AllocR>
900template<
typename C,
typename R,
typename AllocC,
typename AllocR>
974template<
typename T,
typename U,
typename AllocT,
typename AllocU>
987 const T* in, T* out,
const IPosition& alternate)
992 for (ssize_t j=0; j<mult[0]; ++j) {
994 for (ssize_t i=0; i<shp[0]; ++i) {
1001 for (ssize_t i=0; i<shp[0]; ++i) {
1002 for (ssize_t j=0; j<mult[0]; ++j) {
1009 if (alternate[axis]) {
1010 for (ssize_t j=0; j<mult[axis]; ++j) {
1012 for (ssize_t i=0; i<shp[axis]; ++i) {
1013 out = expandRecursive (axis-1, shp, mult, inSteps,
1014 pin, out, alternate);
1015 pin += inSteps[axis];
1019 for (ssize_t i=0; i<shp[axis]; ++i) {
1020 for (ssize_t j=0; j<mult[axis]; ++j) {
1021 out = expandRecursive (axis-1, shp, mult, inSteps,
1022 in, out, alternate);
1024 in += inSteps[axis];
1042template<
typename T,
typename Alloc>
1047 IPosition alt = checkExpandArray (mult, inshp,
1056 expandRecursive (out.
ndim()-1, inshp, mult, incp.
steps(),
1057 incp.
data(), outPtr, alt);
1081#include "ArrayMath.tcc"
const IPosition & steps() const
Return steps to be made if stepping one element in a dimension.
size_t ndim() const
The dimensionality of this array.
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
bool contiguousStorage() const
Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a cop...
const IPosition & shape() const
The length of each axis.
virtual void reference(const Array< T, Alloc > &other)
After invocation, this array and other reference the same storage.
void putStorage(T *&storage, bool deleteAndCopy)
putStorage() is normally called after a call to getStorage() (cf).
T * data()
Get a pointer to the beginning of the array.
contiter cbegin()
Get the begin iterator object for a contiguous array.
Array< T, Alloc > reform(const IPosition &shape) const
It is occasionally useful to have an array which access the same storage appear to have a different s...
T * getStorage(bool &deleteIt)
Generally use of this should be shunned, except to use a FORTRAN routine or something similar.
iterator begin()
Get the begin iterator object for any array.
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 operator|(const TableExprNode &left, const TableExprNode &right)
void checkArrayShapes(const ArrayBase &left, const ArrayBase &right, const char *name)
LatticeExprNode mean(const LatticeExprNode &expr)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
void indgen(TableVector< T > &tv, T start, T inc)
TableExprNode operator&(const TableExprNode &left, const TableExprNode &right)
LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator-(const LatticeExprNode &expr)
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
void transformInPlace(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryOperator op)
Define a function to do a binary transform in place.
LatticeExprNode median(const LatticeExprNode &expr)
LatticeExprNode real(const LatticeExprNode &expr)
LatticeExprNode imag(const LatticeExprNode &expr)
void arrayTransformInPlace(Array< T, Alloc > &arr, UnaryOperator op)
Transform the array in place using the unary operator.
void operator|=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
Array< T, Alloc > floormod(const Array< T, Alloc > &a, const T &b)
Array< double > amplitude(const Array< std::complex< double > > &carray)
Array< double > imag(const Array< std::complex< double > > &carray)
T pstddev(const Array< T, Alloc > &a, size_t ddof=0)
void arrayTransform(L left, const Array< R, Alloc > &right, Array< RES, AllocRES > &result, BinaryOperator op)
Transform left and right to a result using the binary operator.
Array< T, Alloc > ceil(const Array< T, Alloc > &a)
Array< T, Alloc > asin(const Array< T, Alloc > &a)
void setReal(Array< C, AllocC > &carray, const Array< R, AllocR > &rarray)
Set the real part of the left complex array to the right real array.
void ComplexToReal(Array< float > &rarray, const Array< std::complex< float > > &carray)
Modify the array "rarray" in place.
void imag(Array< float > &rarray, const Array< std::complex< float > > &carray)
Modifies rarray in place.
Array< T, Alloc > sign(const Array< T, Alloc > &a)
Array< T, Alloc > atan(const Array< T, Alloc > &a)
T interQuartileRange(const Array< T, Alloc > &a, std::vector< T > &tmp, bool sorted=false, bool inPlace=false)
Return the inter-quartile range of an array.
T stddev(const Array< T, Alloc > &a, T mean)
Array< T, Alloc > max(const Array< T, Alloc > &a, const T &b)
Return an array that contains the maximum of "a" and "b" at each position.
Array< float > phase(const Array< std::complex< float > > &carray)
Extracts the phase (i.e.
void min(Array< T, Alloc > &result, const Array< T, Alloc > &a, const Array< T, Alloc > &b)
"result" contains the minimum of "a" and "b" at each position.
void arrayContTransform(L left, const Array< R, AllocR > &right, Array< RES, AllocRES > &result, BinaryOperator op)
Transform left and right to a result using the binary operator.
T interQuartileRange(const Array< T, Alloc > &a, bool sorted=false, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
Array< T, Alloc > operator/(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
T product(const Array< T, Alloc > &a)
Product of every element of the array.
Array< float > real(const Array< std::complex< float > > &carray)
Extracts the real part of a complex array into an array of floats.
T avdev(const Array< T, Alloc > &a)
The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
void arrayContTransform(const Array< L, AllocL > &left, const Array< R, AllocR > &right, Array< RES, AllocRES > &result, BinaryOperator op)
Functions to apply a binary or unary operator to arrays.
void RealToComplex(Array< std::complex< double > > &carray, const Array< double > &rarray)
Array< T, Alloc > fmod(const T &a, const Array< T, Alloc > &b)
void indgen(Array< T, Alloc > &a, T start)
Fills all elements of "array" with a sequence starting with start incremented by one for each positio...
Array< T, Alloc > operator&(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
void arrayTransformInPlace(Array< L, Alloc > &left, R right, BinaryOperator op)
Transform left and right in place using the binary operator.
void expandArray(Array< T, Alloc > &out, const Array< T, Alloc > &in, const IPosition &alternate=IPosition())
Expand the values of an array.
void operator%=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
void minMax(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType, Alloc > &array, const Array< bool > &mask, bool valid=true)
The array is searched at locations where the mask equals valid.
Array< T, Alloc > min(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Return an array that contains the minimum of "a" and "b" at each position.
T min(const Array< T, Alloc > &a)
The minimum element of the array.
Array< double > ComplexToReal(const Array< std::complex< double > > &carray)
T max(const Array< T, Alloc > &a)
The maximum element of the array.
void arrayTransform(const Array< L, Alloc > &left, R right, Array< RES, AllocRES > &result, BinaryOperator op)
Transform left and right to a result using the binary operator.
T madfm(const Array< T, Alloc > &a, bool sorted)
T median(const Array< T, Alloc > &a, std::vector< T > &scratch, bool sorted, bool takeEvenMean, bool inPlace=false)
The median of "a" is a(n/2).
Array< T, Alloc > acos(const Array< T, Alloc > &a)
Transcendental function applied to the array on an element-by-element basis.
void conj(Array< std::complex< float > > &rarray, const Array< std::complex< float > > &carray)
Modifies rarray in place.
T pstddev(const Array< T, Alloc > &a, T mean, size_t ddof=0)
void myiptransform(_InputIterator1 __first1, _InputIterator1 __last1, T right, _BinaryOperation __binary_op)
sequence OP= scalar
T sumsqr(const Array< T, Alloc > &a)
Sum the square of every element of the array.
Array< T, Alloc > floormod(const T &a, const Array< T, Alloc > &b)
void indgen(Array< T, Alloc > &a)
Fills all elements of "array" with a sequence starting with 0 and ending with nelements() - 1.
Array< T, Alloc > abs(const Array< T, Alloc > &a)
Array< double > phase(const Array< std::complex< double > > &carray)
T pvariance(const Array< T, Alloc > &a, T mean, size_t ddof=0)
T pvariance(const Array< T, Alloc > &a, size_t ddof=0)
Array< T, Alloc > tan(const Array< T, Alloc > &a)
void operator*=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
void minMax(T &min, T &max, const Array< T, Alloc > &a)
The "min" and "max" functions require that the type "T" have comparison operators.
Array< T, Alloc > round(const Array< T, Alloc > &a)
Array< T, Alloc > operator~(const Array< T, Alloc > &a)
Array< T, Alloc > pow(const T &a, const Array< T, Alloc > &b)
void amplitude(Array< double > &rarray, const Array< std::complex< double > > &carray)
Array< T, Alloc > arrayTransformResult(T left, const Array< T, Alloc > &right, BinaryOperator op)
Transform left and right to a result using the binary operator.
Array< T, Alloc > fmod(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
void arrayTransform(const Array< L, AllocL > &left, const Array< R, AllocR > &right, Array< RES, AllocRES > &result, BinaryOperator op)
Transform left and right to a result using the binary operator.
Array< std::complex< float > > conj(const Array< std::complex< float > > &carray)
Returns the complex conjugate of a complex array.
T interHexileRange(const Array< T, Alloc > &a, bool sorted=false, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
T madfmInPlace(const Array< T, Alloc > &a, bool sorted=false)
TODO shouldn't take a const Array for in place sorting.
void arrayTransformInPlace(Array< L, AllocL > &left, const Array< R, AllocR > &right, BinaryOperator op)
Transform left and right in place using the binary operator.
Array< std::complex< T > > makeComplex(const Array< T, Alloc > &real, const Array< T, Alloc > &imag)
Form an array of complex numbers from the given real arrays.
void ComplexToReal(Array< double > &rarray, const Array< std::complex< double > > &carray)
void real(Array< float > &rarray, const Array< std::complex< float > > &carray)
Modifies rarray in place.
void indgen(Array< T, Alloc > &a, T start, T inc)
Fills all elements of "array" with a sequence starting with "start" and incrementing by "inc" for eac...
T interFractileRange(const Array< T, Alloc > &a, std::vector< T > &tmp, float fraction, bool sorted=false, bool inPlace=false)
Return the inter-fractile range of an array.
Array< T, Alloc > arrayTransformResult(const Array< T, Alloc > &arr, UnaryOperator op)
Transform array to a result using the unary operator.
IPosition checkExpandArray(IPosition &mult, IPosition &newInShape, const IPosition &inShape, const IPosition &outShape, const IPosition &alternate)
Check array shapes for expandArray.
void minMaxMasked(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType, Alloc > &array, const Array< ScalarType, Alloc > &weight)
The array * weight is searched
Array< std::complex< T > > makeComplex(const T &real, const Array< T, Alloc > &imag)
Array< float > amplitude(const Array< std::complex< float > > &carray)
Extracts the amplitude (i.e.
Array< std::complex< T > > makeComplex(const Array< T, Alloc > &real, const T &imag)
Array< T, Alloc > tanh(const Array< T, Alloc > &a)
Array< T, Alloc > floormod(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
void myltransform(_InputIterator1 __first1, _InputIterator1 __last1, _OutputIterator __result, T left, _BinaryOperation __binary_op)
The myxtransform functions are defined to avoid a bug in g++-4.3.
Array< float > imag(const Array< std::complex< float > > &carray)
Extracts the imaginary part of a complex array into an array of floats.
T interHexileRange(const Array< T, Alloc > &a, std::vector< T > &tmp, bool sorted=false, bool inPlace=false)
Return the inter-hexile range of an array.
void phase(Array< double > &rarray, const Array< std::complex< double > > &carray)
Array< double > real(const Array< std::complex< double > > &carray)
Matrix< std::complex< float > > conj(const Matrix< std::complex< float > > &carray)
Array< std::complex< T > > operator*(const std::complex< T > &left, const Array< T, Alloc > &other)
Matrix< std::complex< double > > conj(const Matrix< std::complex< double > > &carray)
Array< T, Alloc > fmod(const Array< T, Alloc > &a, const T &b)
Array< T, Alloc > atan2(const Array< T, Alloc > &y, const Array< T, Alloc > &x)
void operator+=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
Element by element arithmetic modifying left in-place.
Array< T, Alloc > atan2(const Array< T, Alloc > &y, const T &x)
void arrayContTransform(const Array< T, Alloc > &arr, Array< RES, AllocRES > &result, UnaryOperator op)
Transform array to a result using the unary operator.
Array< std::complex< float > > RealToComplex(const Array< float > &rarray)
Copy an array of real,imaginary pairs into a complex array.
Array< T, Alloc > exp(const Array< T, Alloc > &a)
T madfm(const Array< T, Alloc > &a, std::vector< T > &tmp, bool sorted, bool takeEvenMean, bool inPlace=false)
The median absolute deviation from the median.
T madfm(const Array< T, Alloc > &a, bool sorted, bool takeEvenMean, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
Array< std::complex< T > > operator/(const std::complex< T > &left, const Array< T, Alloc > &other)
Array< T, Alloc > operator-(const Array< T, Alloc > &a)
T interFractileRange(const Array< T, Alloc > &a, float fraction, bool sorted=false, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
void setImag(Array< C, AllocC > &carray, const Array< R, AllocR > &rarray)
Set the imaginary part of the left complex array to right real array.
void arrayContTransform(const Array< L, AllocL > &left, R right, Array< RES, AllocRES > &result, BinaryOperator op)
Transform left and right to a result using the binary operator.
T medianInPlace(const Array< T, Alloc > &a, bool sorted=false)
TODO shouldn't take a const Array for in place sorting.
T fractile(const Array< T, Alloc > &a, std::vector< T > &tmp, float fraction, bool sorted=false, bool inPlace=false)
Return the fractile of an array.
void max(Array< T, Alloc > &result, const Array< T, Alloc > &a, const Array< T, Alloc > &b)
"result" contains the maximum of "a" and "b" at each position.
Array< T, Alloc > operator|(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
Array< T, Alloc > cosh(const Array< T, Alloc > &a)
T rms(const Array< T, Alloc > &a)
The root-mean-square of "a" is the sqrt of sum(a*a)/N.
Array< T, Alloc > pow(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Array< T, Alloc > min(const T &a, const Array< T, Alloc > &b)
void imag(Array< double > &rarray, const Array< std::complex< double > > &carray)
Array< T, Alloc > cube(const Array< T, Alloc > &val)
Returns an array where every element is cubed.
Array< T, Alloc > floor(const Array< T, Alloc > &a)
Array< T, Alloc > max(const T &a, const Array< T, Alloc > &b)
Array< T, Alloc > operator%(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
void operator-=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
void myrtransform(_InputIterator1 __first1, _InputIterator1 __last1, _OutputIterator __result, T right, _BinaryOperation __binary_op)
sequence = sequence OP scalar
T fractile(const Array< T, Alloc > &a, float fraction, bool sorted=false, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
void min(Array< T, Alloc > &result, const T &a, const Array< T, Alloc > &b)
Array< T, Alloc > square(const Array< T, Alloc > &val)
Returns an array where every element is squared.
void phase(Array< float > &rarray, const Array< std::complex< float > > &carray)
Modifies rarray in place.
Array< T, Alloc > operator^(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
Array< std::complex< double > > RealToComplex(const Array< double > &rarray)
void convertArray(Array< T, AllocT > &to, const Array< U, AllocU > &from)
Make a copy of an array of a different type; for example make an array of doubles from an array of fl...
Array< T, Alloc > cos(const Array< T, Alloc > &a)
Transcendental function that can be applied to essentially all numeric types.
T median(const Array< T, Alloc > &a, bool sorted)
Array< T, Alloc > arrayTransformResult(const Array< T, Alloc > &left, const Array< T, Alloc > &right, BinaryOperator op)
Transform left and right to a result using the binary operator.
T mean(const Array< T, Alloc > &a)
The mean of "a" is the sum of all elements of "a" divided by the number of elements of "a".
void RealToComplex(Array< std::complex< float > > &carray, const Array< float > &rarray)
Modify the array "carray" in place.
Array< T, Alloc > sin(const Array< T, Alloc > &a)
void operator^=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
T stddev(const Array< T, Alloc > &a)
The standard deviation of "a" is the square root of its variance.
T avdev(const Array< T, Alloc > &a, T mean)
The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
Array< T, Alloc > max(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Return an array that contains the maximum of "a" and "b" at each position.
Array< T, Alloc > arrayTransformResult(const Array< T, Alloc > &left, T right, BinaryOperator op)
Transform left and right to a result using the binary operator.
void minMax(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType, Alloc > &array)
Find the minimum and maximum values of an array, including their locations.
Array< T, Alloc > log10(const Array< T, Alloc > &a)
Array< T, Alloc > operator+(const Array< T, Alloc > &a)
Unary arithmetic operation.
T median(const Array< T, Alloc > &a, bool sorted, bool takeEvenMean, bool inPlace=false)
TODO shouldn't take a const Array for in place sorting.
Array< T, Alloc > fabs(const Array< T, Alloc > &a)
T variance(const Array< T, Alloc > &a, T mean)
Rather than using a computed mean, use the supplied value.
void max(Array< T, Alloc > &result, const T &a, const Array< T, Alloc > &b)
Array< T, Alloc > operator*(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
T sum(const Array< T, Alloc > &a)
Sum of every element of the array.
Array< T, Alloc > atan2(const T &y, const Array< T, Alloc > &x)
Array< T, Alloc > log(const Array< T, Alloc > &a)
void amplitude(Array< float > &rarray, const Array< std::complex< float > > &carray)
Modifies rarray in place.
void real(Array< double > &rarray, const Array< std::complex< double > > &carray)
Array< std::complex< double > > conj(const Array< std::complex< double > > &carray)
T * expandRecursive(int axis, const IPosition &shp, const IPosition &mult, const IPosition &inSteps, const T *in, T *out, const IPosition &alternate)
Helper function for expandArray using recursion for each axis.
T variance(const Array< T, Alloc > &a)
The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - ddof).
Vector< T, Alloc > indgen(size_t length, T start, T inc)
Create a Vector of the given length and fill it with the start value incremented with inc for each el...
Array< float > ComplexToReal(const Array< std::complex< float > > &carray)
Copy an array of complex into an array of real,imaginary pairs.
T madfm(const Array< T, Alloc > &a)
T median(const Array< T, Alloc > &a)
Array< T, Alloc > pow(const Array< T, Alloc > &a, const double &b)
Array< T, Alloc > sinh(const Array< T, Alloc > &a)
void max(Array< T, Alloc > &result, const Array< T, Alloc > &a, const T &b)
"result" contains the maximum of "a" and "b" at each position.
void min(Array< T, Alloc > &result, const Array< T, Alloc > &a, const T &b)
"result" contains the minimum of "a" and "b" at each position.
void operator&=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
void conj(Array< std::complex< double > > &rarray, const Array< std::complex< double > > &carray)
Array< T, Alloc > sqrt(const Array< T, Alloc > &a)
void operator/=(Array< T, Alloc > &left, const Array< T, Alloc > &other)
Array< T, Alloc > min(const Array< T, Alloc > &a, const T &b)
Return an array that contains the minimum of "a" and "b" at each position.
void arrayTransform(const Array< T, Alloc > &arr, Array< RES, AllocRES > &result, UnaryOperator op)
Transform array to a result using the unary operator.