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