casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FittingProxy.h
Go to the documentation of this file.
1 //# DittingProxy.h: This class gives object access to Fitting
2 //# Copyright (C) 2006
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This program is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU General Public License as published by the Free
7 //# Software Foundation; either version 2 of the License, or (at your option)
8 //# any later version.
9 //#
10 //# This program is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 //# more details.
14 //#
15 //# You should have received a copy of the GNU General Public License along
16 //# with this program; if not, write to the Free Software Foundation, Inc.,
17 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef SCIMATH_FITTINGPROXY_H
29 #define SCIMATH_FITTINGPROXY_H
30 
31 //# Includes
32 
33 #include <casacore/casa/aips.h>
36 
37 //# Forward declarations
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39  class String;
40  template<class T> class GenericL2Fit;
41 
42 // <summary> This class gives Proxy to Fitting connection</summary>
43 
44 // <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto module=Fitting>Fitting</linkto>
51 // </prerequisite>
52 
53 // <etymology>
54 // Distributed Object and fitting
55 // </etymology>
56 
57 // <synopsis>
58 // The class makes the connection between the
59 // <linkto module=Fitting>Fitting</linkto> module and
60 // other object system. It provides a series of proxy callable
61 // methods. See Note 197 for details. <br>
62 // Operations supported
63 // are all the fitting methods supported in the Fitting module
64 // </synopsis>
65 
66 // <example>
67 // </example>
68 
69 // <motivation>
70 // To provide a direct user interface between the user and
71 // <linkto module=Fitting>Fitting</linkto> related calculations.
72 // </motivation>
73 
74 // <todo asof="2004/08/30">
75 // <li> Nothing I know of
76 // </todo>
77 
78 class FittingProxy {
79 
80 public:
81  //# Standard constructors/destructors
82  FittingProxy();
83  virtual ~FittingProxy();
84 
85  Int getid();
86  Record getstate(Int id);
87  Bool init(Int id, Int n, Int tp, Double colfac, Double lmfac);
88  Bool done(Int id);
89  Bool reset(Int id);
90  Bool set(Int id, Int nin, Int tpin, Double colfac, Double lmfac);
91  Record functional(Int id, const Record& fnc,
92  const Vector<Double>& xval,
93  const Vector<Double>& yval,
94  const Vector<Double>& wt,
95  Int mxit, const Record& constraint);
96  Record linear(Int id, const Record& fnc,
97  const Vector<Double>& xval,
98  const Vector<Double>& yval,
99  const Vector<Double>& wt,
100  const Record& constraint);
101  Record cxfunctional(Int id, const Record& fnc,
102  const Vector<DComplex>& xval,
103  const Vector<DComplex>& yval,
104  const Vector<DComplex>& wt,
105  Int mxit, const Record& constraint);
106  Record cxlinear(Int id, const Record& fnc,
107  const Vector<DComplex>& xval,
108  const Vector<DComplex>& yval,
109  const Vector<DComplex>& wt,
110  const Record& constraint);
111 
112 private:
113  // Class to aid in distributing different fitters
114  class FitType {
115  public:
116  //# Constructors
117  // Default constructor: no method known
118  FitType();
119  // Destructor
120  ~FitType();
121  //# Method
122  // Set a fitter pointer (real or complex)
123  // <group>
124  void setFitter (GenericL2Fit<Double> *ptr);
126  // </group>
127  // Get a fitter pointer (real or complex)
128  // <group>
129  GenericL2Fit<Double> *const &getFitter() const;
130  GenericL2Fit<DComplex> *const &getFitterCX() const;
131  // </group>
132  // Set the status
133  void setStatus(Int n, Int typ, Double colfac, Double lmfac);
134  // Get the number of terms in condition equation
135  Int getNceq() const { return nceq_p;} ;
136  // Get the number of unknowns
137  Int getN() const { return n_p;} ;
138  // Get the number of real unknowns
139  Int getNreal() const { return nreal_p;} ;
140  // Get the type
141  Int getType() const { return typ_p;} ;
142  // Get the collinearity factor
143  Double getColfac() const { return colfac_p;} ;
144  // Get the Levenberg-Marquardt factor
145  Double getLMfac() const { return lmfac_p;} ;
146  // Set solution done or not
147  void setSolved(Bool solved);
148  // Solution done?
149  Bool getSolved() const { return soldone_p;} ;
150  private:
151  // Copy constructor: not implemented
152  FitType(const FitType &other);
153  // Assignment: not implemented
154  FitType &operator=(const FitType &other);
155  //# Data
156  // Pointer to a Fitting Machine: real or complex
157  // <group>
160  // </group>
161  // Number of unknowns
163  // Number of terms in condition equation
165  // Number of real unknowns
167  // Type
169  // Collinearity factor
171  // Levenberg-Marquardt factor
173  // Solution done?
175  // System's rank deficiency
177  };
178  //# Member functions
179  //# Data
180  // Number of FitType obkects present
182  // List of FitTypes
184 };
185 
186 } //# NAMESPACE CASACORE - END
187 
188 #endif
int Int
Definition: aipstype.h:50
uInt nr_p
System&#39;s rank deficiency.
Definition: FittingProxy.h:176
casacore::GenericL2Fit< Double > * fitter_p
Pointer to a Fitting Machine: real or complex.
Definition: FittingProxy.h:158
Int nreal_p
Number of real unknowns.
Definition: FittingProxy.h:166
void setSolved(Bool solved)
Set solution done or not.
Int getNreal() const
Get the number of real unknowns.
Definition: FittingProxy.h:139
Record linear(Int id, const Record &fnc, const Vector< Double > &xval, const Vector< Double > &yval, const Vector< Double > &wt, const Record &constraint)
Int getN() const
Get the number of unknowns.
Definition: FittingProxy.h:137
Int getType() const
Get the type.
Definition: FittingProxy.h:141
Int nceq_p
Number of terms in condition equation.
Definition: FittingProxy.h:164
Bool getSolved() const
Solution done?
Definition: FittingProxy.h:149
Double getColfac() const
Get the collinearity factor.
Definition: FittingProxy.h:143
Double colfac_p
Collinearity factor.
Definition: FittingProxy.h:170
GenericL2Fit< DComplex > *const & getFitterCX() const
void setFitter(GenericL2Fit< Double > *ptr)
Set a fitter pointer (real or complex)
GenericL2Fit< Double > *const & getFitter() const
Get a fitter pointer (real or complex)
FitType & operator=(const FitType &other)
Assignment: not implemented.
double Double
Definition: aipstype.h:55
Double lmfac_p
Levenberg-Marquardt factor.
Definition: FittingProxy.h:172
Generic base class for least-squares fit.
Definition: FittingProxy.h:40
Bool set(Int id, Int nin, Int tpin, Double colfac, Double lmfac)
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Class to aid in distributing different fitters.
Definition: FittingProxy.h:114
void setFitterCX(GenericL2Fit< DComplex > *ptr)
casacore::GenericL2Fit< DComplex > * fitterCX_p
Definition: FittingProxy.h:159
FitType ** list_p
List of FitTypes.
Definition: FittingProxy.h:183
Record getstate(Int id)
Record cxfunctional(Int id, const Record &fnc, const Vector< DComplex > &xval, const Vector< DComplex > &yval, const Vector< DComplex > &wt, Int mxit, const Record &constraint)
uInt nFitter_p
Number of FitType obkects present.
Definition: FittingProxy.h:181
Bool soldone_p
Solution done?
Definition: FittingProxy.h:174
This class gives Proxy to Fitting connection.
Definition: FittingProxy.h:78
void setStatus(Int n, Int typ, Double colfac, Double lmfac)
Set the status.
FitType()
Default constructor: no method known.
Record functional(Int id, const Record &fnc, const Vector< Double > &xval, const Vector< Double > &yval, const Vector< Double > &wt, Int mxit, const Record &constraint)
Record cxlinear(Int id, const Record &fnc, const Vector< DComplex > &xval, const Vector< DComplex > &yval, const Vector< DComplex > &wt, const Record &constraint)
Int getNceq() const
Get the number of terms in condition equation.
Definition: FittingProxy.h:135
Double getLMfac() const
Get the Levenberg-Marquardt factor.
Definition: FittingProxy.h:145
unsigned int uInt
Definition: aipstype.h:51
Bool init(Int id, Int n, Int tp, Double colfac, Double lmfac)
Int n_p
Number of unknowns.
Definition: FittingProxy.h:162