diff liboctave/Objective.h @ 1536:26411f9c7603

[project @ 1995-10-05 05:41:26 by jwe]
author jwe
date Thu, 05 Oct 1995 05:51:20 +0000
parents 611d403c7f3d
children 620a65533630
line wrap: on
line diff
--- a/liboctave/Objective.h
+++ b/liboctave/Objective.h
@@ -24,38 +24,62 @@
 #if !defined (octave_Objective_h)
 #define octave_Objective_h 1
 
-#if defined (__GNUG__)
-#pragma interface
-#endif
-
 #include "dColVector.h"
 
-#ifndef Vector
-#define Vector ColumnVector
-#endif
-
-typedef double (*objective_fcn) (const Vector&);
-typedef Vector (*gradient_fcn) (const Vector&);
-
 class Objective
 {
  public:
 
-  Objective (void);
-  Objective (const objective_fcn);
-  Objective (const objective_fcn, const gradient_fcn);
+  typedef double (*objective_fcn) (const ColumnVector&);
+  typedef ColumnVector (*gradient_fcn) (const ColumnVector&);
+
+  Objective (void)
+    {
+      phi = 0;
+      grad = 0;
+    }
 
-  Objective (const Objective& a);
+  Objective (const objective_fcn obj)
+    {
+      phi = obj;
+      grad = 0;
+    }
 
-  Objective& operator = (const Objective& a);
+  Objective (const objective_fcn obj, const gradient_fcn g)
+    {
+      phi = obj;
+      grad = g;
+    }
 
-  objective_fcn objective_function (void) const;
+  Objective (const Objective& a)
+    {
+      phi = a.phi;
+      grad = a.grad;
+    }
 
-  Objective& set_objective_function (const objective_fcn);
+  Objective& operator = (const Objective& a)
+    {
+      phi = a.phi;
+      grad = a.grad;
+
+      return *this;
+    }
 
-  gradient_fcn gradient_function (void) const;
+  objective_fcn objective_function (void) const { return phi; }
+
+  Objective& set_objective_function (const objective_fcn obj)
+    {
+      phi = obj;
+      return *this;
+    }
 
-  Objective& set_gradient_function (const gradient_fcn);
+  gradient_fcn gradient_function (void) const { return grad; }
+
+  Objective& set_gradient_function (const gradient_fcn g)
+    {
+      grad = g;
+      return *this;
+    }
 
  private: