FittingProxy.h

Go to the documentation of this file.
00001 //# DittingProxy.h: This class gives object access to Fitting
00002 //# Copyright (C) 2006
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This program is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU General Public License as published by the Free
00007 //# Software Foundation; either version 2 of the License, or (at your option)
00008 //# any later version.
00009 //#
00010 //# This program 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 General Public License for
00013 //# more details.
00014 //#
00015 //# You should have received a copy of the GNU General Public License along
00016 //# with this program; if not, write to the Free Software Foundation, Inc.,
00017 //# 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$
00027 
00028 #ifndef SCIMATH_FITTINGPROXY_H
00029 #define SCIMATH_FITTINGPROXY_H
00030 
00031 //# Includes
00032 
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/Containers/Record.h>
00035 
00036 //# Forward declarations
00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00038   class String;
00039   template<class T> class GenericL2Fit;
00040   template<class T> class Vector;
00041 
00042 // <summary> This class gives Proxy to Fitting connection</summary>
00043 
00044 // <use visibility=export>
00045 
00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //   <li> <linkto module=Fitting>Fitting</linkto>
00051 // </prerequisite>
00052 
00053 // <etymology>
00054 // Distributed Object and fitting
00055 // </etymology>
00056 
00057 // <synopsis>
00058 // The class makes the connection between the
00059 // <linkto module=Fitting>Fitting</linkto> module and 
00060 // other object system. It provides a series of proxy callable
00061 // methods. See Note 197 for details. <br>
00062 // Operations supported
00063 // are all the fitting methods supported in the Fitting module
00064 // </synopsis>
00065 
00066 // <example>
00067 // </example>
00068 
00069 // <motivation>
00070 // To provide a direct user interface between the user and 
00071 // <linkto module=Fitting>Fitting</linkto> related calculations.
00072 // </motivation>
00073 
00074 // <todo asof="2004/08/30">
00075 //  <li> Nothing I know of
00076 // </todo>
00077 
00078 class FittingProxy  {
00079 
00080 public:
00081   //# Standard constructors/destructors
00082   FittingProxy();
00083   virtual ~FittingProxy();
00084 
00085   Int getid();
00086   Record getstate(Int id);
00087   Bool init(Int id, Int n, Int tp, Double colfac, Double lmfac);
00088   Bool done(Int id);
00089   Bool reset(Int id);
00090   Bool set(Int id, Int nin, Int tpin, Double colfac, Double lmfac);
00091   Record functional(Int id, const Record& fnc, 
00092                     const Vector<Double>& xval,
00093                     const Vector<Double>& yval, 
00094                     const Vector<Double>& wt,
00095                     Int mxit, const Record& constraint);
00096   Record linear(Int id, const Record& fnc, 
00097                 const Vector<Double>& xval,
00098                 const Vector<Double>& yval, 
00099                 const Vector<Double>& wt,
00100                 const Record& constraint);
00101   Record cxfunctional(Int id, const Record& fnc, 
00102                       const Vector<DComplex>& xval,
00103                       const Vector<DComplex>& yval, 
00104                       const Vector<DComplex>& wt,
00105                       Int mxit, const Record& constraint);
00106   Record cxlinear(Int id, const Record& fnc, 
00107                   const Vector<DComplex>& xval,
00108                   const Vector<DComplex>& yval, 
00109                   const Vector<DComplex>& wt,
00110                   const Record& constraint);
00111   
00112 private:
00113   // Class to aid in distributing different fitters
00114   class FitType {
00115   public:
00116     //# Constructors
00117     // Default constructor: no method known
00118     FitType();
00119     // Destructor
00120     ~FitType();
00121     //# Method
00122     // Set a fitter pointer (real or complex)
00123     // <group>
00124     void setFitter   (GenericL2Fit<Double> *ptr);
00125     void setFitterCX (GenericL2Fit<DComplex> *ptr);
00126     // </group>
00127     // Get a fitter pointer (real or complex)
00128     // <group>
00129     GenericL2Fit<Double>   *const &getFitter() const;
00130     GenericL2Fit<DComplex> *const &getFitterCX() const;
00131     // </group>
00132     // Set the status
00133     void setStatus(Int n, Int typ, Double colfac, Double lmfac);
00134     // Get the number of terms in condition equation
00135     Int getNceq() const { return nceq_p;} ;
00136     // Get the number of unknowns
00137     Int getN() const { return n_p;} ;
00138     // Get the number of real unknowns
00139     Int getNreal() const { return nreal_p;} ;
00140     // Get the type
00141     Int getType() const { return typ_p;} ;
00142     // Get the collinearity factor
00143     Double getColfac() const { return colfac_p;} ;
00144     // Get the Levenberg-Marquardt factor
00145     Double getLMfac() const { return lmfac_p;} ;
00146     // Set solution done or not
00147     void setSolved(Bool solved);
00148     // Solution done?
00149     Bool getSolved() const { return soldone_p;} ;
00150   private:
00151     // Copy constructor: not implemented
00152     FitType(const FitType &other); 
00153     // Assignment: not implemented
00154     FitType &operator=(const FitType &other);
00155     //# Data
00156     // Pointer to a Fitting Machine: real or complex
00157     // <group>
00158     casacore::GenericL2Fit<Double> *fitter_p;
00159     casacore::GenericL2Fit<DComplex> *fitterCX_p;
00160     // </group>
00161     // Number of unknowns
00162     Int n_p;
00163     // Number of terms in condition equation
00164     Int nceq_p;
00165     // Number of real unknowns
00166     Int nreal_p;
00167     // Type
00168     Int typ_p;
00169     // Collinearity factor
00170     Double colfac_p;
00171     // Levenberg-Marquardt factor
00172     Double lmfac_p;
00173     // Solution done?
00174     Bool soldone_p;
00175     // System's rank deficiency
00176     uInt nr_p;
00177   };
00178   //# Member functions
00179   //# Data
00180   // Number of FitType obkects present
00181   uInt nFitter_p;
00182   // List of FitTypes
00183   FitType **list_p;
00184 };
00185 
00186 } //# NAMESPACE CASACORE - END
00187 
00188 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1