MaskArrLogi.h

Classes

Global Functions -- Logical operations for MaskedArrays, and between MaskedArrays and Arrays. (full description)

Logical operations for MaskedArrays, and between MaskedArrays and Arrays. (source)

Interface

Bool allLE (const MaskedArray<T> &l, const Array<T> &r)
Bool allLT (const MaskedArray<T> &l, const Array<T> &r)
Bool allGE (const MaskedArray<T> &l, const Array<T> &r)
Bool allGT (const MaskedArray<T> &l, const Array<T> &r)
Bool allEQ (const MaskedArray<T> &l, const Array<T> &r)
Bool allNE (const MaskedArray<T> &l, const Array<T> &r)
Bool allAND (const MaskedArray<T> &l, const Array<T> &r)
Bool allOR (const MaskedArray<T> &l, const Array<T> &r)
Bool allLE (const Array<T> &l, const MaskedArray<T> &r)
Bool allLT (const Array<T> &l, const MaskedArray<T> &r)
Bool allGE (const Array<T> &l, const MaskedArray<T> &r)
Bool allGT (const Array<T> &l, const MaskedArray<T> &r)
Bool allEQ (const Array<T> &l, const MaskedArray<T> &r)
Bool allNE (const Array<T> &l, const MaskedArray<T> &r)
Bool allAND (const Array<T> &l, const MaskedArray<T> &r)
Bool allOR (const Array<T> &l, const MaskedArray<T> &r)
Bool allLE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allLT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allGE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allGT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allEQ (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allNE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allAND (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allOR (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator <= (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator < (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator >= (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator > (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator == (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator != (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator && (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator || (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator <= (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator < (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator >= (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator > (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator == (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator != (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator && (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator || (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator <= (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator < (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator >= (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator > (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator == (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator != (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator && (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator || (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator ! (const MaskedArray<T> &marray)
Bool allLE (const MaskedArray<T> &array, const T &val)
Bool allLE (const T &val, const MaskedArray<T> &array)
Bool allLT (const MaskedArray<T> &array, const T &val)
Bool allLT (const T &val, const MaskedArray<T> &array)
Bool allGE (const MaskedArray<T> &array, const T &val)
Bool allGE (const T &val, const MaskedArray<T> &array)
Bool allGT (const MaskedArray<T> &array, const T &val)
Bool allGT (const T &val, const MaskedArray<T> &array)
Bool allEQ (const MaskedArray<T> &array, const T &val)
Bool allEQ (const T &val, const MaskedArray<T> &array)
Bool allNE (const MaskedArray<T> &array, const T &val)
Bool allNE (const T &val, const MaskedArray<T> &array)
Bool allAND (const MaskedArray<T> &array, const T &val)
Bool allAND (const T &val, const MaskedArray<T> &array)
Bool allOR (const MaskedArray<T> &array, const T &val)
Bool allOR (const T &val, const MaskedArray<T> &array)
MaskedLogicalArray operator <= (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator <= (const T &val, const T<T> &array)
MaskedLogicalArray operator < (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator < (const T &val, const T<T> &array)
MaskedLogicalArray operator >= (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator >= (const T &val, const T<T> &array)
MaskedLogicalArray operator > (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator > (const T &val, const T<T> &array)
MaskedLogicalArray operator == (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator == (const T &val, const T<T> &array)
MaskedLogicalArray operator != (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator != (const T &val, const T<T> &array)
MaskedLogicalArray operator && (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator && (const T &val, const T<T> &array)
MaskedLogicalArray operator || (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator || (const T &val, const T<T> &array)
Bool anyLE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyLT (const MaskedArray<T> &l, const Array<T> &r)
Bool anyGE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyGT (const MaskedArray<T> &l, const Array<T> &r)
Bool anyEQ (const MaskedArray<T> &l, const Array<T> &r)
Bool anyNE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyAND (const MaskedArray<T> &l, const Array<T> &r)
Bool anyOR (const MaskedArray<T> &l, const Array<T> &r)
Bool anyLE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyLT (const Array<T> &l, const MaskedArray<T> &r)
Bool anyGE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyGT (const Array<T> &l, const MaskedArray<T> &r)
Bool anyEQ (const Array<T> &l, const MaskedArray<T> &r)
Bool anyNE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyAND (const Array<T> &l, const MaskedArray<T> &r)
Bool anyOR (const Array<T> &l, const MaskedArray<T> &r)
Bool anyLE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyLT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyGE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyGT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyEQ (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyNE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyAND (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyOR (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyLE (const MaskedArray<T> &array, const T &val)
Bool anyLE (const T &val, const MaskedArray<T> &array)
Bool anyLT (const MaskedArray<T> &array, const T &val)
Bool anyLT (const T &val, const MaskedArray<T> &array)
Bool anyGE (const MaskedArray<T> &array, const T &val)
Bool anyGE (const T &val, const MaskedArray<T> &array)
Bool anyGT (const MaskedArray<T> &array, const T &val)
Bool anyGT (const T &val, const MaskedArray<T> &array)
Bool anyEQ (const MaskedArray<T> &array, const T &val)
Bool anyEQ (const T &val, const MaskedArray<T> &array)
Bool anyNE (const MaskedArray<T> &array, const T &val)
Bool anyNE (const T &val, const MaskedArray<T> &array)
Bool anyAND (const MaskedArray<T> &array, const T &val)
Bool anyAND (const T &val, const MaskedArray<T> &array)
Bool anyOR (const MaskedArray<T> &array, const T &val)
Bool anyOR (const T &val, const MaskedArray<T> &array)

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

Prerequisite

Etymology

MaskArrLogi is short for MaskedArrayLogical, which is too long by AIPS++ file naming conventions. This file contains global functions which perform element by element logical operations on masked arrays.

Synopsis

These functions perform element by element logical 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.

There are two classes of functions. One class returns a MaskedLogicalArray. In these functions, the value of an element of the MaskedLogicalArray is the value of the logical operation applied to the corresponding elements of the input MaskedArrays. The other class of functions returns a single Bool. The return value is True if the logical operation returns True for all elements of the input masked arrays for the "all" functions (e.g. allLE()), and returns True if the logical operation returns True for any elements of the input masked arrays for the "any" functions (e.g. anyLE()). The functions which return a single Bool throw an exception if the AND of the masks of the input masked arrays has no True elements.

For instance allLE (a, b) imples that every element of a is less than or equal to every element of b. Note that with this definition allLE (a, b) and allGE (a, b) can both be false (e.g. a = [1,0] b = [0,1]).

NB comparison between two zero-sized arrays is not defined (should it throw an exception?).

Example

   Vector<Int> a(10);
   Vector<Int> b(10);
   LogicalVector l(10);
      . . .
   l = a(a>0) < b(b>0);
This example sets those elements of l where ((a>0) && (b>0)) to (a0) && (b>0)) are unchanged. The result of the comparison is a MaskedLogicalArray. The assignment from this MaskedLogicalArray to the LogicalArray l only assigns those elements where the mask is True.

Example

   Vector<Int> a(10);
   Vector<Int> b(10);
   Bool result;
      . . .
   result = allLT (a(a>0), b(b>0));
This example sets result to True if, for all elements where ((a>0) && (b>0)), a

Motivation

One wants to be able to mask arrays and perform logical operations on those masked arrays. Since the masked arrays are only defined where the masks are True, the result must be a MaskedLogicalArray, or a single Bool.

To Do

Member Description

Bool allAND (const MaskedArray<T> &l, const Array<T> &r)
Bool allOR (const MaskedArray<T> &l, const Array<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for every element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

Bool allAND (const Array<T> &l, const MaskedArray<T> &r)
Bool allOR (const Array<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for every element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

Bool allLE (const MaskedArray<T> &l, const Array<T> &r)
Bool allLT (const MaskedArray<T> &l, const Array<T> &r)
Bool allGE (const MaskedArray<T> &l, const Array<T> &r)
Bool allGT (const MaskedArray<T> &l, const Array<T> &r)
Bool allEQ (const MaskedArray<T> &l, const Array<T> &r)
Bool allNE (const MaskedArray<T> &l, const Array<T> &r)
Bool allLE (const Array<T> &l, const MaskedArray<T> &r)
Bool allLT (const Array<T> &l, const MaskedArray<T> &r)
Bool allGE (const Array<T> &l, const MaskedArray<T> &r)
Bool allGT (const Array<T> &l, const MaskedArray<T> &r)
Bool allEQ (const Array<T> &l, const MaskedArray<T> &r)
Bool allNE (const Array<T> &l, const MaskedArray<T> &r)
Bool allLE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allLT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allGE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allGT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allEQ (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allNE (const MaskedArray<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for every element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

Bool allAND (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool allOR (const MaskedArray<T> &l, const MaskedArray<T> &r)

This only makes sense if the array element type is logical valued.

MaskedLogicalArray operator && (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator || (const MaskedArray<T> &l, const Array<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is a MaskedLogicalArray.

The arrays must conform or an exception is thrown.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

MaskedLogicalArray operator && (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator || (const Array<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is a MaskedLogicalArray.

The arrays must conform or an exception is thrown.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

MaskedLogicalArray operator <= (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator < (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator >= (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator > (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator == (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator != (const MaskedArray<T> &l, const Array<T> &r)
MaskedLogicalArray operator <= (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator < (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator >= (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator > (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator == (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator != (const Array<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator <= (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator < (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator >= (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator > (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator == (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator != (const MaskedArray<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is a MaskedLogicalArray.

The arrays must conform or an exception is thrown.

Thrown Exceptions

MaskedLogicalArray operator && (const MaskedArray<T> &l, const MaskedArray<T> &r)
MaskedLogicalArray operator || (const MaskedArray<T> &l, const MaskedArray<T> &r)

This only makes sense if the array element type is logical valued.

MaskedLogicalArray operator ! (const MaskedArray<T> &marray)

Logical negation of a MaskedArray. This only makes sense if the array element type is logical valued.

Bool allLE (const MaskedArray<T> &array, const T &val)
Bool allLE (const T &val, const MaskedArray<T> &array)
Bool allLT (const MaskedArray<T> &array, const T &val)
Bool allLT (const T &val, const MaskedArray<T> &array)
Bool allGE (const MaskedArray<T> &array, const T &val)
Bool allGE (const T &val, const MaskedArray<T> &array)
Bool allGT (const MaskedArray<T> &array, const T &val)
Bool allGT (const T &val, const MaskedArray<T> &array)
Bool allEQ (const MaskedArray<T> &array, const T &val)
Bool allEQ (const T &val, const MaskedArray<T> &array)
Bool allNE (const MaskedArray<T> &array, const T &val)
Bool allNE (const T &val, const MaskedArray<T> &array)

Element by element comparisons between an array and a scalar, which behaves as if it were a conformant array filled with the value "val." The result is true only if the comparison is true for every element for which the mask of the MaskedArray is True. //

Thrown Exceptions

Bool allAND (const MaskedArray<T> &array, const T &val)
Bool allAND (const T &val, const MaskedArray<T> &array)
Bool allOR (const MaskedArray<T> &array, const T &val)
Bool allOR (const T &val, const MaskedArray<T> &array)

This only makes sense if the array element type is logical valued.

MaskedLogicalArray operator <= (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator <= (const T &val, const T<T> &array)
MaskedLogicalArray operator < (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator < (const T &val, const T<T> &array)
MaskedLogicalArray operator >= (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator >= (const T &val, const T<T> &array)
MaskedLogicalArray operator > (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator > (const T &val, const T<T> &array)
MaskedLogicalArray operator == (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator == (const T &val, const T<T> &array)
MaskedLogicalArray operator != (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator != (const T &val, const T<T> &array)

Element by element comparisons between an array and a scalar, which behaves as if it were a conformant array filled with the value "val." The result is an MaskedLogicalArray.

MaskedLogicalArray operator && (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator && (const T &val, const T<T> &array)
MaskedLogicalArray operator || (const MaskedArray<T> &array, const T &val)
MaskedLogicalArray operator || (const T &val, const T<T> &array)

This only makes sense if the array element type is logical valued.

Bool anyAND (const MaskedArray<T> &l, const Array<T> &r)
Bool anyOR (const MaskedArray<T> &l, const Array<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for some element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

Bool anyAND (const Array<T> &l, const MaskedArray<T> &r)
Bool anyOR (const Array<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for some element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

This only makes sense if the array element type is logical valued.

Bool anyLE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyLT (const MaskedArray<T> &l, const Array<T> &r)
Bool anyGE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyGT (const MaskedArray<T> &l, const Array<T> &r)
Bool anyEQ (const MaskedArray<T> &l, const Array<T> &r)
Bool anyNE (const MaskedArray<T> &l, const Array<T> &r)
Bool anyLE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyLT (const Array<T> &l, const MaskedArray<T> &r)
Bool anyGE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyGT (const Array<T> &l, const MaskedArray<T> &r)
Bool anyEQ (const Array<T> &l, const MaskedArray<T> &r)
Bool anyNE (const Array<T> &l, const MaskedArray<T> &r)
Bool anyLE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyLT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyGE (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyGT (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyEQ (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyNE (const MaskedArray<T> &l, const MaskedArray<T> &r)

Element by element comparisons between the "l" and "r" arrays. The result is true only if the comparison is true for some element of the arrays for which the mask of the MaskedArray is True. For two MaskedArrays, the "and" of the masks is used.

Thrown Exceptions

Bool anyAND (const MaskedArray<T> &l, const MaskedArray<T> &r)
Bool anyOR (const MaskedArray<T> &l, const MaskedArray<T> &r)

This only makes sense if the array element type is logical valued.

Bool anyLE (const MaskedArray<T> &array, const T &val)
Bool anyLE (const T &val, const MaskedArray<T> &array)
Bool anyLT (const MaskedArray<T> &array, const T &val)
Bool anyLT (const T &val, const MaskedArray<T> &array)
Bool anyGE (const MaskedArray<T> &array, const T &val)
Bool anyGE (const T &val, const MaskedArray<T> &array)
Bool anyGT (const MaskedArray<T> &array, const T &val)
Bool anyGT (const T &val, const MaskedArray<T> &array)
Bool anyEQ (const MaskedArray<T> &array, const T &val)
Bool anyEQ (const T &val, const MaskedArray<T> &array)
Bool anyNE (const MaskedArray<T> &array, const T &val)
Bool anyNE (const T &val, const MaskedArray<T> &array)

Element by element comparisons between an array and a scalar, which behaves as if it were a conformant array filled with the value "val." The result is true only if the comparison is true for some element for which the mask of the MaskedArray is True.

Thrown Exceptions

Bool anyAND (const MaskedArray<T> &array, const T &val)
Bool anyAND (const T &val, const MaskedArray<T> &array)
Bool anyOR (const MaskedArray<T> &array, const T &val)
Bool anyOR (const T &val, const MaskedArray<T> &array)

This only makes sense if the array element type is logical valued.