Ipopt Documentation  
 
Loading...
Searching...
No Matches
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// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6
7#ifndef __IPSYMTMATRIX_HPP__
8#define __IPSYMTMATRIX_HPP__
9
10#include "IpUtils.hpp"
11#include "IpSymMatrix.hpp"
12
13namespace Ipopt
14{
15
16/* forward declarations */
17class SymTMatrixSpace;
18
40{
41public:
44
47 );
48
52
55
63 const Number* Values
64 );
66
69
70 Index Nonzeros() const;
71
77 const Index* Irows() const;
78
84 const Index* Jcols() const;
85
92
98 const Number* Values() const;
100
103
105 Index* Irn,
106 Index* Jcn
107 ) const;
108
111 Number* Values
112 ) const;
114
115protected:
118 virtual void MultVectorImpl(
120 const Vector& x,
121 Number beta,
122 Vector& y
123 ) const;
124
125 virtual bool HasValidNumbersImpl() const;
126
127 virtual void ComputeRowAMaxImpl(
129 bool init
130 ) const;
131
132 virtual void PrintImpl(
133 const Journalist& jnlst,
136 const std::string& name,
138 const std::string& prefix
139 ) const;
141
142private:
152
154
157 const SymTMatrix&
158 );
159
162 const SymTMatrix&
163 );
165
170
173
176};
177
184{
185public:
188
197 Index dim,
199 const Index* iRows,
200 const Index* jCols
201 );
202
206
208 {
209 return MakeNewSymTMatrix();
210 }
211
214 {
215 return new SymTMatrix(this);
216 }
217
220
222 {
223 return nonZeros_;
224 }
225
227 const Index* Irows() const
228 {
229 return iRows_;
230 }
231
233 const Index* Jcols() const
234 {
235 return jCols_;
236 }
238
239private:
242
244
248 ) const;
250
254
255 friend class SymTMatrix;
256};
257
258/* Inline Methods */
260{
261 return owner_space_->Nonzeros();
262}
263
264inline const Index* SymTMatrix::Irows() const
265{
266 return owner_space_->Irows();
267}
268
269inline const Index* SymTMatrix::Jcols() const
270{
271 return owner_space_->Jcols();
272}
273
274} // namespace Ipopt
275#endif
Templated class which stores one entry for the CachedResult class.
Class responsible for all message output.
SymMatrixSpace base class, corresponding to the SymMatrix base class.
This is the base class for all derived symmetric matrix types.
This is the matrix space for a SymTMatrix with fixed sparsity structure.
Index Nonzeros() const
Number of non-zeros in the sparse matrix.
void FreeInternalStorage(Number *values) const
Deallocate internal storage for the SymTMatrix values.
~SymTMatrixSpace()
Destructor.
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...
const Index * Irows() const
Row index of each non-zero element.
virtual SymMatrix * MakeNewSymMatrix() const
Pure virtual method for creating a new matrix of this specific type.
SymTMatrix * MakeNewSymTMatrix() const
Method for creating a new matrix of this specific type.
const Index * Jcols() const
Column index of each non-zero element.
Number * AllocateInternalStorage() const
Allocate internal storage for the SymTMatrix values.
Class for symmetric matrices stored in triplet format.
void operator=(const SymTMatrix &)
Default Assignment Operator.
const Index * Jcols() const
Obtain pointer to the internal Index array jcn_ without the intention to change the matrix data.
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.
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
const SymTMatrixSpace * owner_space_
Copy of the owner_space ptr as a SymTMatrixSpace instead of a MatrixSpace.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
const Number * Values() const
Obtain pointer to the internal Number array values_ without the intention to change the matrix data.
Index Nonzeros() const
Number of nonzero entries.
Number * values_
Values of nonzeros.
void FillStruct(Index *Irn, Index *Jcn) const
Copy the nonzero structure into provided space.
~SymTMatrix()
Destructor.
const Index * Irows() const
Obtain pointer to the internal Index array irn_ without the intention to change the matrix data.
Number * Values()
Obtain pointer to the internal Number array values_ with the intention to change the matrix data.
SymTMatrix(const SymTMatrixSpace *owner_space)
Constructor, taking the corresponding matrix space.
bool initialized_
Flag for Initialization.
SymTMatrix()
Default Constructor.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
void SetValues(const Number *Values)
Set values of nonzero elements.
void FillValues(Number *Values) const
Copy the value data into provided space.
SymTMatrix(const SymTMatrix &)
Copy Constructor.
Vector Base Class.
Definition IpVector.hpp:48
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
EJournalCategory
Category Selection Enum.
EJournalLevel
Print Level Enum.
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17