casa::ArrayMath_global_functions_Array_mathematical_operations Struct Reference
[Arrays]

#include <ArrayMath.h>

List of all members.


Detailed Description

Mathematical operations for Arrays.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tArray

Prerequisite

Etymology

This file contains global functions which perform element by element mathematical operations on arrays.

Synopsis

These functions perform element by element mathematical operations on arrays. The two arrays must conform.

Example

      Vector<Int> a(10);
      Vector<Int> b(10);
      Vector<Int> c(10);
         . . .
      c = a + b;
This example sets the elements of c to (a+b). The result of this operation is an Array.

Example

      Vector<Double> a(10);
      Vector<Double> b(10);
      Vector<Double> c(10);
         . . .
      c = atan2 (a, b);
This example sets the elements of c to atan2 (a,b). The result of this operation is an Array.

Example

      Vector<Int> a(10);
      Int result;
         . . .
      result = sum (a);
This example sums a.

Motivation

One wants to be able to perform mathematical operations on arrays.

<linkfrom anchor="Array mathematical operations" classes="Array Vector Matrix Cube"> <here>Array mathematical operations</here> -- Mathematical operations for Arrays. </linkfrom>

Definition at line 104 of file ArrayMath.h.

Public Member Functions

void ArrayMinMaxPrintOnceDeprecated ()
 Function to print "deprecated" message once per program.
template<class T>
void indgen (Array< T > &a, T start, T inc)
 Fills all elements of "array" with a sequence starting with "start" and incrementing by "inc" for each element.
template<class T>
void indgen (Array< T > &a)
 Fills all elements of "array" with a sequence starting with 0 and ending with nelements() - 1.
template<class T>
void indgen (Array< T > &a, T start)
 Fills all elements of "array" with a sequence starting with start incremented by one for each position in the array.
template<class T>
sum (const Array< T > &a)
 Sum of every element of the array.
template<class T>
product (const Array< T > &a)
 Product of every element of the array.
template<class T>
mean (const Array< T > &a)
 The mean of "a" is the sum of all elements of "a" divided by the number of elements of "a".
template<class T>
variance (const Array< T > &a)
 The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - 1).
template<class T>
variance (const Array< T > &a, T mean)
 The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - 1).
template<class T>
stddev (const Array< T > &a)
 The standard deviation of "a" is the square root of its variance.
template<class T>
stddev (const Array< T > &a, T mean)
 The standard deviation of "a" is the square root of its variance.
template<class T>
avdev (const Array< T > &a)
 The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
template<class T>
avdev (const Array< T > &a, T mean)
 The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
template<class T>
rms (const Array< T > &a)
 The root-mean-square of "a" is the sqrt of sum(a*a)/N.
template<class T>
fractile (const Array< T > &a, Float fraction, Bool sorted=False, Bool inPlace=False)
 Return the fractile of an array.
Array< FloatComplexToReal (const Array< Complex > &carray)
 Copy an array of complex into an array of real,imaginary pairs.
Array< DoubleComplexToReal (const Array< DComplex > &carray)
Array< Complex > RealToComplex (const Array< Float > &rarray)
 Copy an array of real,imaginary pairs into a complex array.
Array< DComplex > RealToComplex (const Array< Double > &rarray)
template<typename T>
Array< T > slidingArrayMath (const Array< T > &array, const IPosition &halfBoxSize, T(*reductionFunc)(const Array< T > &), Bool fillEdge=True)
 Apply for each element in the array the given ArrayMath reduction function to the box around that element.
template<class T, class U>
void convertArray (Array< T > &to, const Array< U > &from)
 Make a copy of an array of a different type; for example make an array of doubles from an array of floats.
template<class T>
Array< T > square (const Array< T > &val)
 Returns an array where every element is squared.
template<class T>
Array< T > cube (const Array< T > &val)
 Returns an array where every element is cubed.
template<class T>
void operator+= (Array< T > &left, const Array< T > &other)
 Element by element arithmetic modifying left in-place.
template<class T>
void operator-= (Array< T > &left, const Array< T > &other)
template<class T>
void operator *= (Array< T > &left, const Array< T > &other)
template<class T>
void operator/= (Array< T > &left, const Array< T > &other)
template<class T>
void operator+= (Array< T > &left, const T &other)
 Element by element arithmetic modifying left in-place.
template<class T>
void operator-= (Array< T > &left, const T &other)
template<class T>
void operator *= (Array< T > &left, const T &other)
template<class T>
void operator/= (Array< T > &left, const T &other)
template<class T>
Array< T > operator+ (const Array< T > &a)
 Unary arithmetic operation.
template<class T>
Array< T > operator- (const Array< T > &a)
template<class T>
Array< T > operator+ (const Array< T > &left, const Array< T > &right)
 Element by element arithmetic on two arrays, returning an array.
template<class T>
Array< T > operator- (const Array< T > &left, const Array< T > &right)
template<class T>
Array< T > operator * (const Array< T > &left, const Array< T > &right)
template<class T>
Array< T > operator/ (const Array< T > &left, const Array< T > &right)
template<class T>
Array< T > operator+ (const Array< T > &left, const T &right)
 Element by element arithmetic between an array and a scalar, returning an array.
template<class T>
Array< T > operator- (const Array< T > &left, const T &right)
template<class T>
Array< T > operator * (const Array< T > &left, const T &right)
template<class T>
Array< T > operator/ (const Array< T > &left, const T &right)
template<class T>
Array< T > operator+ (const T &left, const Array< T > &right)
 Element by element arithmetic between a scalar and an array, returning an array.
template<class T>
Array< T > operator- (const T &left, const Array< T > &right)
template<class T>
Array< T > operator * (const T &left, const Array< T > &right)
template<class T>
Array< T > operator/ (const T &left, const Array< T > &right)
template<class T>
Array< T > cos (const Array< T > &a)
 Transcendental function that can be applied to essentially all numeric types.
template<class T>
Array< T > cosh (const Array< T > &a)
template<class T>
Array< T > exp (const Array< T > &a)
template<class T>
Array< T > log (const Array< T > &a)
template<class T>
Array< T > log10 (const Array< T > &a)
template<class T>
Array< T > pow (const Array< T > &a, const Array< T > &b)
template<class T>
Array< T > pow (const T &a, const Array< T > &b)
template<class T>
Array< T > sin (const Array< T > &a)
template<class T>
Array< T > sinh (const Array< T > &a)
template<class T>
Array< T > sqrt (const Array< T > &a)
template<class T>
Array< T > acos (const Array< T > &a)
 Transcendental function applied to the array on an element-by-element basis.
template<class T>
Array< T > asin (const Array< T > &a)
template<class T>
Array< T > atan (const Array< T > &a)
template<class T>
Array< T > atan2 (const Array< T > &y, const Array< T > &x)
template<class T>
Array< T > ceil (const Array< T > &a)
template<class T>
Array< T > fabs (const Array< T > &a)
template<class T>
Array< T > abs (const Array< T > &a)
template<class T>
Array< T > floor (const Array< T > &a)
template<class T>
Array< T > fmod (const Array< T > &a, const Array< T > &b)
template<class T>
Array< T > fmod (const T &a, const Array< T > &b)
template<class T>
Array< T > fmod (const Array< T > &a, const T &b)
template<class T>
Array< T > pow (const Array< T > &a, const Double &b)
template<class T>
Array< T > tan (const Array< T > &a)
template<class T>
Array< T > tanh (const Array< T > &a)
template<class T>
Array< T > fabs (const Array< T > &a)
 N.B.
template<class ScalarType>
void minMax (ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType > &array)
 Find the minimum and maximum values of an array, including their locations.
template<class ScalarType>
void minMax (ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType > &array, const Array< Bool > &mask)
 The array is only searched at locations where the mask is True.
template<class ScalarType>
void minMaxMasked (ScalarType &minVal, ScalarType &maxVal, IPosition &minPos, IPosition &maxPos, const Array< ScalarType > &array, const Array< ScalarType > &mask)
 The array * mask is searched.
template<class T>
void minMax (T &min, T &max, const Array< T > &a)
 This sets min and max to the minimum and maximum of the array to avoid having to do two passes with max() and min() separately.
template<class T>
void minMax (const Array< T > &a, T &min, T &max)
 This version is deprecated, due to its nonstandard argument order.
template<class T>
min (const Array< T > &a)
 The minimum element of the array.
template<class T>
max (const Array< T > &a)
 The maximum element of the array.
template<class T>
void max (Array< T > &result, const Array< T > &a, const Array< T > &b)
 "result" contains the maximum of "a" and "b" at each position.
template<class T>
void min (Array< T > &result, const Array< T > &a, const Array< T > &b)
 "result" contains the minimum of "a" and "b" at each position.
template<class T>
Array< T > max (const Array< T > &a, const Array< T > &b)
 Return an array that contains the maximum of "a" and "b" at each position.
template<class T>
Array< T > min (const Array< T > &a, const Array< T > &b)
 Return an array that contains the minimum of "a" and "b" at each position.
template<class T>
void max (Array< T > &result, const Array< T > &a, const T &b)
 "result" contains the maximum of "a" and "b" at each position.
template<class T>
void min (Array< T > &result, const Array< T > &a, const T &b)
 "result" contains the minimum of "a" and "b" at each position.
template<class T>
Array< T > max (const Array< T > &a, const T &b)
 Return an array that contains the maximum of "a" and "b" at each position.
template<class T>
Array< T > min (const Array< T > &a, const T &b)
 Return an array that contains the minimum of "a" and "b" at each position.
template<class T>
median (const Array< T > &a)
 The median of "a" is a(n/2).
template<class T>
median (const Array< T > &a, Bool sorted)
template<class T>
medianInPlace (const Array< T > &a, Bool sorted=False)
template<class T>
median (const Array< T > &a, Bool sorted, Bool takeEvenMean, Bool inPlace=False)
template<class T>
Array< T > partialSums (const Array< T > &array, const IPosition &collapseAxes)
 The same functions as above, but determine the sum, etc.
template<class T>
Array< T > partialProducts (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialMins (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialMaxs (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialMeans (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialVariances (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialVariances (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means)
template<class T>
Array< T > partialStddevs (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialStddevs (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means)
template<class T>
Array< T > partialAvdevs (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialAvdevs (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means)
template<class T>
Array< T > partialRmss (const Array< T > &array, const IPosition &collapseAxes)
template<class T>
Array< T > partialMedians (const Array< T > &array, const IPosition &collapseAxes, Bool takeEvenMean=False, Bool inPlace=False)
template<class T>
Array< T > partialFractiles (const Array< T > &array, const IPosition &collapseAxes, Float fraction, Bool inPlace=False)
void operator *= (Array< Complex > &left, const Array< Float > &other)
 Methods for element-by-element scaling of Complex by Float.
void operator *= (Array< Complex > &left, const Float &other)
void operator/= (Array< Complex > &left, const Array< Float > &other)
void operator/= (Array< Complex > &left, const Float &other)
Array< Complex > operator * (const Array< Complex > &left, const Array< Float > &right)
Array< Complex > operator * (const Array< Complex > &left, const Float &right)
Array< Complex > operator/ (const Array< Complex > &left, const Array< Float > &right)
Array< Complex > operator/ (const Array< Complex > &left, const Float &right)
Array< Complex > conj (const Array< Complex > &carray)
 Returns the complex conjugate of a complex array.
Array< DComplex > conj (const Array< DComplex > &carray)
Matrix< Complex > conj (const Matrix< Complex > &carray)
Matrix< DComplex > conj (const Matrix< DComplex > &carray)
Array< Floatreal (const Array< Complex > &carray)
 Extracts the real part of a complex array into an array of floats.
Array< Doublereal (const Array< DComplex > &carray)
void real (Array< Float > &rarray, const Array< Complex > &carray)
 Modifies rarray in place.
void real (Array< Double > &rarray, const Array< DComplex > &carray)
Array< Floatimag (const Array< Complex > &carray)
 Extracts the imaginary part of a complex array into an array of floats.
Array< Doubleimag (const Array< DComplex > &carray)
void imag (Array< Float > &rarray, const Array< Complex > &carray)
 Modifies rarray in place.
void imag (Array< Double > &rarray, const Array< DComplex > &carray)
Array< Floatamplitude (const Array< Complex > &carray)
 Extracts the amplitude (i.e.
Array< Doubleamplitude (const Array< DComplex > &carray)
void amplitude (Array< Float > &rarray, const Array< Complex > &carray)
 Modifies rarray in place.
void amplitude (Array< Double > &rarray, const Array< DComplex > &carray)
Array< Floatphase (const Array< Complex > &carray)
 Extracts the phase (i.e.
Array< Doublephase (const Array< DComplex > &carray)
void phase (Array< Float > &rarray, const Array< Complex > &carray)
 Modifies rarray in place.
void phase (Array< Double > &rarray, const Array< DComplex > &carray)
void ComplexToReal (Array< Float > &rarray, const Array< Complex > &carray)
 Modify the array "rarray" in place.
void ComplexToReal (Array< Double > &rarray, const Array< DComplex > &carray)
void RealToComplex (Array< Complex > &carray, const Array< Float > &rarray)
 Modify the array "carray" in place.
void RealToComplex (Array< DComplex > &carray, const Array< Double > &rarray)


Member Function Documentation

void casa::ArrayMath_global_functions_Array_mathematical_operations::ArrayMinMaxPrintOnceDeprecated (  ) 

Function to print "deprecated" message once per program.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator+= ( Array< T > &  left,
const Array< T > &  other 
)

Element by element arithmetic modifying left in-place.

left and other must be conformant.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator-= ( Array< T > &  left,
const Array< T > &  other 
)

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator *= ( Array< T > &  left,
const Array< T > &  other 
)

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator/= ( Array< T > &  left,
const Array< T > &  other 
)

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator+= ( Array< T > &  left,
const T &  other 
)

Element by element arithmetic modifying left in-place.

The scalar "other" behaves as if it were a conformant Array to left filled with constant values.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator-= ( Array< T > &  left,
const T &  other 
)

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator *= ( Array< T > &  left,
const T &  other 
)

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::operator/= ( Array< T > &  left,
const T &  other 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator+ ( const Array< T > &  a  ) 

Unary arithmetic operation.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator- ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator+ ( const Array< T > &  left,
const Array< T > &  right 
)

Element by element arithmetic on two arrays, returning an array.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator- ( const Array< T > &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator * ( const Array< T > &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator/ ( const Array< T > &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator+ ( const Array< T > &  left,
const T &  right 
)

Element by element arithmetic between an array and a scalar, returning an array.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator- ( const Array< T > &  left,
const T &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator * ( const Array< T > &  left,
const T &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator/ ( const Array< T > &  left,
const T &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator+ ( const T &  left,
const Array< T > &  right 
)

Element by element arithmetic between a scalar and an array, returning an array.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator- ( const T &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator * ( const T &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::operator/ ( const T &  left,
const Array< T > &  right 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::cos ( const Array< T > &  a  ) 

Transcendental function that can be applied to essentially all numeric types.

Works on an element-by-element basis.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::cosh ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::exp ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::log ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::log10 ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::pow ( const Array< T > &  a,
const Array< T > &  b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::pow ( const T &  a,
const Array< T > &  b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::sin ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::sinh ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::sqrt ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::acos ( const Array< T > &  a  ) 

Transcendental function applied to the array on an element-by-element basis.

Although a template function, this does not make sense for all numeric types.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::asin ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::atan ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::atan2 ( const Array< T > &  y,
const Array< T > &  x 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::ceil ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::fabs ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::abs ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::floor ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::fmod ( const Array< T > &  a,
const Array< T > &  b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::fmod ( const T &  a,
const Array< T > &  b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::fmod ( const Array< T > &  a,
const T &  b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::pow ( const Array< T > &  a,
const Double b 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::tan ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::tanh ( const Array< T > &  a  ) 

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::fabs ( const Array< T > &  a  ) 

N.B.

fabs is deprecated. Use abs.

template<class ScalarType>
void casa::ArrayMath_global_functions_Array_mathematical_operations::minMax ( ScalarType &  minVal,
ScalarType &  maxVal,
IPosition minPos,
IPosition maxPos,
const Array< ScalarType > &  array 
)

Find the minimum and maximum values of an array, including their locations.

template<class ScalarType>
void casa::ArrayMath_global_functions_Array_mathematical_operations::minMax ( ScalarType &  minVal,
ScalarType &  maxVal,
IPosition minPos,
IPosition maxPos,
const Array< ScalarType > &  array,
const Array< Bool > &  mask 
)

The array is only searched at locations where the mask is True.

(at least one such position must exist or an exception will be thrown). MaskType should be an Array of Bool.

template<class ScalarType>
void casa::ArrayMath_global_functions_Array_mathematical_operations::minMaxMasked ( ScalarType &  minVal,
ScalarType &  maxVal,
IPosition minPos,
IPosition maxPos,
const Array< ScalarType > &  array,
const Array< ScalarType > &  mask 
)

The array * mask is searched.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::minMax ( T &  min,
T &  max,
const Array< T > &  a 
)

This sets min and max to the minimum and maximum of the array to avoid having to do two passes with max() and min() separately.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::minMax ( const Array< T > &  a,
T &  min,
T &  max 
) [inline]

This version is deprecated, due to its nonstandard argument order.

Definition at line 252 of file ArrayMath.h.

References casa::minMax().

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::min ( const Array< T > &  a  ) 

The minimum element of the array.

Requires that the type "T" has comparison operators.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::max ( const Array< T > &  a  ) 

The maximum element of the array.

Requires that the type "T" has comparison operators.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::max ( Array< T > &  result,
const Array< T > &  a,
const Array< T > &  b 
)

"result" contains the maximum of "a" and "b" at each position.

"result", "a", and "b" must be conformant.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::min ( Array< T > &  result,
const Array< T > &  a,
const Array< T > &  b 
)

"result" contains the minimum of "a" and "b" at each position.

"result", "a", and "b" must be conformant.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::max ( const Array< T > &  a,
const Array< T > &  b 
)

Return an array that contains the maximum of "a" and "b" at each position.

"a" and "b" must be conformant.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::min ( const Array< T > &  a,
const Array< T > &  b 
)

Return an array that contains the minimum of "a" and "b" at each position.

"a" and "b" must be conformant.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::max ( Array< T > &  result,
const Array< T > &  a,
const T &  b 
)

"result" contains the maximum of "a" and "b" at each position.

"result", and "a" must be conformant.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::min ( Array< T > &  result,
const Array< T > &  a,
const T &  b 
)

"result" contains the minimum of "a" and "b" at each position.

"result", and "a" must be conformant.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::max ( const Array< T > &  a,
const T &  b 
)

Return an array that contains the maximum of "a" and "b" at each position.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::min ( const Array< T > &  a,
const T &  b 
)

Return an array that contains the minimum of "a" and "b" at each position.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::indgen ( Array< T > &  a,
start,
inc 
)

Fills all elements of "array" with a sequence starting with "start" and incrementing by "inc" for each element.

The first axis varies most rapidly.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::indgen ( Array< T > &  a  ) 

Fills all elements of "array" with a sequence starting with 0 and ending with nelements() - 1.

The first axis varies most rapidly.

template<class T>
void casa::ArrayMath_global_functions_Array_mathematical_operations::indgen ( Array< T > &  a,
start 
)

Fills all elements of "array" with a sequence starting with start incremented by one for each position in the array.

The first axis varies most rapidly.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::sum ( const Array< T > &  a  ) 

Sum of every element of the array.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::product ( const Array< T > &  a  ) 

Product of every element of the array.

This could of course easily overflow.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::mean ( const Array< T > &  a  ) 

The mean of "a" is the sum of all elements of "a" divided by the number of elements of "a".

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::variance ( const Array< T > &  a  ) 

The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - 1).

N.B. N-1, not N in the denominator).

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::variance ( const Array< T > &  a,
mean 
)

The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - 1).

N.B. N-1, not N in the denominator). Rather than using a computed mean, use the supplied value.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::stddev ( const Array< T > &  a  ) 

The standard deviation of "a" is the square root of its variance.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::stddev ( const Array< T > &  a,
mean 
)

The standard deviation of "a" is the square root of its variance.

Rather than using a computed mean, use the supplied value.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::avdev ( const Array< T > &  a  ) 

The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.

(N.B. N, not N-1 in the denominator).

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::avdev ( const Array< T > &  a,
mean 
)

The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.

(N.B. N, not N-1 in the denominator). Rather than using a computed mean, use the supplied value.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::rms ( const Array< T > &  a  ) 

The root-mean-square of "a" is the sqrt of sum(a*a)/N.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::median ( const Array< T > &  a  )  [inline]

The median of "a" is a(n/2).

When a has an even number of elements and the switch takeEvenMean is set, the median is 0.5*(a(n/2) + a((n+1)/2)). According to Numerical Recipes (2nd edition) it makes little sense to take the mean when the array is large enough (> 100 elements). Therefore the default for takeEvenMean is False when the array has > 100 elements, otherwise it is True.
If "sorted"==True we assume the data is already sorted and we compute the median directly. Otherwise the function GenSort::kthLargest is used to find the median (kthLargest is about 6 times faster than a full quicksort).
Finding the median means that the array has to be (partially) sorted. By default a copy will be made, but if "inPlace" is in effect, the data themselves will be sorted. That should only be used if the data are used not thereafter.

Definition at line 372 of file ArrayMath.h.

References casa::False, casa::median(), and casa::ArrayBase::nelements().

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::median ( const Array< T > &  a,
Bool  sorted 
) [inline]

Definition at line 374 of file ArrayMath.h.

References casa::False, casa::median(), and casa::ArrayBase::nelements().

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::medianInPlace ( const Array< T > &  a,
Bool  sorted = False 
) [inline]

Definition at line 376 of file ArrayMath.h.

References casa::median(), casa::ArrayBase::nelements(), and casa::True.

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::median ( const Array< T > &  a,
Bool  sorted,
Bool  takeEvenMean,
Bool  inPlace = False 
)

template<class T>
T casa::ArrayMath_global_functions_Array_mathematical_operations::fractile ( const Array< T > &  a,
Float  fraction,
Bool  sorted = False,
Bool  inPlace = False 
)

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<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialSums ( const Array< T > &  array,
const IPosition collapseAxes 
)

The same functions as above, but determine the sum, etc.

for the given axes only. The result is an array with a shape formed by the remaining axes. For example, for an array with shape [3,4,5], collapsing axis 0 results in an array with shape [4,5] containing, say, the sum for each X line. Summing for axes 0 and 2 results in an array with shape [4] containing, say, the sum for each XZ plane. Note: ArrayLogical.h contains the functions ntrue, nfalse, partialNTrue and partialNFalse to count the number of true or false elements in an array.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialProducts ( const Array< T > &  array,
const IPosition collapseAxes 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialMins ( const Array< T > &  array,
const IPosition collapseAxes 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialMaxs ( const Array< T > &  array,
const IPosition collapseAxes 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialMeans ( const Array< T > &  array,
const IPosition collapseAxes 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialVariances ( const Array< T > &  array,
const IPosition collapseAxes 
) [inline]

Definition at line 414 of file ArrayMath.h.

References casa::array().

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialVariances ( const Array< T > &  array,
const IPosition collapseAxes,
const Array< T > &  means 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialStddevs ( const Array< T > &  array,
const IPosition collapseAxes 
) [inline]

Definition at line 423 of file ArrayMath.h.

References casa::array(), and casa::sqrt().

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialStddevs ( const Array< T > &  array,
const IPosition collapseAxes,
const Array< T > &  means 
) [inline]

Definition at line 429 of file ArrayMath.h.

References casa::array(), casa::means(), and casa::sqrt().

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialAvdevs ( const Array< T > &  array,
const IPosition collapseAxes 
) [inline]

Definition at line 435 of file ArrayMath.h.

References casa::array().

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialAvdevs ( const Array< T > &  array,
const IPosition collapseAxes,
const Array< T > &  means 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialRmss ( const Array< T > &  array,
const IPosition collapseAxes 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialMedians ( const Array< T > &  array,
const IPosition collapseAxes,
Bool  takeEvenMean = False,
Bool  inPlace = False 
)

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::partialFractiles ( const Array< T > &  array,
const IPosition collapseAxes,
Float  fraction,
Bool  inPlace = False 
)

void casa::ArrayMath_global_functions_Array_mathematical_operations::operator *= ( Array< Complex > &  left,
const Array< Float > &  other 
)

Methods for element-by-element scaling of Complex by Float.

void casa::ArrayMath_global_functions_Array_mathematical_operations::operator *= ( Array< Complex > &  left,
const Float other 
)

void casa::ArrayMath_global_functions_Array_mathematical_operations::operator/= ( Array< Complex > &  left,
const Array< Float > &  other 
)

void casa::ArrayMath_global_functions_Array_mathematical_operations::operator/= ( Array< Complex > &  left,
const Float other 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::operator * ( const Array< Complex > &  left,
const Array< Float > &  right 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::operator * ( const Array< Complex > &  left,
const Float right 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::operator/ ( const Array< Complex > &  left,
const Array< Float > &  right 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::operator/ ( const Array< Complex > &  left,
const Float right 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::conj ( const Array< Complex > &  carray  ) 

Returns the complex conjugate of a complex array.

Array<DComplex> casa::ArrayMath_global_functions_Array_mathematical_operations::conj ( const Array< DComplex > &  carray  ) 

Matrix<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::conj ( const Matrix< Complex > &  carray  ) 

Matrix<DComplex> casa::ArrayMath_global_functions_Array_mathematical_operations::conj ( const Matrix< DComplex > &  carray  ) 

Array<Float> casa::ArrayMath_global_functions_Array_mathematical_operations::real ( const Array< Complex > &  carray  ) 

Extracts the real part of a complex array into an array of floats.

Array<Double> casa::ArrayMath_global_functions_Array_mathematical_operations::real ( const Array< DComplex > &  carray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::real ( Array< Float > &  rarray,
const Array< Complex > &  carray 
)

Modifies rarray in place.

rarray must be conformant.

void casa::ArrayMath_global_functions_Array_mathematical_operations::real ( Array< Double > &  rarray,
const Array< DComplex > &  carray 
)

Array<Float> casa::ArrayMath_global_functions_Array_mathematical_operations::imag ( const Array< Complex > &  carray  ) 

Extracts the imaginary part of a complex array into an array of floats.

Array<Double> casa::ArrayMath_global_functions_Array_mathematical_operations::imag ( const Array< DComplex > &  carray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::imag ( Array< Float > &  rarray,
const Array< Complex > &  carray 
)

Modifies rarray in place.

rarray must be conformant.

void casa::ArrayMath_global_functions_Array_mathematical_operations::imag ( Array< Double > &  rarray,
const Array< DComplex > &  carray 
)

Array<Float> casa::ArrayMath_global_functions_Array_mathematical_operations::amplitude ( const Array< Complex > &  carray  ) 

Extracts the amplitude (i.e.

sqrt(re*re + im*im)) from an array of complex numbers. N.B. this is presently called "fabs" for a single complex number.

Array<Double> casa::ArrayMath_global_functions_Array_mathematical_operations::amplitude ( const Array< DComplex > &  carray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::amplitude ( Array< Float > &  rarray,
const Array< Complex > &  carray 
)

Modifies rarray in place.

rarray must be conformant.

void casa::ArrayMath_global_functions_Array_mathematical_operations::amplitude ( Array< Double > &  rarray,
const Array< DComplex > &  carray 
)

Array<Float> casa::ArrayMath_global_functions_Array_mathematical_operations::phase ( const Array< Complex > &  carray  ) 

Extracts the phase (i.e.

atan2(im, re)) from an array of complex numbers. N.B. this is presently called "arg" for a single complex number.

Array<Double> casa::ArrayMath_global_functions_Array_mathematical_operations::phase ( const Array< DComplex > &  carray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::phase ( Array< Float > &  rarray,
const Array< Complex > &  carray 
)

Modifies rarray in place.

rarray must be conformant.

void casa::ArrayMath_global_functions_Array_mathematical_operations::phase ( Array< Double > &  rarray,
const Array< DComplex > &  carray 
)

Array<Float> casa::ArrayMath_global_functions_Array_mathematical_operations::ComplexToReal ( const Array< Complex > &  carray  ) 

Copy an array of complex into an array of real,imaginary pairs.

The first axis of the real array becomes twice as long as the complex array. In the future versions which work by reference will be available; presently a copy is made.

Array<Double> casa::ArrayMath_global_functions_Array_mathematical_operations::ComplexToReal ( const Array< DComplex > &  carray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::ComplexToReal ( Array< Float > &  rarray,
const Array< Complex > &  carray 
)

Modify the array "rarray" in place.

"rarray" must be the correct shape.

void casa::ArrayMath_global_functions_Array_mathematical_operations::ComplexToReal ( Array< Double > &  rarray,
const Array< DComplex > &  carray 
)

Array<Complex> casa::ArrayMath_global_functions_Array_mathematical_operations::RealToComplex ( const Array< Float > &  rarray  ) 

Copy an array of real,imaginary pairs into a complex array.

The first axis must have an even length. In the future versions which work by reference will be available; presently a copy is made.

Array<DComplex> casa::ArrayMath_global_functions_Array_mathematical_operations::RealToComplex ( const Array< Double > &  rarray  ) 

void casa::ArrayMath_global_functions_Array_mathematical_operations::RealToComplex ( Array< Complex > &  carray,
const Array< Float > &  rarray 
)

Modify the array "carray" in place.

"carray" must be the correct shape.

void casa::ArrayMath_global_functions_Array_mathematical_operations::RealToComplex ( Array< DComplex > &  carray,
const Array< Double > &  rarray 
)

template<typename T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::slidingArrayMath ( const Array< T > &  array,
const IPosition halfBoxSize,
T(*)(const Array< T > &)  reductionFunc,
Bool  fillEdge = True 
)

Apply for each element in the array the given ArrayMath reduction function to the box around that element.

The full box is 2*halfBoxSize + 1. It can be used for arrays and boxes of any dimensionality; missing halfBoxSize values are set to 1.

Example

Determine for each element in the array the median of a box with size [51,51] around that element:

       Array<Float> medians = boxedArrayMath(in, IPosition(2,25,25),
                                             casa::median);
This is a potentially expensive operation. On a high-end PC it took appr. 27 seconds to get the medians for an array of [1000,1000] using a halfBoxSize of [50,50].


The fillEdge argument determines how the edge is filled where no full boxes can be made. True means it is set to zero; False means that the edge is removed, thus the output array is smaller than the input array. Note: This brute-force method of determining the medians outperforms all kinds of smart implementations. For a vector it is about as fast as class MedianSlider , for a 2D array it is much, much faster.

template<class T, class U>
void casa::ArrayMath_global_functions_Array_mathematical_operations::convertArray ( Array< T > &  to,
const Array< U > &  from 
)

Make a copy of an array of a different type; for example make an array of doubles from an array of floats.

Arrays to and from must be conformant (same shape). Also, it must be possible to convert a scalar of type U to type T.

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::square ( const Array< T > &  val  )  [inline]

Returns an array where every element is squared.

Definition at line 587 of file ArrayMath.h.

References casa::Array< T >::copy().

template<class T>
Array<T> casa::ArrayMath_global_functions_Array_mathematical_operations::cube ( const Array< T > &  val  )  [inline]

Returns an array where every element is cubed.

Definition at line 595 of file ArrayMath.h.

References casa::Array< T >::copy().


The documentation for this struct was generated from the following file:
Generated on Mon Sep 1 22:43:39 2008 for NRAOCASA by  doxygen 1.5.1