LELFunction.h

Classes

LELFunction1D -- This LEL class handles numerical (real and complex) 1-argument functions (full description)
LELFunctionReal1D -- This LEL class handles numerical (real only) 1-argument functions (full description)
LELFunctionND -- This LEL class handles functions with a variable number of arguments. (full description)
LELFunctionFloat -- This LEL class handles numerical functions whose return type is a Float (full description)
LELFunctionDouble -- This LEL class handles numerical functions whose return type is a Double (full description)
LELFunctionComplex -- This LEL class handles complex numerical functions (full description)
LELFunctionDComplex -- This LEL class handles double complex numerical functions (full description)
LELFunctionBool -- This LEL class handles logical functions (full description)

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

Interface

Public Members
LELFunction1D(const LELFunctionEnums::Function function, const CountedPtr<LELInterface<T> >& expr)
~LELFunction1D()
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 (real and complex) 1-argument functions

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply numerical 1-argument functions to Lattice expressions. They operate on numerical (Float,Double,Complex,DComplex) Lattice expressions and return the same type. The available C++ functions are sin,sinh,cos,cosh,exp,log,log10,sqrt,min,max,mean,sum with equivalents in the enum of SIN,SINH,COS,COSH,EXP,LOG,LOG10,SQRT,MIN1D,MAX1D, MEAN1D, and SUM.

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<Complex> x(shape); x.set(1.0);
    ArrayLattice<Complex> y(shape); 
    y.copyData(sin(x));                 // y = sin(x)
    y.copyData(min(x));                 // y = min(x)
    
Note that the min function returns a scalar, and the output Lattice is filled with that one value.

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunction1D(const LELFunctionEnums::Function function, const CountedPtr<LELInterface<T> >& expr)

Constructor takes operation and expression to be operated upon

~LELFunction1D()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<T> 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.


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

Interface

LELFunctionReal1D(const LELFunctionEnums::Function function, const CountedPtr<LELInterface<T> >& expr)
~LELFunctionReal1D()
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 (real only) 1-argument functions

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply numerical (real only) 1-argument functions to Lattice expressions. They operate on Float and Double numerical Lattice expressions and return the same type. The available C++ functions are asin,acos,tan,tanh,ceil,floor with equivalents in the enum of ASIN, ACOS, TAN, TANH, CEIL, and FLOOR.

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(0.05);
    ArrayLattice<Float> y(shape); 
    y.copyData(asin(x));                 // y = asin(x)
    y.copyData(tan(x));                  // y = tan(x)
    
Note that the min function returns a scalar, and the output Lattice is filled with that one value.

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionReal1D(const LELFunctionEnums::Function function, const CountedPtr<LELInterface<T> >& expr)

Constructor takes operation and expression to be operated upon

~LELFunctionReal1D()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<T> 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.


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

Interface

LELFunctionND(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionND()
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 functions (arbitrary number of arguments) which return any data type

Synopsis

This templated LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply functions of arbitrary number of arguments to Lattice expressions. They operate lattices with any type and return the same type. The available C++ function is iif with equivalents in the enum of IIF.

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<Complex> w(shape); w.set(Complex(2.0,3.0));
    ArrayLattice<Float> x(shape); x.set(0.05);
    ArrayLattice<Float> y(shape); y.set(2.0);
    ArrayLattice<Float> z(shape); y.set(2.0);
    
    z.copyData(iif(x==0, y, x));
    
    
Copy x to z, but where x==0, take the correpsonding element from y. b

Motivation

An "if-then-else" like construction is very useful.

To Do

Member Description

LELFunctionND(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

Constructor takes operation and expressions to be operated upon

~LELFunctionND()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<T> 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 LELFunctionFloat : public LELInterface<Float>

Interface

LELFunctionFloat(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionFloat()
virtual void eval (LELArray<Float>& result, const Slicer& section) const
virtual LELScalar<Float> 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 functions (arbitrary number of arguments) which return a Float

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply numerical functions of arbitrary number of arguments (but only 1 or 2 arguments currently implemented) to Lattice expressions. They operate on Float or Complex Lattices and return a Float. The available C++ functions are min,max,pow,atan2,fmod,abs,arg,real,imag with equivalents in the enum of MIN,MAX,POW,ATAN2,FMOD,ABS,ARG,REAL, and IMAG.

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<Complex> w(shape); w.set(Complex(2.0,3.0));
    ArrayLattice<Float> x(shape); x.set(0.05);
    ArrayLattice<Float> y(shape); y.set(2.0);
    ArrayLattice<Float> z(shape); y.set(2.0);
    
    z.copyData(min(x,y));                // z = min(x,y)
    z.copyData(imag(w));                 // z = imag(w)
    
    
Note that this min function takes two arguments and returns the minimum of the two, pixel by pixel (i.e. it does not return one scalar from the whole Lattice) b

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionFloat(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

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

~LELFunctionFloat()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<Float> 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 LELFunctionDouble : public LELInterface<Double>

Interface

LELFunctionDouble(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionDouble()
virtual void eval (LELArray<Double>& result, const Slicer& section) const
virtual LELScalar<Double> 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()
Private Members
uInt nMaskedElements (const LatticeExprNode&) const
uInt nMaskedOn (const Array<Bool>& mask) const

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This derived LEL letter class handles numerical functions (arbitrary number of arguments) which return a Double

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply numerical functions of arbitrary number of arguments (but only 1 or 2 arguments currently implemented) to Lattice expressions. They operate on Double or DComplex Lattices and return a Double. The available C++ functions are min,max,pow,atan2,fmod,abs,arg,real,imag with equivalents in the enum of MIN,MAX,POW,ATAN2,FMOD,ABS,ARG,REAL, and IMAG.

There are also two other functions for which the input Lattice expression type must be a Bool. These are ntrue,nfalse with equivalents in the enum of NTRUE and NFALSE.

There is a further function for which the input Lattice expression type can be anything. This is nelements with equivalent in the enum of NELEM.

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> v(shape); v.set(True);
    ArrayLattice<DComplex> w(shape); w.set(DComplex(2.0,3.0));
    ArrayLattice<Double> x(shape); x.set(0.05);
    ArrayLattice<Double> y(shape); y.set(2.0);
    ArrayLattice<Double> z(shape); y.set(2.0);
    
    z.copyData(min(x,y));                // z = min(x,y)
    z.copyData(imag(w));                 // z = imag(w)
    z.copyData(nelements(v));            // z = nelements(v)
    z.copyData(ntrue(v));                // z = ntrue(v)
    

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionDouble(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

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

~LELFunctionDouble()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<Double> 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.

uInt nMaskedElements (const LatticeExprNode&) const
uInt nMaskedOn (const Array<Bool>& mask) const

Count number of masked elements in a LatticeExprNode.

class LELFunctionComplex : public LELInterface<Complex>

Interface

Public Members
LELFunctionComplex(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionComplex()
virtual void eval (LELArray<Complex>& result, const Slicer& section) const
virtual LELScalar<Complex> 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 complex numerical functions (arbitrary number of arguments)

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply complex numerical functions of arbitrary number of arguments (but only 1 or 2 arguments currently implemented) to Lattice expressions. They operate on Complex Lattice expressions only and return a Complex. The available C++ functions are pow,conj with equivalents in the enum of POW and CONJ.

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<Complex> x(shape); x.set(Complex(2.0,3.0));
    ArrayLattice<Complex> y(shape); 
    y.copyData(conj(x));                // y = conj(x)
    

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionComplex(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

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

~LELFunctionComplex()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<Complex> 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 LELFunctionDComplex : public LELInterface<DComplex>

Interface

LELFunctionDComplex(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionDComplex()
virtual void eval (LELArray<DComplex>& result, const Slicer& section) const
virtual LELScalar<DComplex> 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 double complex numerical functions (arbitrary number of arguments)

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply double complex numerical functions of arbitrary number of arguments (but only 1 or 2 arguments currently implemented) to Lattice expressions. They operate on DComplex Lattice expressions only and return a DComplex. The available C++ functions are pow,conj with equivalents in the enum of POW and CONJ.

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<DComplex> x(shape); x.set(DComplex(2.0,3.0));
    ArrayLattice<DComplex> y(shape); 
    y.copyData(conj(x));                // y = conj(x)
    

Motivation

Numerical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionDComplex(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

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

~LELFunctionDComplex()

Destructor

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

Recursively evaluate the expression

virtual LELScalar<DComplex> 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 LELFunctionBool : public LELInterface<Bool>

Interface

LELFunctionBool(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)
~LELFunctionBool()
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 functions (arbitrary number of arguments)

Synopsis

This LEL letter class is derived from LELInterface. It is used to construct LEL objects that apply logical functions of arbitrary number of arguments (but only 1 or 2 arguments currently implemented) to Lattice expressions. They operate on Bool Lattice expressions only and return a Bool. The available C++ functions are all,any with equivalents in the enum of ALL and ANY.

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(True);
    ArrayLattice<Bool> y(shape); 
    y.copyData(any(x));                // y = any(x)
    
The result of the any function (were any of the values True) is a Bool scalar. So the output Lattice is filled with that one value.

Motivation

Logical functions are a basic mathematical expression.

To Do

Member Description

LELFunctionBool(const LELFunctionEnums::Function function, const Block<LatticeExprNode>& expr)

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

~LELFunctionBool()

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.