Ipopt
3.11.4
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
src
LinAlg
TMatrices
IpGenTMatrix.hpp
Go to the documentation of this file.
1
// Copyright (C) 2004, 2009 International Business Machines and others.
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// $Id: IpGenTMatrix.hpp 1861 2010-12-21 21:34:47Z andreasw $
6
//
7
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9
#ifndef __IPGENTMATRIX_HPP__
10
#define __IPGENTMATRIX_HPP__
11
12
#include "
IpUtils.hpp
"
13
#include "
IpMatrix.hpp
"
14
15
namespace
Ipopt
16
{
17
18
/* forward declarations */
19
class
GenTMatrixSpace;
20
36
class
GenTMatrix
:
public
Matrix
37
{
38
public
:
39
42
45
GenTMatrix
(
const
GenTMatrixSpace
* owner_space);
46
48
~GenTMatrix
();
50
58
void
SetValues
(
const
Number
*
Values
);
60
64
Index
Nonzeros
()
const
;
65
67
const
Index
*
Irows
()
const
;
68
70
const
Index
*
Jcols
()
const
;
71
73
const
Number
*
Values
()
const
74
{
75
return
values_
;
76
}
77
82
Number
*
Values
()
83
{
84
ObjectChanged
();
85
initialized_
=
true
;
86
return
values_
;
87
}
89
90
protected
:
93
virtual
void
MultVectorImpl
(
Number
alpha,
const
Vector
&
x
,
Number
beta,
94
Vector
&y)
const
;
95
96
virtual
void
TransMultVectorImpl
(
Number
alpha,
const
Vector
&
x
,
Number
beta,
97
Vector
& y)
const
;
98
101
virtual
bool
HasValidNumbersImpl
()
const
;
102
103
virtual
void
ComputeRowAMaxImpl
(
Vector
& rows_norms,
bool
init)
const
;
104
105
virtual
void
ComputeColAMaxImpl
(
Vector
& cols_norms,
bool
init)
const
;
106
107
virtual
void
PrintImpl
(
const
Journalist
& jnlst,
108
EJournalLevel
level,
109
EJournalCategory
category,
110
const
std::string& name,
111
Index
indent,
112
const
std::string& prefix)
const
113
{
114
PrintImplOffset
(jnlst, level, category, name, indent, prefix, 0);
115
}
117
118
void
PrintImplOffset
(
const
Journalist
& jnlst,
119
EJournalLevel
level,
120
EJournalCategory
category,
121
const
std::string& name,
122
Index
indent,
123
const
std::string& prefix,
124
Index
offset)
const
;
125
126
friend
class
ParGenMatrix
;
127
128
private
:
138
GenTMatrix
();
139
141
GenTMatrix
(
const
GenTMatrix
&);
142
144
void
operator=
(
const
GenTMatrix
&);
146
150
const
GenTMatrixSpace
*
owner_space_
;
151
153
Number
*
values_
;
154
156
bool
initialized_
;
157
158
};
159
164
class
GenTMatrixSpace
:
public
MatrixSpace
165
{
166
public
:
176
GenTMatrixSpace
(
Index
nRows,
Index
nCols,
177
Index
nonZeros,
178
const
Index
* iRows,
const
Index
* jCols);
179
181
~GenTMatrixSpace
()
182
{
183
delete
[]
iRows_
;
184
delete
[]
jCols_
;
185
}
187
189
GenTMatrix
*
MakeNewGenTMatrix
()
const
190
{
191
return
new
GenTMatrix
(
this
);
192
}
193
196
virtual
Matrix
*
MakeNew
()
const
197
{
198
return
MakeNewGenTMatrix
();
199
}
200
204
Index
Nonzeros
()
const
205
{
206
return
nonZeros_
;
207
}
208
210
const
Index
*
Irows
()
const
211
{
212
return
iRows_
;
213
}
214
216
const
Index
*
Jcols
()
const
217
{
218
return
jCols_
;
219
}
221
222
private
:
227
const
Index
nonZeros_
;
228
Index
*
jCols_
;
229
Index
*
iRows_
;
231
234
Number
*
AllocateInternalStorage
()
const
;
235
238
void
FreeInternalStorage
(
Number
* values)
const
;
239
240
friend
class
GenTMatrix
;
241
};
242
243
/* inline methods */
244
inline
245
Index
GenTMatrix::Nonzeros
()
const
246
{
247
return
owner_space_
->
Nonzeros
();
248
}
249
250
inline
251
const
Index
*
GenTMatrix::Irows
()
const
252
{
253
return
owner_space_
->
Irows
();
254
}
255
256
inline
257
const
Index
*
GenTMatrix::Jcols
()
const
258
{
259
return
owner_space_
->
Jcols
();
260
}
261
262
263
}
// namespace Ipopt
264
#endif
Generated on Mon Oct 21 2013 19:08:15 for Ipopt by
1.8.4