casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Function1D.h
Go to the documentation of this file.
00001 //# Function1D.h: Numerical functional interface class for 1 dimension
00002 //# Copyright (C) 2001,2002,2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: Function1D.h 21024 2011-03-01 11:46:18Z gervandiepen $
00027 
00028 #ifndef SCIMATH_FUNCTION1D_H
00029 #define SCIMATH_FUNCTION1D_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <scimath/Functionals/Function.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward declarations
00038 
00039 // <summary> Numerical functional interface class for 1 dimension
00040 // </summary>
00041 
00042 // <use visibility=export>
00043 
00044 // <reviewed reviewer="tcornwel" date="1996/02/22" tests="tGaussian1D"
00045 //       demos="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> <linkto class="Function">Function</linkto>
00050 // </prerequisite>
00051 //
00052 // <synopsis>
00053 // A <src>Function1D</src> is used for classes which map a
00054 // scalar or n-dimensional Vector of type <src>T</src> into a <src>T</src>.
00055 // The object also has one parameter which can be masked
00056 // if necessary, and be used in the <src>Fitting</src> module, and, implicitly,
00057 // in the <linkto class=AutoDiff>AutoDiff</linkto> differentiation module.
00058 //
00059 // The only method implemented in <src>Function1D</src> is the
00060 // <src>ndim()</src> method. The rest is inhereted from
00061 // <linkto class="Function">Function</linkto>.
00062 // </synopsis>
00063 
00064 // <example>
00065 // See <linkto class=Function>Function</linkto>.
00066 // </example>
00067 //
00068 // <templating arg=T>
00069 //    <li> Besides the requirements set by the
00070 //    <linkto class="Functional">Functional</linkto> base class, it must be
00071 //    possible to form a <src>Vector<T></src>.
00072 // </templating>
00073 
00074 
00075 template<class T, class U=T> class Function1D : public Function<T,U> {
00076   public:
00077   //# Typedefs
00078   typedef const T* FunctionArg;
00079   
00080   //# Constructors
00081   // Constructors
00082   // <group>
00083   Function1D() : Function<T,U>() {}
00084   explicit Function1D(const uInt n) : Function<T,U>(n) {}
00085   explicit Function1D(const Vector<T> &in) : Function<T,U>(in) {}
00086   Function1D(const FunctionParam<T> &other) : Function<T,U>(other) {}
00087   Function1D(const Function1D<T,U> &other) : Function<T,U>(other) {}
00088   template <class W, class X>
00089   Function1D(const Function1D<W,X> &other) : Function<T,U>(other) {}
00090   // </group>
00091 
00092   // Destructor
00093   virtual ~Function1D() {}
00094   
00095   // Returns the number of dimensions of function
00096   virtual uInt ndim() const { return 1; }
00097 
00098   //# Make members of parent classes known.
00099 protected:
00100   using Function<T,U>::param_p;
00101 public:
00102   using Function<T,U>::nparameters;
00103   using Function<T,U>::setMode;
00104 };
00105 
00106 
00107 } //# NAMESPACE CASA - END
00108 
00109 #endif