Line data Source code
1 : //# ConjugateGradientSolver.h: Definition for an iterative ConjugateGradientSolver 2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library 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 Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed 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 : //# 27 : //# $Id: ConjugateGradientSolver.h,v 1.2 2006/03/30 23:45:29 sbhatnag Exp $ 28 : 29 : #ifndef SYNTHESIS_STEEPESTDESCENT_H 30 : #define SYNTHESIS_STEEPESTDESCENT_H 31 : //---------------------------------------------------------------------------- 32 : 33 : #include <casacore/casa/aips.h> 34 : 35 : #include <synthesis/MeasurementEquations/VisEquation.h> 36 : #include <synthesis/MeasurementEquations/Iterate.h> 37 : #include <synthesis/MeasurementComponents/EPJones.h> 38 : #include <msvis/MSVis/VisBuffer.h> 39 : #include <casacore/casa/Arrays/Vector.h> 40 : #include <casacore/casa/OS/Timer.h> 41 : 42 : #include <casacore/casa/Logging/LogIO.h> 43 : #include <casacore/casa/Logging/LogSink.h> 44 : #include <casacore/casa/Logging/LogMessage.h> 45 : 46 : namespace casa { 47 : 48 : class SteepestDescentSolver: public Iterate 49 : { 50 : public: 51 : SteepestDescentSolver(casacore::Int nParams, casacore::Vector<casacore::Int> polMap, 52 : casacore::Int nIter=20, casacore::Double tol=1E-5); 53 0 : ~SteepestDescentSolver(){}; 54 : 55 0 : void setMaxParams(casacore::Int nParams){maxParams=nParams;}; 56 : 57 : casacore::Double solve(VisEquation& ve, EPJones& vj, VisBuffer& vb, 58 : casacore::Int nAnt, casacore::Int SlotNo); 59 : 60 : casacore::Double solve2(VisEquation& ve, VisIter& vi, EPJones& epj, casacore::Int nAnt, casacore::Int SlotNo); 61 : 62 0 : casacore::LogIO& logIO() {return logIO_p;}; 63 : 64 : private: 65 : casacore::Vector<casacore::Complex> getVj(const VisBuffer& vb, casacore::Int NAnt, casacore::Int whichAnt, casacore::Int whichPol, 66 : casacore::Double& sumWt,casacore::Int negate=0, casacore::Int weighted=1); 67 : casacore::Double getGOF(const VisBuffer& residual,casacore::Int& whichPol, casacore::Double& sumWt,const char *msg=""); 68 : 69 : casacore::Int /*maxIter,*/ maxParams; 70 : 71 : VisBuffer residual_p,gradient0_p,gradient1_p; 72 : casacore::Matrix<casacore::Bool> flags; 73 : 74 : casacore::LogIO logIO_p; 75 : casacore::Vector<casacore::Int> polMap_p; 76 : }; 77 : }; 78 : 79 : #endif