Ipopt
3.11.8
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
LinAlg
IpCompoundSymMatrix.hpp
Go to the documentation of this file.
1
// Copyright (C) 2004, 2008 International Business Machines and others.
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// $Id: IpCompoundSymMatrix.hpp 1861 2010-12-21 21:34:47Z andreasw $
6
//
7
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9
#ifndef __IPCOMPOUNDSYMMATRIX_HPP__
10
#define __IPCOMPOUNDSYMMATRIX_HPP__
11
12
#include "
IpUtils.hpp
"
13
#include "
IpSymMatrix.hpp
"
14
15
namespace
Ipopt
16
{
17
18
/* forward declarations */
19
class
CompoundSymMatrixSpace;
20
24
class
CompoundSymMatrix
:
public
SymMatrix
25
{
26
public
:
27
30
36
CompoundSymMatrix
(
const
CompoundSymMatrixSpace
* owner_space);
37
39
~CompoundSymMatrix
();
41
46
void
SetComp
(
Index
irow,
Index
jcol,
const
Matrix
& matrix);
47
49
void
SetCompNonConst
(
Index
irow,
Index
jcol,
Matrix
& matrix);
50
54
SmartPtr<const Matrix>
GetComp
(
Index
irow,
Index
jcol)
const
55
{
56
return
ConstComp
(irow,jcol);
57
}
58
62
SmartPtr<Matrix>
GetCompNonConst
(
Index
irow,
Index
jcol)
63
{
64
ObjectChanged
();
65
return
Comp
(irow,jcol);
66
}
67
69
SmartPtr<CompoundSymMatrix>
MakeNewCompoundSymMatrix
()
const
;
70
71
// The following don't seem to be necessary
72
/* Number of block rows of this compound matrix. */
73
// Index NComps_NRows() const { return NComps_Dim(); }
74
75
/* Number of block colmuns of this compound matrix. */
76
// Index NComps_NCols() const { return NComps_Dim(); }
77
79
Index
NComps_Dim
()
const
;
80
81
protected
:
84
virtual
void
MultVectorImpl
(
Number
alpha,
const
Vector
&
x
,
85
Number
beta,
Vector
& y)
const
;
86
89
virtual
bool
HasValidNumbersImpl
()
const
;
90
91
virtual
void
ComputeRowAMaxImpl
(
Vector
& rows_norms,
bool
init)
const
;
92
93
virtual
void
PrintImpl
(
const
Journalist
& jnlst,
94
EJournalLevel
level,
95
EJournalCategory
category,
96
const
std::string& name,
97
Index
indent,
98
const
std::string& prefix)
const
;
100
101
private
:
111
CompoundSymMatrix
();
112
114
CompoundSymMatrix
(
const
CompoundSymMatrix
&);
115
117
void
operator=
(
const
CompoundSymMatrix
&);
119
121
std::vector<std::vector<SmartPtr<Matrix> > >
comps_
;
122
124
std::vector<std::vector<SmartPtr<const Matrix> > >
const_comps_
;
125
127
const
CompoundSymMatrixSpace
*
owner_space_
;
128
130
mutable
bool
matrices_valid_
;
131
133
bool
MatricesValid
()
const
;
134
136
const
Matrix
*
ConstComp
(
Index
irow,
Index
jcol)
const
137
{
138
DBG_ASSERT
(irow <
NComps_Dim
());
139
DBG_ASSERT
(jcol <= irow);
140
if
(
IsValid
(
comps_
[irow][jcol])) {
141
return
GetRawPtr
(
comps_
[irow][jcol]);
142
}
143
else
if
(
IsValid
(
const_comps_
[irow][jcol])) {
144
return
GetRawPtr
(
const_comps_
[irow][jcol]);
145
}
146
147
return
NULL;
148
}
149
151
Matrix
*
Comp
(
Index
irow,
Index
jcol)
152
{
153
DBG_ASSERT
(irow <
NComps_Dim
());
154
DBG_ASSERT
(jcol <= irow);
155
// We shouldn't be asking for a non-const if this entry holds a
156
// const one...
157
DBG_ASSERT
(
IsNull
(
const_comps_
[irow][jcol]));
158
if
(
IsValid
(
comps_
[irow][jcol])) {
159
return
GetRawPtr
(
comps_
[irow][jcol]);
160
}
161
162
return
NULL;
163
}
164
};
165
171
class
CompoundSymMatrixSpace
:
public
SymMatrixSpace
172
{
173
public
:
179
CompoundSymMatrixSpace
(
Index
ncomp_spaces,
Index
total_dim);
180
182
~CompoundSymMatrixSpace
()
183
{}
185
189
void
SetBlockDim
(
Index
irow_jcol,
Index
dim);
190
192
Index
GetBlockDim
(
Index
irow_jcol)
const
;
193
200
void
SetCompSpace
(
Index
irow,
Index
jcol,
201
const
MatrixSpace
& mat_space,
202
bool
auto_allocate =
false
);
204
208
SmartPtr<const MatrixSpace>
GetCompSpace
(
Index
irow,
Index
jcol)
const
209
{
210
DBG_ASSERT
(irow<
ncomp_spaces_
);
211
DBG_ASSERT
(jcol<=irow);
212
return
comp_spaces_
[irow][jcol];
213
}
214
217
Index
NComps_Dim
()
const
218
{
219
return
ncomp_spaces_
;
220
}
222
224
CompoundSymMatrix
*
MakeNewCompoundSymMatrix
()
const
;
225
228
virtual
SymMatrix
*
MakeNewSymMatrix
()
const
229
{
230
return
MakeNewCompoundSymMatrix
();
231
}
232
233
private
:
243
CompoundSymMatrixSpace
();
244
246
CompoundSymMatrixSpace
(
const
CompoundSymMatrix
&);
247
249
CompoundSymMatrixSpace
&
operator=
(
const
CompoundSymMatrixSpace
&);
251
253
Index
ncomp_spaces_
;
254
259
std::vector<Index>
block_dim_
;
260
263
std::vector<std::vector<SmartPtr<const MatrixSpace> > >
comp_spaces_
;
264
267
std::vector<std::vector< bool > >
allocate_block_
;
268
270
mutable
bool
dimensions_set_
;
271
273
bool
DimensionsSet
()
const
;
274
};
275
276
inline
277
SmartPtr<CompoundSymMatrix>
CompoundSymMatrix::MakeNewCompoundSymMatrix
()
const
278
{
279
return
owner_space_
->
MakeNewCompoundSymMatrix
();
280
}
281
282
}
// namespace Ipopt
283
#endif
Generated by
1.8.3.1