Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
1535:5f3f07b6db89 | 1536:26411f9c7603 |
---|---|
22 */ | 22 */ |
23 | 23 |
24 #if !defined (octave_Objective_h) | 24 #if !defined (octave_Objective_h) |
25 #define octave_Objective_h 1 | 25 #define octave_Objective_h 1 |
26 | 26 |
27 #if defined (__GNUG__) | |
28 #pragma interface | |
29 #endif | |
30 | |
31 #include "dColVector.h" | 27 #include "dColVector.h" |
32 | |
33 #ifndef Vector | |
34 #define Vector ColumnVector | |
35 #endif | |
36 | |
37 typedef double (*objective_fcn) (const Vector&); | |
38 typedef Vector (*gradient_fcn) (const Vector&); | |
39 | 28 |
40 class Objective | 29 class Objective |
41 { | 30 { |
42 public: | 31 public: |
43 | 32 |
44 Objective (void); | 33 typedef double (*objective_fcn) (const ColumnVector&); |
45 Objective (const objective_fcn); | 34 typedef ColumnVector (*gradient_fcn) (const ColumnVector&); |
46 Objective (const objective_fcn, const gradient_fcn); | |
47 | 35 |
48 Objective (const Objective& a); | 36 Objective (void) |
37 { | |
38 phi = 0; | |
39 grad = 0; | |
40 } | |
49 | 41 |
50 Objective& operator = (const Objective& a); | 42 Objective (const objective_fcn obj) |
43 { | |
44 phi = obj; | |
45 grad = 0; | |
46 } | |
51 | 47 |
52 objective_fcn objective_function (void) const; | 48 Objective (const objective_fcn obj, const gradient_fcn g) |
49 { | |
50 phi = obj; | |
51 grad = g; | |
52 } | |
53 | 53 |
54 Objective& set_objective_function (const objective_fcn); | 54 Objective (const Objective& a) |
55 { | |
56 phi = a.phi; | |
57 grad = a.grad; | |
58 } | |
55 | 59 |
56 gradient_fcn gradient_function (void) const; | 60 Objective& operator = (const Objective& a) |
61 { | |
62 phi = a.phi; | |
63 grad = a.grad; | |
57 | 64 |
58 Objective& set_gradient_function (const gradient_fcn); | 65 return *this; |
66 } | |
67 | |
68 objective_fcn objective_function (void) const { return phi; } | |
69 | |
70 Objective& set_objective_function (const objective_fcn obj) | |
71 { | |
72 phi = obj; | |
73 return *this; | |
74 } | |
75 | |
76 gradient_fcn gradient_function (void) const { return grad; } | |
77 | |
78 Objective& set_gradient_function (const gradient_fcn g) | |
79 { | |
80 grad = g; | |
81 return *this; | |
82 } | |
59 | 83 |
60 private: | 84 private: |
61 | 85 |
62 objective_fcn phi; | 86 objective_fcn phi; |
63 gradient_fcn grad; | 87 gradient_fcn grad; |