casa
$Rev:20696$
|
00001 //# ConjugateGradientSolver.h: Definition for an iterative ConjugateGradientSolver 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 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 adressed 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: ConjugateGradientSolver.h,v 1.2 2006/03/30 23:45:29 sbhatnag Exp $ 00028 00029 #ifndef SYNTHESIS_STEEPESTDESCENT_H 00030 #define SYNTHESIS_STEEPESTDESCENT_H 00031 //---------------------------------------------------------------------------- 00032 00033 #include <casa/aips.h> 00034 00035 #include <synthesis/MeasurementEquations/VisEquation.h> 00036 #include <synthesis/MeasurementEquations/Iterate.h> 00037 #include <synthesis/MeasurementComponents/EPJones.h> 00038 #include <synthesis/MSVis/VisBuffer.h> 00039 #include <casa/Arrays/Vector.h> 00040 #include <casa/OS/Timer.h> 00041 00042 #include <casa/Logging/LogIO.h> 00043 #include <casa/Logging/LogSink.h> 00044 #include <casa/Logging/LogMessage.h> 00045 00046 namespace casa { 00047 00048 class SteepestDescentSolver: public Iterate 00049 { 00050 public: 00051 SteepestDescentSolver(Int nParams, Vector<Int> polMap, 00052 Int nIter=20, Double tol=1E-5); 00053 ~SteepestDescentSolver(){}; 00054 00055 void setMaxParams(Int nParams){maxParams=nParams;}; 00056 00057 Double solve(VisEquation& ve, EPJones& vj, VisBuffer& vb, 00058 Int nAnt, Int SlotNo); 00059 00060 Double solve2(VisEquation& ve, VisIter& vi, EPJones& epj, Int nAnt, Int SlotNo); 00061 00062 LogIO& logIO() {return logIO_p;}; 00063 00064 private: 00065 Vector<Complex> getVj(const VisBuffer& vb, Int NAnt, Int whichAnt, Int whichPol, 00066 Double& sumWt,Int negate=0, Int weighted=1); 00067 Double getGOF(const VisBuffer& residual,Int& whichPol, Double& sumWt,char *msg=""); 00068 00069 Int maxIter,maxParams; 00070 00071 VisBuffer residual_p,gradient0_p,gradient1_p; 00072 Matrix<Bool> flags; 00073 00074 LogIO logIO_p; 00075 Vector<Int> polMap_p; 00076 }; 00077 }; 00078 00079 #endif