00001 /* 00002 00003 Copyright (C) 1996, 1997 John W. Eaton 00004 00005 This file is part of Octave. 00006 00007 Octave is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 2, or (at your option) any 00010 later version. 00011 00012 Octave is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Octave; see the file COPYING. If not, write to the Free 00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 */ 00022 00023 #if !defined (octave_Objective_h) 00024 #define octave_Objective_h 1 00025 00026 #include "dColVector.h" 00027 00028 class 00029 Objective 00030 { 00031 public: 00032 00033 typedef double (*objective_fcn) (const ColumnVector&); 00034 typedef ColumnVector (*gradient_fcn) (const ColumnVector&); 00035 00036 Objective (void) 00037 : phi (0), grad (0) { } 00038 00039 Objective (const objective_fcn obj) 00040 : phi (obj), grad (0) { } 00041 00042 Objective (const objective_fcn obj, const gradient_fcn g) 00043 : phi (obj), grad (g) { } 00044 00045 Objective (const Objective& a) 00046 : phi (a.phi), grad (a.grad) { } 00047 00048 Objective& operator = (const Objective& a) 00049 { 00050 if (this != &a) 00051 { 00052 phi = a.phi; 00053 grad = a.grad; 00054 } 00055 return *this; 00056 } 00057 00058 ~Objective (void) { } 00059 00060 objective_fcn objective_function (void) const { return phi; } 00061 00062 Objective& set_objective_function (const objective_fcn obj) 00063 { 00064 phi = obj; 00065 return *this; 00066 } 00067 00068 gradient_fcn gradient_function (void) const { return grad; } 00069 00070 Objective& set_gradient_function (const gradient_fcn g) 00071 { 00072 grad = g; 00073 return *this; 00074 } 00075 00076 private: 00077 00078 objective_fcn phi; 00079 gradient_fcn grad; 00080 00081 }; 00082 00083 #endif 00084 00085 /* 00086 ;;; Local Variables: *** 00087 ;;; mode: C++ *** 00088 ;;; End: *** 00089 */
SEO | [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送 | ||