Mercurial > hg > octave-lyh
annotate liboctave/numeric/base-min.h @ 16626:4adf3c4bd80b
GUI compilation fixes for MSVC.
* libgui/src/dialog.cc (ACTIVE_ESCAPE, RICH_TEXT): Define to 1 instead of
"true".
(LINE_EDIT_FOLLOWS_PROMPT): Define to 0 instead of "false".
*libgui/src/settings-dialog.cc (settings_dialog::read_lexer_settings,
settings_dialog::read_workspace_colors,
settings_dialog::read_terminal_colors): Use QVector instead of C99
non-constant arrays.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 06 May 2013 20:02:08 -0400 |
parents | 648dabbb4c6b |
children |
rev | line source |
---|---|
1527 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1995-2012 John W. Eaton |
1527 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1527 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1527 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_base_min_h) | |
24 #define octave_base_min_h 1 | |
25 | |
26 #include "dColVector.h" | |
27 | |
1879 | 28 class |
29 base_minimizer | |
1527 | 30 { |
1837 | 31 public: |
1527 | 32 |
1879 | 33 base_minimizer (void) : x () { } |
1527 | 34 |
1879 | 35 base_minimizer (const ColumnVector& xx) : x (xx) { } |
1527 | 36 |
1879 | 37 base_minimizer (const base_minimizer& a) : x (a.x) { } |
1527 | 38 |
39 virtual ~base_minimizer (void) { } | |
40 | |
41 base_minimizer& operator = (const base_minimizer& a) | |
42 { | |
1879 | 43 if (this != &a) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
44 x = a.x; |
1879 | 45 |
1527 | 46 return *this; |
47 } | |
48 | |
49 // Derived classes must provide a function to actually do the | |
50 // minimization. | |
51 | |
5275 | 52 virtual ColumnVector do_minimize (double& objf, octave_idx_type& inform, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
53 ColumnVector& lambda) = 0; |
1527 | 54 |
55 // Lots of ways to call the single function and optionally set and | |
56 // get additional information. | |
57 | |
58 virtual ColumnVector minimize (void) | |
59 { | |
60 double objf; | |
5275 | 61 octave_idx_type inform; |
1536 | 62 ColumnVector lambda; |
1527 | 63 return do_minimize (objf, inform, lambda); |
64 } | |
65 | |
66 virtual ColumnVector minimize (double& objf) | |
67 { | |
5275 | 68 octave_idx_type inform; |
1536 | 69 ColumnVector lambda; |
1527 | 70 return do_minimize (objf, inform, lambda); |
71 } | |
72 | |
5275 | 73 virtual ColumnVector minimize (double& objf, octave_idx_type& inform) |
1527 | 74 { |
1536 | 75 ColumnVector lambda; |
1527 | 76 return do_minimize (objf, inform, lambda); |
77 } | |
78 | |
5275 | 79 virtual ColumnVector minimize (double& objf, octave_idx_type& inform, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
80 ColumnVector& lambda) |
1527 | 81 { |
82 return do_minimize (objf, inform, lambda); | |
83 } | |
84 | |
85 virtual ColumnVector minimize (const ColumnVector& x0) | |
86 { | |
87 x = x0; | |
88 double objf; | |
5275 | 89 octave_idx_type inform; |
1536 | 90 ColumnVector lambda; |
1527 | 91 return do_minimize (objf, inform, lambda); |
92 } | |
93 | |
94 virtual ColumnVector minimize (const ColumnVector& x0, double& objf) | |
95 { | |
96 x = x0; | |
5275 | 97 octave_idx_type inform; |
1536 | 98 ColumnVector lambda; |
1527 | 99 return do_minimize (objf, inform, lambda); |
100 } | |
101 | |
102 virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
103 octave_idx_type& inform) |
1527 | 104 { |
105 x = x0; | |
1536 | 106 ColumnVector lambda; |
1527 | 107 return do_minimize (objf, inform, lambda); |
108 } | |
109 | |
110 virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
111 octave_idx_type& inform, ColumnVector& lambda) |
1527 | 112 { |
113 x = x0; | |
114 return do_minimize (objf, inform, lambda); | |
115 } | |
116 | |
5275 | 117 octave_idx_type size (void) const { return x.capacity (); } |
1835 | 118 |
1527 | 119 protected: |
120 | |
121 ColumnVector x; | |
122 }; | |
123 | |
124 #endif |