casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FunctionalProxy.h
Go to the documentation of this file.
00001 //# FunctionFactory.h: a class for creating Function objects from Records
00002 //# Copyright (C) 2002
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 //#
00027 //# $Id: FunctionalProxy.h 20824 2009-11-20 04:55:09Z Malte.Marquarding $
00028 
00029 #ifndef SCIMATH_FUNCTIONALSPROXY_H
00030 #define SCIMATH_FUNCTIONALSPROXY_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Arrays/Vector.h>
00034 #include <casa/BasicSL/String.h>
00035 #include <casa/Containers/Record.h>
00036 #include <casa/BasicSL/Complex.h>
00037 #include <scimath/Functionals/FunctionHolder.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 class FunctionalProxy {
00042 public:
00043   FunctionalProxy() {;}
00044   // type 0==Double, other == DComplex
00045   FunctionalProxy(const Record& rec, Int type=0);
00046   virtual ~FunctionalProxy();
00047   Vector<Double> f(const Vector<Double>& val);
00048   Vector<Double> fdf(const Vector<Double>& val);
00049   void add(const FunctionalProxy& func);
00050   Vector<DComplex> fc(const Vector<DComplex>& val);
00051   Vector<DComplex> fdfc(const Vector<Double>& val);
00052   void addc(const FunctionalProxy& func);
00053   Record asrecord();
00054   Int npar() const;
00055   uInt ndim() const;
00056   void setparameters(const Vector<Double>& val);
00057   void setparametersc(const Vector<DComplex>& val);
00058   void setmasks(const Vector<Bool>& val);
00059 
00060   void setmask(Int i, Bool val);
00061   void setpar(Int i, Double val);
00062   void setparc(Int i, DComplex val);
00063 
00064   Vector<Bool> masks() const;
00065   Vector<Double> parameters() const;
00066   Vector<DComplex> parametersc() const;
00067 
00068 private:
00069   Record fhd2rec();
00070   Record fhdc2rec();
00071   void rec2fhdc(const Record& rec);
00072   void rec2fhd(const Record& rec);
00073   Int type_;
00074   FunctionHolder<Double> fhd_;
00075   FunctionHolder<DComplex> fhdc_;
00076 
00077 
00078 };
00079 }
00080 #endif