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
IpMultiVectorMatrix.hpp
Go to the documentation of this file.
1
// Copyright (C) 2005, 2008 International Business Machines and others.
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// $Id: IpMultiVectorMatrix.hpp 1861 2010-12-21 21:34:47Z andreasw $
6
//
7
// Authors: Andreas Waechter IBM 2005-12-24
8
9
#ifndef __IPMULTIVECTORMATRIX_HPP__
10
#define __IPMULTIVECTORMATRIX_HPP__
11
12
#include "
IpUtils.hpp
"
13
#include "
IpMatrix.hpp
"
14
15
namespace
Ipopt
16
{
17
19
class
MultiVectorMatrixSpace;
20
25
class
MultiVectorMatrix
:
public
Matrix
26
{
27
public
:
28
31
34
MultiVectorMatrix
(
const
MultiVectorMatrixSpace
* owner_space);
35
37
~MultiVectorMatrix
();
39
41
SmartPtr<MultiVectorMatrix>
MakeNewMultiVectorMatrix
()
const
;
42
48
void
SetVector
(
Index
i,
const
Vector
& vec);
49
/* For the non-const version, keep in mind that operations that
50
* change this matrix also change the Vector that has been given
51
* here. */
52
void
SetVectorNonConst
(
Index
i,
Vector
& vec);
54
56
inline
SmartPtr<const Vector>
GetVector
(
Index
i)
const
57
{
58
return
ConstVec
(i);
59
}
60
64
inline
SmartPtr<Vector>
GetVectorNonConst
(
Index
i)
65
{
66
ObjectChanged
();
67
return
Vec
(i);
68
}
69
72
void
ScaleRows
(
const
Vector
& scal_vec);
73
76
void
ScaleColumns
(
const
Vector
& scal_vec);
77
80
void
AddOneMultiVectorMatrix
(
Number
a,
const
MultiVectorMatrix
& mv1,
81
Number
c);
82
87
void
AddRightMultMatrix
(
Number
a,
const
MultiVectorMatrix
& U,
88
const
Matrix
& C,
Number
b);
89
92
void
FillWithNewVectors
();
93
97
void
LRMultVector
(
Number
alpha,
const
Vector
&
x
,
98
Number
beta,
Vector
&y)
const
;
99
101
SmartPtr<const VectorSpace>
ColVectorSpace
()
const
;
102
104
SmartPtr<const MultiVectorMatrixSpace>
MultiVectorMatrixOwnerSpace
()
const
;
105
106
protected
:
109
virtual
void
MultVectorImpl
(
Number
alpha,
const
Vector
&
x
,
Number
beta,
110
Vector
&y)
const
;
111
112
virtual
void
TransMultVectorImpl
(
Number
alpha,
const
Vector
&
x
,
113
Number
beta,
Vector
& y)
const
;
114
117
virtual
bool
HasValidNumbersImpl
()
const
;
118
119
virtual
void
ComputeRowAMaxImpl
(
Vector
& rows_norms,
bool
init)
const
;
120
121
virtual
void
ComputeColAMaxImpl
(
Vector
& cols_norms,
bool
init)
const
;
122
123
virtual
void
PrintImpl
(
const
Journalist
& jnlst,
124
EJournalLevel
level,
125
EJournalCategory
category,
126
const
std::string& name,
127
Index
indent,
128
const
std::string& prefix)
const
;
130
131
132
private
:
142
MultiVectorMatrix
();
143
145
MultiVectorMatrix
(
const
MultiVectorMatrix
&);
146
148
void
operator=
(
const
MultiVectorMatrix
&);
150
151
const
MultiVectorMatrixSpace
*
owner_space_
;
152
154
std::vector<SmartPtr<const Vector> >
const_vecs_
;
155
157
std::vector<SmartPtr<Vector> >
non_const_vecs_
;
158
161
inline
const
Vector
*
ConstVec
(
Index
i)
const
162
{
163
DBG_ASSERT
(i <
NCols
());
164
DBG_ASSERT
(
IsValid
(
const_vecs_
[i]) ||
IsValid
(
non_const_vecs_
[i]));
165
if
(
IsValid
(
non_const_vecs_
[i])) {
166
return
GetRawPtr
(
non_const_vecs_
[i]);
167
}
168
else
{
169
return
GetRawPtr
(
const_vecs_
[i]);
170
}
171
}
172
173
inline
Vector
*
Vec
(
Index
i)
174
{
175
DBG_ASSERT
(i <
NCols
());
176
DBG_ASSERT
(
IsValid
(
non_const_vecs_
[i]));
177
return
GetRawPtr
(
non_const_vecs_
[i]);
178
}
180
};
181
184
class
MultiVectorMatrixSpace
:
public
MatrixSpace
185
{
186
public
:
192
MultiVectorMatrixSpace
(
Index
ncols,
193
const
VectorSpace
& vec_space);
194
196
~MultiVectorMatrixSpace
()
197
{}
199
201
MultiVectorMatrix
*
MakeNewMultiVectorMatrix
()
const
202
{
203
return
new
MultiVectorMatrix
(
this
);
204
}
205
208
virtual
Matrix
*
MakeNew
()
const
209
{
210
return
MakeNewMultiVectorMatrix
();
211
}
212
214
SmartPtr<const VectorSpace>
ColVectorSpace
()
const
215
{
216
return
vec_space_
;
217
}
218
219
private
:
220
SmartPtr<const VectorSpace>
vec_space_
;
221
222
};
223
224
inline
225
MultiVectorMatrix::~MultiVectorMatrix
()
226
{}
227
228
inline
229
SmartPtr<MultiVectorMatrix>
MultiVectorMatrix::MakeNewMultiVectorMatrix
()
const
230
{
231
return
owner_space_
->
MakeNewMultiVectorMatrix
();
232
}
233
234
inline
235
SmartPtr<const VectorSpace>
MultiVectorMatrix::ColVectorSpace
()
const
236
{
237
return
owner_space_
->
ColVectorSpace
();
238
}
239
240
inline
241
SmartPtr<const MultiVectorMatrixSpace>
242
MultiVectorMatrix::MultiVectorMatrixOwnerSpace
()
const
243
{
244
return
owner_space_
;
245
}
246
247
}
// namespace Ipopt
248
#endif
Generated by
1.8.3.1