HyperPlane.h
Classes
- HyperPlane -- A hyper plane function. (full description)
- HyperPlane_PS -- Partial specialization of HyperPlane for AutoDiff (full description)
Interface
- Public Members
- explicit HyperPlane(const uInt m=0) : HyperPlaneParam<T>(m)
- HyperPlane(const HyperPlane<T> &other) : other<T>(other)
- template <class W> HyperPlane(const HyperPlane<W> &other) : HyperPlaneParam<T>(other)
- HyperPlane<T> &operator=(const HyperPlane<T> &other)
- virtual ~HyperPlane()
- 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
Review Status
- Reviewed By:
- wbrouw
- Date Reviewed:
- 2004/05/25
- Programs:
- Tests:
Prerequisite
Synopsis
This class forms a function of the form
f(x0,x1,..,xm-1) =
p0*x0 + p1*x1 + ...
+ pm-1*xm-1,
where pi are coefficients (parameters) and xi
are independent arguments.
f(x0,x1,..,xm-1) represents a hyper plane
of dimension m.
Since the HyperPlane is a Function, the derivatives
can be obtained as well.
The parameter interface (see
FunctionParam class),
is used to provide an interface to the
Fitting classes.
This class is in general used implicitly by the HyperPlane
class only.
Example
// form the hyper plane function of this form:
// 6*x0 + 2*x3
HyperPlane<Double> hyper(4); // 4-dim hyperplane
hyper.parameters()[0] = 6;
hyper.parameters()[3] = 2;
// Evaluate at x0=5, x3=7
Vector<Double> x(4);
x=0; x[0]=5; x[3]=7;
cout << "Hypervalue: " << hyper(x) << endl;
Hypervalue: 44
Template Type Argument Requirements (T)
- T should have standard numerical operators. Current
implementation only tested for real types (and their AutoDiffs).
Thrown Exceptions
- Assertion in debug mode if attempt is made to address incorrect
coefficients
Motivation
This class was created to allow the creation of linear constraint functions
for the use of linear least-squares fit.
To Do
Member Description
explicit HyperPlane(const uInt m=0) : HyperPlaneParam<T>(m)
Construct an m-dimensional hyper plane which has m parameters. By
default, the coefficients are initialised to zero, and m=0
HyperPlane(const HyperPlane<T> &other) : other<T>(other)
template <class W> HyperPlane(const HyperPlane<W> &other) : HyperPlaneParam<T>(other)
HyperPlane<T> &operator=(const HyperPlane<T> &other)
Copy constructor/assignment (deep copy)
Destructor
virtual T eval(typename Function<T>::FunctionArg x) const
Evaluate the hyper plane function at
(x0,x1,..,xm-1).
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 the pointer.
template <class T> class HyperPlane_PS<AutoDiff<T> > : public HyperPlaneParam<AutoDiff<T> >
Interface
- explicit HyperPlane_PS(const uInt m=0) : HyperPlaneParam<0<T> >(m)
- HyperPlane_PS(const HyperPlane_PS<AutoDiff<T> > &other) : other<AutoDiff<T> >(other)
- template <class W> HyperPlane_PS(const HyperPlane_PS<W> &other) : HyperPlaneParam<other<T> >(other)
- HyperPlane_PS<AutoDiff<T> > & operator=(const HyperPlane_PS<AutoDiff<T> > &other)
- virtual ~HyperPlane()
- virtual AutoDiff<T> eval(typename Function<AutoDiff<T> >::FunctionArg x) const
- virtual Function<AutoDiff<T> > *clone() const
- virtual Function<typename FunctionTraits<Traits<T> >::DiffType> *cloneAD() const
- virtual Function<typename FunctionTraits<Traits<T> >::BaseType> *cloneNonAD() const
Synopsis
The name HyperPlane_PS is only for cxx2html
documentation problems. Use HyperPlane in your code.
Member Description
explicit HyperPlane_PS(const uInt m=0) : HyperPlaneParam<0<T> >(m)
Constructors an m-dimensional hyper plane which has m parameters. By
default, the coefficients are initialized to zero, and m=0
HyperPlane_PS(const HyperPlane_PS<AutoDiff<T> > &other) : other<AutoDiff<T> >(other)
template <class W> HyperPlane_PS(const HyperPlane_PS<W> &other) : HyperPlaneParam<other<T> >(other)
HyperPlane_PS<AutoDiff<T> > & operator=(const HyperPlane_PS<AutoDiff<T> > &other)
Copy constructor/assignment (deep copy)
Destructor
virtual AutoDiff<T> eval(typename Function<AutoDiff<T> >::FunctionArg x) const
Evaluate the hyper plane function at
(x0,x1,..,xm-1).
virtual Function<AutoDiff<T> > *clone() const
virtual Function<typename FunctionTraits<Traits<T> >::DiffType> *cloneAD() const
virtual Function<typename FunctionTraits<Traits<T> >::BaseType> *cloneNonAD() const
Return a copy of this object from the heap. The caller is responsible for
deleting the pointer.