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);
185 template<
typename L,
typename AllocL,
typename R,
typename AllocR,
typename RES,
typename AllocRES,
typename BinaryOperator>
201 template<
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);
221 template<
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);
241 template<
typename T,
typename Alloc,
typename RES,
typename AllocRES,
typename UnaryOperator>
255 template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename AllocL,
typename AllocR,
typename AllocRES>
261 template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename Alloc,
typename AllocRES>
267 template<
typename L,
typename R,
typename RES,
typename BinaryOperator,
typename Alloc,
typename AllocRES>
273 template<
typename T,
typename RES,
typename UnaryOperator,
typename Alloc,
typename AllocRES>
279 template<
typename T,
typename BinaryOperator,
typename Alloc>
285 template<
typename T,
typename BinaryOperator,
typename Alloc>
290 template<
typename T,
typename BinaryOperator,
typename Alloc>
295 template<
typename T,
typename UnaryOperator,
typename Alloc>
300 template<
typename L,
typename R,
typename BinaryOperator,
typename AllocL,
typename AllocR>
313 template<
typename L,
typename R,
typename BinaryOperator,
typename Alloc>
317 myiptransform (left.
cbegin(), left.
cend(), right, op);
320 myiptransform (left.
begin(), left.
end(), right, op);
328 template<
typename T,
typename UnaryOperator,
typename Alloc>
348 arrayTransformInPlace (left, other, std::multiplies<T>());
354 arrayTransformInPlace (left, other, std::divides<T>());
366 template<
typename T,
typename Alloc>
void operator+= (
Array<T, Alloc> &left,
const T &other);
367 template<
typename T,
typename Alloc>
void operator-= (
Array<T, Alloc> &left,
const T &other);
368 template<
typename T,
typename Alloc>
void operator*= (
Array<T, Alloc> &left,
const T &other)
370 arrayTransformInPlace (left, other, std::multiplies<T>());
372 template<
typename T,
typename Alloc>
void operator/= (
Array<T, Alloc> &left,
const T &other)
374 arrayTransformInPlace (left, other, std::divides<T>());
376 template<
typename T,
typename Alloc>
void operator%= (
Array<T, Alloc> &left,
const T &other);
377 template<
typename T,
typename Alloc>
void operator&= (
Array<T, Alloc> &left,
const T &other);
378 template<
typename T,
typename Alloc>
void operator|= (
Array<T, Alloc> &left,
const T &other);
379 template<
typename T,
typename Alloc>
void operator^= (
Array<T, Alloc> &left,
const T &other);
393 template<
typename T,
typename Alloc>
395 template<
typename T,
typename Alloc>
397 template<
typename T,
typename Alloc>
401 return arrayTransformResult (left, right, std::multiplies<T>());
403 template<
typename T,
typename Alloc>
405 template<
typename T,
typename Alloc>
407 template<
typename T,
typename Alloc>
409 template<
typename T,
typename Alloc>
411 template<
typename T,
typename Alloc>
419 template<
typename T,
typename Alloc>
421 template<
typename T,
typename Alloc>
423 template<
class T,
typename Alloc>
426 return arrayTransformResult (left, right, std::multiplies<T>());
428 template<
typename T,
typename Alloc>
430 template<
typename T,
typename Alloc>
432 template<
typename T,
typename Alloc>
434 template<
typename T,
typename Alloc>
436 template<
typename T,
typename Alloc>
444 template<
typename T,
typename Alloc>
446 template<
typename T,
typename Alloc>
448 template<
class T,
typename Alloc>
451 return arrayTransformResult (left, right, std::multiplies<T>());
454 template<
typename T,
typename Alloc>
456 template<
typename T,
typename Alloc>
458 template<
typename T,
typename Alloc>
460 template<
typename T,
typename Alloc>
462 template<
typename T,
typename Alloc>
515 template<
typename ScalarType,
typename Alloc>
521 template<
typename ScalarType,
typename Alloc>
526 template<
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); }
781 template<
typename T,
typename AllocC,
typename AllocR>
785 arrayTransformInPlace (left, other,
786 [](std::complex<T> left, T right) {
return left*right; });
789 template<
typename T,
typename Alloc>
790 void operator*= (
Array<std::complex<T>, Alloc> &left,
const T &other)
792 arrayTransformInPlace (left, other,
793 [](std::complex<T> left, T right) {
return left*right; });
796 template<
typename T,
typename AllocC,
typename AllocR>
800 arrayTransformInPlace (left, other,
801 [](std::complex<T> left, T right) {
return left/right; });
804 template<
typename T,
typename Alloc>
805 void operator/= (
Array<std::complex<T>, Alloc> &left,
const T &other)
807 arrayTransformInPlace (left, other,
808 [](std::complex<T> left, T right) {
return left/right; });
811 template<
typename T,
typename AllocC,
typename AllocR>
817 arrayContTransform (left, right, result,
818 [](std::complex<T> left, T right) {
return left*right; });
821 template<
typename T,
typename Alloc>
826 arrayContTransform (left, other, result,
827 [](std::complex<T> left, T right) {
return left*right; });
830 template<
typename T,
typename Alloc>
835 arrayContTransform (left, other, result,
836 [](std::complex<T> left, T right) {
return left*right; });
840 template<
typename T,
typename AllocC,
typename AllocR>
846 arrayContTransform (left, right, result,
847 [](std::complex<T> l, T r) {
return l/r; });
850 template<
typename T,
typename Alloc>
855 arrayContTransform (left, other, result,
856 [](std::complex<T> left, T right) {
return left/right; });
859 template<
typename T,
typename Alloc>
864 arrayContTransform (left, other, result,
865 [](std::complex<T> left, T right) {
return left/right; });
875 void conj(
Array<std::complex<float>> &rarray,
const Array<std::complex<float>> &carray);
876 void conj(
Array<std::complex<double>> &rarray,
const Array<std::complex<double>> &carray);
887 template<
typename T,
typename Alloc>
889 template<
typename T,
typename Alloc>
891 template<
typename T,
typename Alloc>
896 template<
typename C,
typename R,
typename AllocC,
typename AllocR>
900 template<
typename C,
typename R,
typename AllocC,
typename AllocR>
974 template<
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];
1042 template<
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 & shape() const
The length of each axis.
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 & steps() const
Return steps to be made if stepping one element in a dimension.
virtual void reference(const Array< T, Alloc > &other)
After invocation, this array and other reference the same storage.
T * getStorage(bool &deleteIt)
Generally use of this should be shunned, except to use a FORTRAN routine or something similar.
void putStorage(T *&storage, bool deleteAndCopy)
putStorage() is normally called after a call to getStorage() (cf).
contiter cbegin()
Get the begin iterator object for a contiguous array.
iterator begin()
Get the begin iterator object for any array.
T * data()
Get a pointer to the beginning of the 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...
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)
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.
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 > min(const Array< T, Alloc > &a, const T &b)
Return an array that contains the minimum of "a" and "b" at each position.
Array< T, Alloc > floormod(const T &a, const Array< T, Alloc > &b)
Array< std::complex< T > > makeComplex(const Array< T, Alloc > &real, const T &imag)
Array< std::complex< T > > operator*(const std::complex< T > &left, const Array< T, Alloc > &other)
Array< T, Alloc > tan(const Array< T, Alloc > &a)
Matrix< std::complex< double > > conj(const Matrix< std::complex< double >> &carray)
Array< T, Alloc > operator-(const Array< T, Alloc > &a)
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.
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.
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.
Array< T, Alloc > floormod(const Array< T, Alloc > &a, const T &b)
Array< T, Alloc > operator+(const Array< T, Alloc > &a)
Unary arithmetic operation.
Array< T, Alloc > pow(const T &a, const Array< T, Alloc > &b)
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)
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.
T product(const Array< T, Alloc > &a)
Product of every element of the array.
Array< T, Alloc > arrayTransformResult(const Array< T, Alloc > &arr, UnaryOperator op)
Transform array to a result using the unary operator.
Array< T, Alloc > sign(const Array< T, Alloc > &a)
Array< double > real(const Array< std::complex< double >> &carray)
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 indgen(Array< T, Alloc > &a, T start)
Fills all elements of "array" with a sequence starting with start incremented by one for each positio...
void phase(Array< float > &rarray, const Array< std::complex< float >> &carray)
Modifies rarray in place.
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 real(Array< float > &rarray, const Array< std::complex< float >> &carray)
Modifies rarray in place.
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.
T min(const Array< T, Alloc > &a)
The minimum element of the array.
Array< double > amplitude(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 > 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.
Array< T, Alloc > sin(const Array< T, Alloc > &a)
Array< T, Alloc > abs(const Array< T, Alloc > &a)
Array< T, Alloc > min(const T &a, const Array< T, Alloc > &b)
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.
Array< T, Alloc > floormod(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Array< T, Alloc > exp(const Array< T, Alloc > &a)
Array< T, Alloc > asin(const Array< T, Alloc > &a)
Array< T, Alloc > sqrt(const Array< T, Alloc > &a)
T pstddev(const Array< T, Alloc > &a, T mean, size_t ddof=0)
void real(Array< double > &rarray, const Array< std::complex< double >> &carray)
Array< float > imag(const Array< std::complex< float >> &carray)
Extracts the imaginary part of a complex array into an array of floats.
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< std::complex< float > > conj(const Array< std::complex< float >> &carray)
Returns the complex conjugate of a complex array.
Array< T, Alloc > operator~(const Array< T, Alloc > &a)
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...
void indgen(Array< T, Alloc > &a)
Fills all elements of "array" with a sequence starting with 0 and ending with nelements() - 1.
Array< double > phase(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 > atan2(const Array< T, Alloc > &y, const T &x)
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 > square(const Array< T, Alloc > &val)
Returns an array where every element is squared.
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 > atan2(const Array< T, Alloc > &y, const Array< T, Alloc > &x)
Array< std::complex< double > > RealToComplex(const Array< double > &rarray)
void imag(Array< float > &rarray, const Array< std::complex< float >> &carray)
Modifies rarray in place.
void amplitude(Array< float > &rarray, const Array< std::complex< float >> &carray)
Modifies rarray in place.
void RealToComplex(Array< std::complex< double >> &carray, const Array< double > &rarray)
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< T > > makeComplex(const T &real, const Array< T, Alloc > &imag)
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.
Array< T, Alloc > sinh(const Array< T, Alloc > &a)
Array< double > ComplexToReal(const Array< std::complex< double >> &carray)
Array< double > imag(const Array< std::complex< double >> &carray)
void ComplexToReal(Array< double > &rarray, const Array< std::complex< double >> &carray)
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< T, Alloc > arrayTransformResult(const Array< T, Alloc > &left, T right, BinaryOperator op)
Transform left and right to a result using the binary operator.
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 > fmod(const T &a, const Array< T, Alloc > &b)
void conj(Array< std::complex< float >> &rarray, const Array< std::complex< float >> &carray)
Modifies rarray in place.
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
void amplitude(Array< double > &rarray, const Array< std::complex< double >> &carray)
Array< T, Alloc > tanh(const Array< T, Alloc > &a)
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< std::complex< double > > conj(const Array< std::complex< double >> &carray)
Array< T, Alloc > fmod(const Array< T, Alloc > &a, const T &b)
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.
Array< float > ComplexToReal(const Array< std::complex< float >> &carray)
Copy an array of complex into an array of real,imaginary pairs.
Array< T, Alloc > pow(const Array< T, Alloc > &a, const double &b)
void arrayContTransform(const Array< T, Alloc > &arr, Array< RES, AllocRES > &result, UnaryOperator op)
Transform array to a result using the unary operator.
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< T, Alloc > fmod(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Array< float > amplitude(const Array< std::complex< float >> &carray)
Extracts the amplitude (i.e.
Array< T, Alloc > arrayTransformResult(T left, const Array< T, Alloc > &right, BinaryOperator op)
Transform left and right to a result using the binary operator.
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.
Array< T, Alloc > log10(const Array< T, Alloc > &a)
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.
void imag(Array< double > &rarray, const Array< std::complex< double >> &carray)
void ComplexToReal(Array< float > &rarray, const Array< std::complex< float >> &carray)
Modify the array "rarray" in place.
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.
T rms(const Array< T, Alloc > &a)
The root-mean-square of "a" is the sqrt of sum(a*a)/N.
Array< T, Alloc > fabs(const Array< T, Alloc > &a)
Array< T, Alloc > pow(const Array< T, Alloc > &a, const Array< T, Alloc > &b)
Array< T, Alloc > floor(const Array< T, Alloc > &a)
Array< T, Alloc > acos(const Array< T, Alloc > &a)
Transcendental function applied to the array on an element-by-element basis.
void myrtransform(_InputIterator1 __first1, _InputIterator1 __last1, _OutputIterator __result, T right, _BinaryOperation __binary_op)
sequence = sequence OP scalar
Matrix< std::complex< float > > conj(const Matrix< std::complex< float >> &carray)
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< std::complex< T > > operator/(const std::complex< T > &left, const Array< T, Alloc > &other)
Array< T, Alloc > ceil(const Array< T, Alloc > &a)
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...
T median(const Array< T, Alloc > &a, bool sorted)
Array< T, Alloc > max(const T &a, const Array< T, Alloc > &b)
void RealToComplex(Array< std::complex< float >> &carray, const Array< float > &rarray)
Modify the array "carray" in place.
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".
Array< T, Alloc > cos(const Array< T, Alloc > &a)
Transcendental function that can be applied to essentially all numeric types.
Array< T, Alloc > atan2(const T &y, const Array< T, Alloc > &x)
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.
void conj(Array< std::complex< double >> &rarray, const Array< std::complex< double >> &carray)
Array< T, Alloc > round(const Array< T, Alloc > &a)
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.
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.
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)
T sum(const Array< T, Alloc > &a)
Sum of every element of the array.
Array< std::complex< float > > RealToComplex(const Array< float > &rarray)
Copy an array of real,imaginary pairs into a complex array.
void phase(Array< double > &rarray, const Array< std::complex< double >> &carray)
Array< T, Alloc > operator*(const Array< T, Alloc > &left, const Array< T, Alloc > &right)
T variance(const Array< T, Alloc > &a)
The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - ddof).
T madfm(const Array< T, Alloc > &a)
T median(const Array< T, Alloc > &a)
Array< T, Alloc > log(const Array< T, Alloc > &a)
Array< float > phase(const Array< std::complex< float >> &carray)
Extracts the phase (i.e.
Array< float > real(const Array< std::complex< float >> &carray)
Extracts the real part of a complex array into an array of floats.
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.
Array< T, Alloc > cosh(const Array< T, Alloc > &a)
Array< T, Alloc > atan(const Array< T, Alloc > &a)
void arrayTransform(const Array< T, Alloc > &arr, Array< RES, AllocRES > &result, UnaryOperator op)
Transform array to a result using the unary operator.