|
update.h00001 // 00002 // update.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Curtis Janssen <cljanss@limitpt.com> 00007 // Maintainer: LPS 00008 // 00009 // This file is part of the SC Toolkit. 00010 // 00011 // The SC Toolkit is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Library General Public License as published by 00013 // the Free Software Foundation; either version 2, or (at your option) 00014 // any later version. 00015 // 00016 // The SC Toolkit is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Library General Public License 00022 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to 00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00024 // 00025 // The U.S. Government is granted a limited license as per AL 91-7. 00026 // 00027 00028 #ifndef _math_optimize_update_h 00029 #define _math_optimize_update_h 00030 00031 #ifdef __GNUC__ 00032 #pragma interface 00033 #endif 00034 00035 #include <util/state/state.h> 00036 #include <util/class/class.h> 00037 #include <math/scmat/matrix.h> 00038 #include <math/optimize/function.h> 00039 #include <math/optimize/transform.h> 00040 00041 namespace sc { 00042 00043 // ////////////////////////////////////////////////////////////////////// 00044 // hessian update classes. based on the value of inverse_hessian_ 00045 // x and g may be reversed (see Schlegel, ab initio Methods in Quantum 00046 // Chemistry I, 1987, p 10 00047 00048 00054 class HessianUpdate: virtual public SavableState { 00055 protected: 00056 int inverse_hessian_; 00057 public: 00058 HessianUpdate(); 00059 HessianUpdate(StateIn&); 00060 HessianUpdate(const Ref<KeyVal>&); 00061 void save_data_state(StateOut&); 00062 virtual ~HessianUpdate(); 00063 virtual void update(const RefSymmSCMatrix&hessian,const Ref<Function>&, 00064 const RefSCVector&xnew,const RefSCVector&gnew) = 0; 00065 virtual void set_inverse(); 00066 virtual void apply_transform(const Ref<NonlinearTransform>&); 00067 }; 00068 00069 00072 class DFPUpdate: public HessianUpdate { 00073 protected: 00074 RefSCVector xprev; 00075 RefSCVector gprev; 00076 public: 00077 DFPUpdate(); 00078 DFPUpdate(StateIn&); 00092 DFPUpdate(const Ref<KeyVal>&); 00093 void save_data_state(StateOut&); 00094 ~DFPUpdate(); 00095 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&, 00096 const RefSCVector&xnew,const RefSCVector&gnew); 00097 void apply_transform(const Ref<NonlinearTransform>&); 00098 void set_inverse(); 00099 }; 00100 00104 class BFGSUpdate: public DFPUpdate { 00105 public: 00106 BFGSUpdate(); 00107 BFGSUpdate(StateIn&); 00108 BFGSUpdate(const Ref<KeyVal>&); 00109 void save_data_state(StateOut&); 00110 ~BFGSUpdate(); 00111 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&, 00112 const RefSCVector&xnew,const RefSCVector&gnew); 00113 }; 00114 00119 class PowellUpdate: public HessianUpdate { 00120 protected: 00121 RefSCVector xprev; 00122 RefSCVector gprev; 00123 public: 00124 PowellUpdate(); 00125 PowellUpdate(StateIn&); 00126 PowellUpdate(const Ref<KeyVal>&); 00127 void save_data_state(StateOut&); 00128 ~PowellUpdate(); 00129 void update(const RefSymmSCMatrix&ihessian,const Ref<Function>&func, 00130 const RefSCVector&xnew,const RefSCVector&gnew); 00131 void apply_transform(const Ref<NonlinearTransform>&); 00132 }; 00133 00134 } 00135 00136 #endif 00137 00138 // Local Variables: 00139 // mode: c++ 00140 // c-file-style: "CLJ" 00141 // End: Generated at Fri Jan 10 08:14:10 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14. |