LELBinary.h

Classes

LELBinary -- This LEL class handles numerical binary operators (full description)
LELBinaryCmp -- This LEL class handles relational binary numerical operators (full description)
LELBinaryBool -- This LEL class handles logical binary operators (full description)

template <class T> class LELBinary : public LELInterface<T>

Interface

Public Members
LELBinary(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<T> >& pLeftExpr, const CountedPtr<LELInterface<T> >& pRightExpr)
~LELBinary()
virtual void eval (LELArray<T>& result, const Slicer& section) const
virtual LELScalar<T> getScalar() const
virtual Bool prepareScalarExpr()
virtual String className() const
virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This derived LEL letter class handles numerical binary operators

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply numerical binary operators to Lattice expressions. They operate on numerical Lattice (Float,Double,Complex,DComplex) expressions and return the same numerical type. The available C++ operators are +,-,*,/ with equivalents in the enum of ADD, SUBTRACT, MULTIPLY, and DIVIDE.

A description of the implementation details of the LEL classes can be found in Note 216

Example

Examples are not very useful as the user would never use these classes directly. Look in LatticeExprNode.cc to see how it invokes these classes. Examples of how the user would indirectly use this class (through the envelope) are:
    IPosition shape(2,5,10);
    ArrayLattice<Float> x(shape); x.set(1.0);
    ArrayLattice<Float> y(shape); y.set(2.0);
    ArrayLattice<Float> z(shape); 
    z.copyData(x+y);                 // z = x + y;
    z.copyData(x-y);                 // z = x - y;
    z.copyData(x*y);                 // z = x * y;
    z.copyData(x/y);                 // z = x / y;
    

Motivation

Numerical binary operations are a basic mathematical expression.

To Do

Member Description

LELBinary(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<T> >& pLeftExpr, const CountedPtr<LELInterface<T> >& pRightExpr)

Constructor takes operation and left and right expressions to be operated upon

~LELBinary()

Destructor

virtual void eval (LELArray<T>& result, const Slicer& section) const

Recursively evaluate the expression

virtual LELScalar<T> getScalar() const

Recursively efvaluate the scalar expression

virtual Bool prepareScalarExpr()

Do further preparations (e.g. optimization) on the expression.

virtual String className() const

Get class name

virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Handle locking/syncing of a lattice in a lattice expression.


template<class T> class LELBinaryCmp : public LELInterface<Bool>

Interface

LELBinaryCmp(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<T> >& pLeftExpr, const CountedPtr<LELInterface<T> >& pRightExpr)
~LELBinaryCmp()
virtual void eval (LELArray<Bool>& result, const Slicer& section) const
virtual LELScalar<Bool> getScalar() const
virtual Bool prepareScalarExpr()
virtual String className() const
virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This derived LEL letter class handles relational numerical binary operators

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply relational numerical binary operators to Lattice expressions. They operate on numerical (Float,Double,Complex,DComplex) Lattice expressions and result in a Bool. The available C++ operators are ==,!=>,>=,<,<=, with equivalents in the enum of EQ, NE, GT, GE, LT, and LE

A description of the implementation details of the LEL classes can be found in Note 216

Example

Examples are not very useful as the user would never use these classes directly. Look in LatticeExprNode.cc to see how it invokes these classes. Examples of how the user would indirectly use this class (through the envelope) are:
    IPosition shape(2,5,10);
    ArrayLattice<Float> x(shape); x.set(1.0);
    ArrayLattice<Float> y(shape); y.set(2.0);
    ArrayLattice<Bool> z(shape); 
    z.copyData(x==y);                // z = x == y;
    z.copyData(x!=y);                // z = x != y;
    z.copyData(x>y);                 // z = x > y;
    z.copyData(x>=y);                // z = x >= y;
    z.copyData(x<y);                 // z = x < y;
    z.copyData(x<=y);                // z = x <= y;
    

Motivation

Numerical relational binary operations are a basic mathematical expression.

To Do

Member Description

LELBinaryCmp(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<T> >& pLeftExpr, const CountedPtr<LELInterface<T> >& pRightExpr)

Constructor takes operation and left and right expressions to be operated upon. It can only handle the comparison operators.

~LELBinaryCmp()

Destructor

virtual void eval (LELArray<Bool>& result, const Slicer& section) const

Recursively evaluate the expression

virtual LELScalar<Bool> getScalar() const

Recursively evaluate the scalar expression

virtual Bool prepareScalarExpr()

Do further preparations (e.g. optimization) on the expression.

virtual String className() const

Get class name

virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Handle locking/syncing of a lattice in a lattice expression.


class LELBinaryBool : public LELInterface<Bool>

Interface

LELBinaryBool(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<Bool> >& pLeftExpr, const CountedPtr<LELInterface<Bool> >& pRightExpr)
~LELBinaryBool()
virtual void eval (LELArray<Bool>& result, const Slicer& section) const
virtual LELScalar<Bool> getScalar() const
virtual Bool prepareScalarExpr()
virtual String className() const
virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This derived LEL letter class handles logical binary operators

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply logical binary operators to Lattice expressions. They apply only to Bool Lattice expressions and result in a Bool. The available C++ operators are &&,||,==,!= with equivalents in the enum of AND, OR, EQ, and NE

A description of the implementation details of the LEL classes can be found in Note 216

Example

Examples are not very useful as the user would never use these classes directly. Look in LatticeExprNode.cc to see how it invokes these classes. Examples of how the user would indirectly use this class (through the envelope) are:
    IPosition shape(2,5,10);
    ArrayLattice<Bool> x(shape); x.set(False);
    ArrayLattice<Bool> y(shape); y.set(True);
    ArrayLattice<Bool> z(shape); z.set(False);
    z.copyData(x&&y);                // z = x && y;
    z.copyData(x||y);                // z = x || y;
    z.copyData(x==y);                // z = x == y;
    z.copyData(x!=y);                // z = x != y;
    

Motivation

Logical binary operations are a basic mathematical expression.

To Do

Member Description

LELBinaryBool(const LELBinaryEnums::Operation op, const CountedPtr<LELInterface<Bool> >& pLeftExpr, const CountedPtr<LELInterface<Bool> >& pRightExpr)

Constructor takes operation and left and right expressions to be operated upon.

~LELBinaryBool()

Destructor

virtual void eval (LELArray<Bool>& result, const Slicer& section) const

Recursively evaluate the expression

virtual LELScalar<Bool> getScalar() const

Recursively evaluate the scalar expression

virtual Bool prepareScalarExpr()

Do further preparations (e.g. optimization) on the expression.

virtual String className() const

Get class name

virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()

Handle locking/syncing of a lattice in a lattice expression.