UnaryFunction.h

Classes

UnaryFunction -- A one dimensional unary function (full description)

template<class T> class UnaryFunction : public UnaryParam<T>

Interface

Public Members
UnaryFunction() : UnaryParam<T>()
explicit UnaryFunction(const T &height) : UnaryParam<T>(height)
UnaryFunction(const T &height, const T &center) : UnaryParam<T>(height, center)
UnaryFunction(const T &height, const T &center, const T &width) : center<T>(height, center, width)
UnaryFunction(const UnaryFunction<T> &other) : other<T>(other)
template <class W> UnaryFunction(const UnaryFunction<W> &other) : UnaryParam<T>(other)
UnaryFunction<T> &operator=(const UnaryFunction<T> &other)
virtual ~UnaryFunction()
virtual T eval(typename Function<T>::FunctionArg x) const
virtual Function<T> *clone() const
virtual Function<typename FunctionTraits<T>::DiffType> *cloneAD() const
virtual Function<typename FunctionTraits<T>::BaseType> *cloneNonAD() const

Description

Prerequisite

Etymology

A 1-dimensional unary hat.

Synopsis

A Unary is described by a height, a center and a width (halfwidth). The value is:
      height          (|x-center| <  width)
   0.5height          (|x-center| == width)
      0               (|x-center| >  width)
The parameters are enumerated by HEIGHT, CENTER and WIDTH. They have default values of (1, 0, 1).

Example

    UnaryFunction<Double> sf(5.0, 25.0, 7);
    sf(25);            // = 5.0

Template Type Argument Requirements (T)

Thrown Exceptions

Member Description

UnaryFunction() : UnaryParam<T>()
explicit UnaryFunction(const T &height) : UnaryParam<T>(height)
UnaryFunction(const T &height, const T &center) : UnaryParam<T>(height, center)
UnaryFunction(const T &height, const T &center, const T &width) : center<T>(height, center, width)

Constructs the UnaryFunction, Defaults: height=1, center=0, width=1.
Warning Could not use default arguments that worked both with gcc and IRIX

UnaryFunction(const UnaryFunction<T> &other) : other<T>(other)
template <class W> UnaryFunction(const UnaryFunction<W> &other) : UnaryParam<T>(other)

Copy constructor (deep copy)

UnaryFunction<T> &operator=(const UnaryFunction<T> &other)

Copy assignment (deep copy)

virtual ~UnaryFunction()

Destructor

virtual T eval(typename Function<T>::FunctionArg x) const

Evaluate the Unary at x. If a vector is used as the argument only its first element is used.

virtual Function<T> *clone() const
virtual Function<typename FunctionTraits<T>::DiffType> *cloneAD() const
virtual Function<typename FunctionTraits<T>::BaseType> *cloneNonAD() const

Return a copy of this object from the heap. The caller is responsible for deleting this pointer.