3
|
1 // Bounds.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (_Bounds_h) |
|
25 #define _Bounds_h 1 |
|
26 |
|
27 #ifdef __GNUG__ |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #include <iostream.h> |
|
32 #include "Matrix.h" |
|
33 |
|
34 #ifndef Vector |
|
35 #define Vector ColumnVector |
|
36 #endif |
|
37 |
|
38 class Bounds |
|
39 { |
|
40 public: |
|
41 |
|
42 Bounds (void); |
|
43 Bounds (int n); |
|
44 Bounds (const Vector lb, const Vector ub); |
|
45 Bounds (const Bounds& a); |
|
46 |
|
47 Bounds& operator = (const Bounds& a); |
|
48 |
|
49 Bounds& resize (int n); |
|
50 |
|
51 double lower_bound (int index) const; |
|
52 double upper_bound (int index) const; |
|
53 |
|
54 Vector lower_bounds (void) const; |
|
55 Vector upper_bounds (void) const; |
|
56 |
|
57 int size (void) const; |
|
58 |
|
59 Bounds& set_bound (int index, double low, double high); |
|
60 |
|
61 Bounds& set_bounds (double low, double high); |
|
62 Bounds& set_bounds (const Vector lb, const Vector ub); |
|
63 |
|
64 Bounds& set_lower_bound (int index, double low); |
|
65 Bounds& set_upper_bound (int index, double high); |
|
66 |
|
67 Bounds& set_lower_bounds (double low); |
|
68 Bounds& set_upper_bounds (double high); |
|
69 |
|
70 Bounds& set_lower_bounds (const Vector lb); |
|
71 Bounds& set_upper_bounds (const Vector ub); |
|
72 |
|
73 friend ostream& operator << (ostream& os, const Bounds& b); |
|
74 |
|
75 protected: |
|
76 |
|
77 Vector lb; |
|
78 Vector ub; |
|
79 |
|
80 int nb; |
|
81 |
|
82 private: |
|
83 |
|
84 void error (const char *msg); |
|
85 |
|
86 }; |
|
87 |
|
88 #endif |
|
89 |
|
90 /* |
|
91 ;;; Local Variables: *** |
|
92 ;;; mode: C++ *** |
|
93 ;;; page-delimiter: "^/\\*" *** |
|
94 ;;; End: *** |
|
95 */ |