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