3
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
3
|
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 |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
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 |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_LinConst_h) |
|
24 #define octave_LinConst_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
3503
|
30 #include <iostream> |
238
|
31 |
465
|
32 class ColumnVector; |
|
33 |
1366
|
34 #include <cfloat> |
465
|
35 |
|
36 #include "dMatrix.h" |
3
|
37 #include "Bounds.h" |
|
38 |
1866
|
39 class |
|
40 LinConst : public Bounds |
3
|
41 { |
|
42 public: |
|
43 |
1866
|
44 LinConst (void) |
|
45 : Bounds (), A () { } |
3
|
46 |
1536
|
47 LinConst (const ColumnVector& l, const Matrix& amat, const ColumnVector& u) |
1321
|
48 : Bounds (l, u), A (amat) |
|
49 { |
1866
|
50 if (Bounds::size () != amat.rows ()) |
|
51 error ("nonconformant constraint matrix and bounds vectors"); |
1321
|
52 } |
3
|
53 |
1321
|
54 LinConst (const LinConst& a) |
1866
|
55 : Bounds (a.lb, a.ub), A (a.A) { } |
3
|
56 |
1321
|
57 LinConst& operator = (const LinConst& a) |
|
58 { |
1866
|
59 if (this != &a) |
|
60 { |
|
61 Bounds::operator = (a); |
1321
|
62 |
1866
|
63 A = a.A; |
|
64 } |
1321
|
65 return *this; |
|
66 } |
3
|
67 |
1866
|
68 ~LinConst (void) { } |
3
|
69 |
1321
|
70 Matrix constraint_matrix (void) const { return A; } |
3
|
71 |
1321
|
72 LinConst& set_constraint_matrix (const Matrix& amat) |
|
73 { |
|
74 if (lb.capacity () != amat.rows ()) |
|
75 error ("inconsistent size for new linear constraint matrix"); |
|
76 |
|
77 A = amat; |
|
78 |
|
79 return *this; |
|
80 } |
3
|
81 |
3504
|
82 friend std::ostream& operator << (std::ostream& os, const LinConst& b); |
3
|
83 |
|
84 protected: |
|
85 |
|
86 Matrix A; |
|
87 |
|
88 private: |
|
89 |
|
90 void error (const char *msg); |
|
91 }; |
|
92 |
|
93 #endif |
|
94 |
|
95 /* |
|
96 ;;; Local Variables: *** |
|
97 ;;; mode: C++ *** |
|
98 ;;; End: *** |
|
99 */ |