Loading...
Searching...
No Matches
casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations Struct Reference
casa package (libcasa_casa) » Arrays_module

More...

`#include <MaskArrMath.h>`

## Public Member Functions

template<class T>
const MaskedArray< T > & | operator+= (const MaskedArray< T > &left, const Array< T > &other)
| Element by element arithmetic modifying left in-place.
template<class T>
const MaskedArray< T > & | operator-= (const MaskedArray< T > &left, const Array< T > &other)
template<class T>
const MaskedArray< T > & | operator*= (const MaskedArray< T > &left, const Array< T > &other)
template<class T>
const MaskedArray< T > & | operator/= (const MaskedArray< T > &left, const Array< T > &other)
template<class T>
Array< T > & | operator+= (Array< T > &left, const MaskedArray< T > &other)
template<class T>
Array< T > & | operator-= (Array< T > &left, const MaskedArray< T > &other)
template<class T>
Array< T > & | operator*= (Array< T > &left, const MaskedArray< T > &other)
template<class T>
Array< T > & | operator/= (Array< T > &left, const MaskedArray< T > &other)
template<class T>
const MaskedArray< T > & | operator+= (const MaskedArray< T > &left, const MaskedArray< T > &other)
template<class T>
const MaskedArray< T > & | operator-= (const MaskedArray< T > &left, const MaskedArray< T > &other)
template<class T>
const MaskedArray< T > & | operator*= (const MaskedArray< T > &left, const MaskedArray< T > &other)
template<class T>
const MaskedArray< T > & | operator/= (const MaskedArray< T > &left, const MaskedArray< T > &other)
template<class T, class S>
const MaskedArray< T > & | operator/= (const MaskedArray< T > &left, const MaskedArray< S > &other)
template<class T>
const MaskedArray< T > & | operator+= (const MaskedArray< T > &left, const T &other)
| Element by element arithmetic modifying left in-place.
template<class T>
const MaskedArray< T > & | operator-= (const MaskedArray< T > &left, const T &other)
template<class T>
const MaskedArray< T > & | operator*= (const MaskedArray< T > &left, const T &other)
template<class T>
const MaskedArray< T > & | operator/= (const MaskedArray< T > &left, const T &other)
template<class T>
MaskedArray< T > | operator+ (const MaskedArray< T > &a)
| Unary arithmetic operation.
template<class T>
MaskedArray< T > | operator- (const MaskedArray< T > &a)
template<class T>
MaskedArray< T > | operator+ (const MaskedArray< T > &left, const Array< T > &right)
| Element by element arithmetic on MaskedArrays, returns a MaskedArray.
template<class T>
MaskedArray< T > | operator- (const MaskedArray< T > &left, const Array< T > &right)
template<class T>
MaskedArray< T > | operator* (const MaskedArray< T > &left, const Array< T > &right)
template<class T>
MaskedArray< T > | operator/ (const MaskedArray< T > &left, const Array< T > &right)
template<class T>
MaskedArray< T > | operator+ (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator- (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator* (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator/ (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator+ (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator- (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator* (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator/ (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator+ (const MaskedArray< T > &left, const T &right)
| Element by element arithmetic between a MaskedArray and a scalar, returning a MaskedArray.
template<class T>
MaskedArray< T > | operator- (const MaskedArray< T > &left, const T &right)
template<class T>
MaskedArray< T > | operator* (const MaskedArray< T > &left, const T &right)
template<class T>
MaskedArray< T > | operator/ (const MaskedArray< T > &left, const T &right)
MaskedArray< std::complex< float > > | operator* (const MaskedArray< std::complex< float > > &left, const float &right)
template<class T>
MaskedArray< T > | operator+ (const T &left, const MaskedArray< T > &right)
| Element by element arithmetic between a scalar and a MaskedArray, returning a MaskedArray.
template<class T>
MaskedArray< T > | operator- (const T &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator* (const T &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | operator/ (const T &left, const MaskedArray< T > &right)
MaskedArray< std::complex< float > > | operator* (const float &left, const MaskedArray< std::complex< float > > &right)
template<class T>
MaskedArray< T > | sin (const MaskedArray< T > &left)
| Transcendental function applied to the array on an element-by-element basis.
template<class T>
MaskedArray< T > | cos (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | tan (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | asin (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | acos (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | atan (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | sinh (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | cosh (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | tanh (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | exp (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | log (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | log10 (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | sqrt (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | abs (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | fabs (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | ceil (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | floor (const MaskedArray< T > &left)
template<class T>
MaskedArray< T > | atan2 (const MaskedArray< T > &left, const Array< T > &right)
| Transcendental functions requiring two arguments applied on an element-by-element basis.
template<class T>
MaskedArray< T > | fmod (const MaskedArray< T > &left, const Array< T > &right)
template<class T>
MaskedArray< T > | atan2 (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | fmod (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | atan2 (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | fmod (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | atan2 (const MaskedArray< T > &left, const T &right)
template<class T>
MaskedArray< T > | fmod (const MaskedArray< T > &left, const T &right)
template<class T>
MaskedArray< T > | atan2 (const T &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | fmod (const T &left, const MaskedArray< T > &right)
template<class T, class U>
MaskedArray< T > | pow (const MaskedArray< T > &left, const Array< U > &right)
template<class T, class U>
MaskedArray< T > | pow (const Array< T > &left, const MaskedArray< U > &right)
template<class T, class U>
MaskedArray< T > | pow (const MaskedArray< T > &left, const MaskedArray< U > &right)
template<class T>
MaskedArray< T > | pow (const MaskedArray< T > &left, const double &right)
template<class T>
MaskedArray< T > | real (const MaskedArray< std::complex< T > > &carray)
| Extracts the real part of a complex array into an array of floats.
template<class T>
MaskedArray< T > | imag (const MaskedArray< std::complex< T > > &carray)
| Extracts the imaginary part of a complex array into an array of floats.
template<class T>
void | minMax (T &minVal, T &maxVal, IPosition &minPos, IPosition &maxPos, const MaskedArray< T > &marray)
| Find the minimum and maximum values of a MaskedArray.
template<class T>
void | minMax (T &minVal, T &maxVal, const MaskedArray< T > &marray)
template<class T>
T | min (const MaskedArray< T > &left)
| The "min" and "max" functions require that the type "T" have comparison operators.
template<class T>
MaskedArray< T > | min (const MaskedArray< T > &left, const Array< T > &right)
| Return an array that contains the minimum of "left" and "right" at each position.
template<class T>
MaskedArray< T > | min (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | min (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | min (const T &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | min (const MaskedArray< T > &left, const T &right)
template<class T>
void | min (const MaskedArray< T > &result, const Array< T > &left, const Array< T > &right)
| "result" contains the minimum of "left" and "right" at each position.
template<class T>
T | max (const MaskedArray< T > &left)
| The maximum element of the array.
template<class T>
MaskedArray< T > | max (const MaskedArray< T > &left, const Array< T > &right)
| Return an array that contains the maximum of "left" and "right" at each position.
template<class T>
MaskedArray< T > | max (const Array< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | max (const MaskedArray< T > &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | max (const T &left, const MaskedArray< T > &right)
template<class T>
MaskedArray< T > | max (const MaskedArray< T > &left, const T &right)
template<class T>
void | max (const MaskedArray< T > &result, const Array< T > &left, const Array< T > &right)
| "result" contains the maximum of "left" and "right" at each position.
template<class T>
void | indgen (MaskedArray< T > &a, T start, T inc)
| Fills all elements of "array" where the mask is true with a sequence starting with "start" and incrementing by "inc" for each element where the mask is true.
template<class T>
void | indgen (MaskedArray< T > &a)
| Fills all elements of "array" where the mask is true with a sequence starting with 0 and incremented by one for each element where the mask is true.
template<class T>
void | indgen (MaskedArray< T > &a, T start)
| Fills all elements of "array" where the mask is true with a sequence starting with "start" and incremented by one for each element where the mask is true.
template<class T>
T | sum (const MaskedArray< T > &a)
template<class T>
T | sumsquares (const MaskedArray< T > &a)
| Sum of the squares of every element of the MaskedArray where the Mask is true.
template<class T>
T | product (const MaskedArray< T > &a)
| Product of every element of the MaskedArray where the Mask is true.
template<class T>
T | mean (const MaskedArray< 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 | variance (const MaskedArray< T > &a)
| The variance of "a" is the sum of (a(i) - mean(a))**2/(a.nelements() - ddof).
template<class T>
T | pvariance (const MaskedArray< T > &a, size_t ddof=0)
template<class T>
T | variance (const MaskedArray< T > &a, T mean)
| Rather than using a computed mean, use the supplied value.
template<class T>
T | pvariance (const MaskedArray< T > &a, T mean, size_t ddof=0)
template<class T>
T | stddev (const MaskedArray< T > &a)
| The standard deviation of "a" is the square root of its variance.
template<class T>
T | pstddev (const MaskedArray< T > &a, size_t ddof=0)
template<class T>
T | stddev (const MaskedArray< T > &a, T mean)
template<class T>
T | pstddev (const MaskedArray< T > &a, T mean, size_t ddof=0)
template<class T>
T | avdev (const MaskedArray< T > &a)
| The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
template<class T>
T | avdev (const MaskedArray< T > &a, T mean)
| The average deviation of "a" is the sum of abs(a(i) - mean(a))/N.
template<class T>
T | rms (const MaskedArray< T > &a)
| The root-mean-square of "a" is the sqrt of sum(a*a)/N.
template<class T>
T | median (const MaskedArray< T > &a, bool sorted=false)
| The median of "a" is a(n/2).
template<class T>
T | median (const MaskedArray< T > &a, bool sorted, bool takeEvenMean)
template<class T>
T | madfm (const MaskedArray< T > &a, bool sorted=false)
| The median absolute deviation from the median.
template<class T>
T | madfm (const MaskedArray< T > &a, bool sorted, bool takeEvenMean)
template<class T>
MaskedArray< T > | square (const MaskedArray< T > &val)
| Returns a MaskedArray where every element is squared.
template<class T>
MaskedArray< T > | cube (const MaskedArray< T > &val)
| Returns a MaskedArray where every element is cubed.

## Detailed Description

Mathematical operations for MaskedArrays (and with Arrays)

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25
Test programs:
  tMaskArrMath0 tMaskArrMath1 tMaskArrMath2 tMaskArrExcp

### Prerequisite

- Array
- MaskedArray

### Etymology

MaskArrMath is short for MaskedArrayMath, which is too long by the old AIPS++ file naming conventions. This file contains global functions which perform element by element mathematical operations on masked arrays.

### Synopsis

These functions perform element by element mathematical operations on masked arrays. With two arrays, they must both conform, and the result is done element by element, for those locations where the mask of the MaskedArray is true. For two MaskedArrays, the "and" of the masks is used.

### Example

Vector<int> a(10);
Vector<int> b(10);
Vector<int> c(10);
...
c = a(a>0) + b(b>0);
casacore::Vector
Definition Vector.h:82

This example sets those elements of c where ((a>0) && (b>0)) to (a+b). Elements of c where !((a>0) && (b>0)) are unchanged. The result of this operation is a MaskedArray. The assignment from this MaskedArray to the Vector c only assigns those elements where the mask is true.

### Example

Vector<double> a(10);
Vector<double> b(10);
Vector<double> c(10);
...
c = atan2 (a, b(b>0);
casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2
MaskedArray< T > atan2(const MaskedArray< T > &left, const Array< T > &right)
Transcendental functions requiring two arguments applied on an element-by-element basis.

This example sets those elements of c where (b>0) to atan2 (a,b). Elements of c where !(b>0) are unchanged. The result of this operation is a MaskedArray. The assignment from this MaskedArray to the Vector c only assigns those elements where the mask is true.

### Example

Vector<int> a(10);
int result;
...
result = sum (a(a>0));
casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sum
T sum(const MaskedArray< T > &a)

This example sums a, for those elements of a which are greater than 0.

### Motivation

One wants to be able to mask arrays and perform mathematical operations on those masked arrays. Since the masked arrays are only defined where the masks are true, the result must be a MaskedArray, or a simple number.

Definition at line 108 of file MaskArrMath.h.

## Member Function Documentation

## abs()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::abs | ( | const MaskedArray< T > & | left | ) |

## acos()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::acos | ( | const MaskedArray< T > & | left | ) |

## asin()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::asin | ( | const MaskedArray< T > & | left | ) |

## atan()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan | ( | const MaskedArray< T > & | left | ) |

## atan2() [1/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2 | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## atan2() [2/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2 | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

Transcendental functions requiring two arguments applied on an element-by-element basis.

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

### Thrown Exceptions

- ArrayConformanceError

## atan2() [3/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2 | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## atan2() [4/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2 | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## atan2() [5/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::atan2 | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## avdev() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::avdev | ( | const MaskedArray< 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).

## avdev() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::avdev | ( | const MaskedArray< T > & | a,
|  | T | 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.

References mean().

## ceil()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::ceil | ( | const MaskedArray< T > & | left | ) |

## cos()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::cos | ( | const MaskedArray< T > & | left | ) |

## cosh()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::cosh | ( | const MaskedArray< T > & | left | ) |

## cube()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::cube | ( | const MaskedArray< T > & | val | ) |

Returns a MaskedArray where every element is cubed.

## exp()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::exp | ( | const MaskedArray< T > & | left | ) |

## fabs()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fabs | ( | const MaskedArray< T > & | left | ) |

## floor()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::floor | ( | const MaskedArray< T > & | left | ) |

## fmod() [1/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fmod | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## fmod() [2/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fmod | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

## fmod() [3/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fmod | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## fmod() [4/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fmod | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## fmod() [5/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::fmod | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## imag()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::imag | ( | const MaskedArray< std::complex< T > > & | carray | ) |

inline

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

Definition at line 250 of file MaskArrMath.h.

References imag().

Referenced by imag().

## indgen() [1/3]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::indgen | ( | MaskedArray< T > & | a | ) |

Fills all elements of "array" where the mask is true with a sequence starting with 0 and incremented by one for each element where the mask is true.

The first axis varies most rapidly.

## indgen() [2/3]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::indgen | ( | MaskedArray< T > & | a,
|  | T | start )

Fills all elements of "array" where the mask is true with a sequence starting with "start" and incremented by one for each element where the mask is true.

The first axis varies most rapidly.

## indgen() [3/3]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::indgen | ( | MaskedArray< T > & | a,
|  | T | start,
|  | T | inc )

Fills all elements of "array" where the mask is true with a sequence starting with "start" and incrementing by "inc" for each element where the mask is true.

The first axis varies most rapidly.

## log()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::log | ( | const MaskedArray< T > & | left | ) |

## log10()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::log10 | ( | const MaskedArray< T > & | left | ) |

## madfm() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::madfm | ( | const MaskedArray< T > & | a,
|  | bool | sorted,
|  | bool | takeEvenMean )

## madfm() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::madfm | ( | const MaskedArray< T > & | a,
|  | bool | sorted = false )

inline

The median absolute deviation from the median.

Interface is as for the median functions

Definition at line 432 of file MaskArrMath.h.

References madfm(), and casacore::MaskedArray< T >::nelements().

Referenced by madfm().

## max() [1/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## max() [2/7]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const MaskedArray< T > & | left | ) |

The maximum element of the array.

## max() [3/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

Return an array that contains the maximum of "left" and "right" at each position.

"left" and "right" must be conformant.

### Thrown Exceptions

- ArrayError

## max() [4/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## max() [5/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## max() [6/7]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const MaskedArray< T > & | result,
|  | const Array< T > & | left,
|  | const Array< T > & | right )

"result" contains the maximum of "left" and "right" at each position.

"result", "left", and "right" must be conformant.

### Thrown Exceptions

- ArrayConformanceError

## max() [7/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::max | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## mean()

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::mean | ( | const MaskedArray< T > & | a | ) |

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

Referenced by avdev(), pstddev(), pvariance(), stddev(), and variance().

## median() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::median | ( | const MaskedArray< T > & | a,
|  | bool | sorted,
|  | bool | takeEvenMean )

## median() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::median | ( | const MaskedArray< T > & | a,
|  | bool | sorted = false )

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).

Definition at line 423 of file MaskArrMath.h.

References median(), and casacore::MaskedArray< T >::nelements().

Referenced by median().

## min() [1/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## min() [2/7]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const MaskedArray< T > & | left | ) |

The "min" and "max" functions require that the type "T" have comparison operators.

The minimum element of the array.

## min() [3/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

Return an array that contains the minimum of "left" and "right" at each position.

"left" and "right" must be conformant.

### Thrown Exceptions

- ArrayError

## min() [4/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## min() [5/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## min() [6/7]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const MaskedArray< T > & | result,
|  | const Array< T > & | left,
|  | const Array< T > & | right )

"result" contains the minimum of "left" and "right" at each position.

"result", "left", and "right" must be conformant.

### Thrown Exceptions

- ArrayConformanceError

## min() [7/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::min | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## minMax() [1/2]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::minMax | ( | T & | minVal,
|  | T & | maxVal,
|  | const MaskedArray< T > & | marray )

References casacore::marray().

## minMax() [2/2]

template<class T>

void casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::minMax | ( | T & | minVal,
|  | T & | maxVal,
|  | IPosition & | minPos,
|  | IPosition & | maxPos,
|  | const MaskedArray< T > & | marray )

Find the minimum and maximum values of a MaskedArray.

Also find the IPositions of the minimum and maximum values.

### Thrown Exceptions

- ArrayError

References casacore::marray().

## operator*() [1/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## operator*() [2/7]

MaskedArray< std::complex< float > > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const float & | left,
|  | const MaskedArray< std::complex< float > > & | right )

## operator*() [3/7]

MaskedArray< std::complex< float > > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const MaskedArray< std::complex< float > > & | left,
|  | const float & | right )

## operator*() [4/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

## operator*() [5/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## operator*() [6/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## operator*() [7/7]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator* | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## operator*=() [1/4]

template<class T>

Array< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator*= | ( | Array< T > & | left,
|  | const MaskedArray< T > & | other )

## operator*=() [2/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator*= | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | other )

## operator*=() [3/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator*= | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | other )

## operator*=() [4/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator*= | ( | const MaskedArray< T > & | left,
|  | const T & | other )

## operator+() [1/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## operator+() [2/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const MaskedArray< T > & | a | ) |

Unary arithmetic operation.

## operator+() [3/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

Element by element arithmetic on MaskedArrays, returns a MaskedArray.

### Thrown Exceptions

- ArrayConformanceError

## operator+() [4/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## operator+() [5/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const MaskedArray< T > & | left,
|  | const T & | right )

Element by element arithmetic between a MaskedArray and a scalar, returning a MaskedArray.

## operator+() [6/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+ | ( | const T & | left,
|  | const MaskedArray< T > & | right )

Element by element arithmetic between a scalar and a MaskedArray, returning a MaskedArray.

## operator+=() [1/4]

template<class T>

Array< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+= | ( | Array< T > & | left,
|  | const MaskedArray< T > & | other )

## operator+=() [2/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+= | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | other )

Element by element arithmetic modifying left in-place.

left and other must be conformant.

### Thrown Exceptions

- ArrayConformanceError

## operator+=() [3/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+= | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | other )

## operator+=() [4/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator+= | ( | const MaskedArray< 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.

## operator-() [1/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## operator-() [2/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const MaskedArray< T > & | a | ) |

## operator-() [3/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

## operator-() [4/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## operator-() [5/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## operator-() [6/6]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator- | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## operator-=() [1/4]

template<class T>

Array< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator-= | ( | Array< T > & | left,
|  | const MaskedArray< T > & | other )

## operator-=() [2/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator-= | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | other )

## operator-=() [3/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator-= | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | other )

## operator-=() [4/4]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator-= | ( | const MaskedArray< T > & | left,
|  | const T & | other )

## operator/() [1/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/ | ( | const Array< T > & | left,
|  | const MaskedArray< T > & | right )

## operator/() [2/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/ | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | right )

## operator/() [3/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/ | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | right )

## operator/() [4/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/ | ( | const MaskedArray< T > & | left,
|  | const T & | right )

## operator/() [5/5]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/ | ( | const T & | left,
|  | const MaskedArray< T > & | right )

## operator/=() [1/5]

template<class T>

Array< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/= | ( | Array< T > & | left,
|  | const MaskedArray< T > & | other )

## operator/=() [2/5]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/= | ( | const MaskedArray< T > & | left,
|  | const Array< T > & | other )

## operator/=() [3/5]

template<class T, class S>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/= | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< S > & | other )

## operator/=() [4/5]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/= | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< T > & | other )

## operator/=() [5/5]

template<class T>

const MaskedArray< T > & casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::operator/= | ( | const MaskedArray< T > & | left,
|  | const T & | other )

## pow() [1/4]

template<class T, class U>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pow | ( | const Array< T > & | left,
|  | const MaskedArray< U > & | right )

## pow() [2/4]

template<class T, class U>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pow | ( | const MaskedArray< T > & | left,
|  | const Array< U > & | right )

## pow() [3/4]

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pow | ( | const MaskedArray< T > & | left,
|  | const double & | right )

## pow() [4/4]

template<class T, class U>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pow | ( | const MaskedArray< T > & | left,
|  | const MaskedArray< U > & | right )

## product()

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::product | ( | const MaskedArray< T > & | a | ) |

Product of every element of the MaskedArray where the Mask is true.

This could of course easily overflow.

## pstddev() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pstddev | ( | const MaskedArray< T > & | a,
|  | size_t | ddof = 0 )

## pstddev() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pstddev | ( | const MaskedArray< T > & | a,
|  | T | mean,
|  | size_t | ddof = 0 )

References mean().

## pvariance() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pvariance | ( | const MaskedArray< T > & | a,
|  | size_t | ddof = 0 )

## pvariance() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::pvariance | ( | const MaskedArray< T > & | a,
|  | T | mean,
|  | size_t | ddof = 0 )

References mean().

## real()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::real | ( | const MaskedArray< std::complex< T > > & | carray | ) |

inline

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

Definition at line 244 of file MaskArrMath.h.

References real().

Referenced by real().

## rms()

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::rms | ( | const MaskedArray< T > & | a | ) |

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

## sin()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sin | ( | const MaskedArray< T > & | left | ) |

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

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

## sinh()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sinh | ( | const MaskedArray< T > & | left | ) |

## sqrt()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sqrt | ( | const MaskedArray< T > & | left | ) |

## square()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::square | ( | const MaskedArray< T > & | val | ) |

Returns a MaskedArray where every element is squared.

## stddev() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::stddev | ( | const MaskedArray< T > & | a | ) |

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

## stddev() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::stddev | ( | const MaskedArray< T > & | a,
|  | T | mean )

References mean().

## sum()

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sum | ( | const MaskedArray< T > & | a | ) |

### Thrown Exceptions

- ArrayError

Sum of every element of the MaskedArray where the Mask is true.

## sumsquares()

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::sumsquares | ( | const MaskedArray< T > & | a | ) |

Sum of the squares of every element of the MaskedArray where the Mask is true.

## tan()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::tan | ( | const MaskedArray< T > & | left | ) |

## tanh()

template<class T>

MaskedArray< T > casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::tanh | ( | const MaskedArray< T > & | left | ) |

## variance() [1/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::variance | ( | const MaskedArray< T > & | a | ) |

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

Similar to numpy the argument ddof tells if the population variance (ddof=0) or the sample variance (ddof=1) is taken. The variance functions proper use ddof=1.
Note that for a complex valued T the absolute values are used; in that way the variance is equal to the sum of the variances of the real and imaginary parts. Hence the imaginary part in the return value is 0.

## variance() [2/2]

template<class T>

T casacore::MaskArrMath_global_functions_MaskedArray_mathematical_operations::variance | ( | const MaskedArray< T > & | a,
|  | T | mean )

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

References mean().

The documentation for this struct was generated from the following file:

- casa/Arrays/MaskArrMath.h