Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpSymTMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpSymTMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPSYMTMATRIX_HPP__
10 #define __IPSYMTMATRIX_HPP__
11
12 #include "IpUtils.hpp"
13 #include "IpSymMatrix.hpp"
14
15 namespace Ipopt
16 {
17
18 /* forward declarations */
19 class SymTMatrixSpace;
20
42 class SymTMatrix : public SymMatrix
43 {
44 public:
45
48
51 SymTMatrix(const SymTMatrixSpace* owner_space);
52
54 ~SymTMatrix();
56
64 void SetValues(const Number* Values);
66
70 Index Nonzeros() const;
71
76 const Index* Irows() const;
77
82 const Index* Jcols() const;
83
88 Number* Values();
93 const Number* Values() const;
95
99 void FillStruct(ipfint* Irn, ipfint* Jcn) const;
100
102 void FillValues(Number* Values) const;
104
105 protected:
108 virtual void MultVectorImpl(Number alpha, const Vector& x, Number beta,
109 Vector& y) const;
110
113 virtual bool HasValidNumbersImpl() const;
114
115 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
116
117 virtual void PrintImpl(const Journalist& jnlst,
118 EJournalLevel level,
119 EJournalCategory category,
120 const std::string& name,
121 Index indent,
122 const std::string& prefix) const;
124
125 private:
135 SymTMatrix();
136
138 SymTMatrix(const SymTMatrix&);
139
141 void operator=(const SymTMatrix&);
143
147 const SymTMatrixSpace* owner_space_;
148
150 Number* values_;
151
153 bool initialized_;
154
155 };
156
161 class SymTMatrixSpace : public SymMatrixSpace
162 {
163 public:
174 SymTMatrixSpace(Index dim, Index nonZeros, const Index* iRows,
175 const Index* jCols);
176
178 ~SymTMatrixSpace();
180
183 virtual SymMatrix* MakeNewSymMatrix() const
184 {
185 return MakeNewSymTMatrix();
186 }
187
189 SymTMatrix* MakeNewSymTMatrix() const
190 {
191 return new SymTMatrix(this);
192 }
193
197 Index Nonzeros() const
198 {
199 return nonZeros_;
200 }
201
203 const Index* Irows() const
204 {
205 return iRows_;
206 }
207
209 const Index* Jcols() const
210 {
211 return jCols_;
212 }
214
215 private:
219 Number* AllocateInternalStorage() const;
220
222 void FreeInternalStorage(Number* values) const;
224
225 const Index nonZeros_;
226 Index* iRows_;
227 Index* jCols_;
228
229 friend class SymTMatrix;
230 };
231
232 /* Inline Methods */
233 inline
234 Index SymTMatrix::Nonzeros() const
235 {
236 return owner_space_->Nonzeros();
237 }
238
239 inline
240 const Index* SymTMatrix::Irows() const
241 {
242 return owner_space_->Irows();
243 }
244
245 inline
246 const Index* SymTMatrix::Jcols() const
247 {
248 return owner_space_->Jcols();
249 }
250
251
252 } // namespace Ipopt
253 #endif
Ipopt::SymTMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::SymTMatrixSpace::jCols_
Index * jCols_
Definition: IpSymTMatrix.hpp:227
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::SymTMatrixSpace::AllocateInternalStorage
Number * AllocateInternalStorage() const
Allocate internal storage for the SymTMatrix values.
IpUtils.hpp
ipfint
FORTRAN_INTEGER_TYPE ipfint
Definition: IpTypes.hpp:26
IpSymMatrix.hpp
Ipopt::SymTMatrixSpace::nonZeros_
const Index nonZeros_
Definition: IpSymTMatrix.hpp:225
Ipopt::SymTMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Ipopt::SymTMatrixSpace::iRows_
Index * iRows_
Definition: IpSymTMatrix.hpp:226
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::SymTMatrixSpace::MakeNewSymMatrix
virtual SymMatrix * MakeNewSymMatrix() const
Overloaded MakeNew method for the sYMMatrixSpace base class.
Definition: IpSymTMatrix.hpp:183
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::SymTMatrix::FillStruct
void FillStruct(ipfint *Irn, ipfint *Jcn) const
Copy the nonzero structure into provided space.
Ipopt::SymTMatrixSpace::MakeNewSymTMatrix
SymTMatrix * MakeNewSymTMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpSymTMatrix.hpp:189
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:23
Ipopt::SymTMatrix::Irows
const Index * Irows() const
Obtain pointer to the internal Index array irn_ without the intention to change the matrix data (USE ...
Definition: IpSymTMatrix.hpp:240
Ipopt::SymTMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::SymTMatrix::Nonzeros
Index Nonzeros() const
Number of nonzero entries.
Definition: IpSymTMatrix.hpp:234
Ipopt::SymTMatrix::~SymTMatrix
~SymTMatrix()
Destructor.
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::SymTMatrixSpace::Jcols
const Index * Jcols() const
Column index of each non-zero element.
Definition: IpSymTMatrix.hpp:209
Ipopt::SymTMatrixSpace::Nonzeros
Index Nonzeros() const
Number of non-zeros in the sparse matrix.
Definition: IpSymTMatrix.hpp:197
Ipopt::SymTMatrix::SetValues
void SetValues(const Number *Values)
Set values of nonzero elements.
Ipopt::SymTMatrix::operator=
void operator=(const SymTMatrix &)
Overloaded Equals Operator.
Ipopt::SymMatrixSpace
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:81
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::SymTMatrix::Jcols
const Index * Jcols() const
Obtain pointer to the internal Index array jcn_ without the intention to change the matrix data (USE ...
Definition: IpSymTMatrix.hpp:246
Ipopt::SymTMatrix
Class for symmetric matrices stored in triplet format.
Definition: IpSymTMatrix.hpp:42
Ipopt::SymTMatrixSpace::Irows
const Index * Irows() const
Row index of each non-zero element.
Definition: IpSymTMatrix.hpp:203
Ipopt::SymTMatrix::owner_space_
const SymTMatrixSpace * owner_space_
Copy of the owner_space ptr as a SymTMatrixSpace insteaqd of a MatrixSpace.
Definition: IpSymTMatrix.hpp:147
Ipopt::SymTMatrixSpace::SymTMatrix
friend class SymTMatrix
Definition: IpSymTMatrix.hpp:229
Ipopt::SymTMatrix::Values
Number * Values()
Obtain pointer to the internal Number array values_ with the intention to change the matrix data (USE...
Ipopt::SymTMatrix::FillValues
void FillValues(Number *Values) const
Copy the value data into provided space.
Ipopt::SymTMatrixSpace
This is the matrix space for a SymTMatrix with fixed sparsity structure.
Definition: IpSymTMatrix.hpp:161
Ipopt::SymTMatrix::PrintImpl
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Print detailed information about the matrix.
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::SymTMatrixSpace::~SymTMatrixSpace
~SymTMatrixSpace()
Destructor.
Ipopt::SymTMatrix::initialized_
bool initialized_
Flag for Initialization.
Definition: IpSymTMatrix.hpp:153
Ipopt::SymTMatrix::SymTMatrix
SymTMatrix()
Default Constructor.
Ipopt::SymTMatrix::values_
Number * values_
Values of nonzeros.
Definition: IpSymTMatrix.hpp:150
Ipopt::SymTMatrixSpace::FreeInternalStorage
void FreeInternalStorage(Number *values) const
Deallocate internal storage for the SymTMatrix values.
Ipopt::SymTMatrixSpace::SymTMatrixSpace
SymTMatrixSpace(Index dim, Index nonZeros, const Index *iRows, const Index *jCols)
Constructor, given the number of rows and columns (both as dim), as well as the number of nonzeros an...