Ipopt Documentation  
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 
13 namespace Ipopt
14 {
15 
16 /* forward declarations */
17 class SymTMatrixSpace;
18 
40 {
41 public:
45  SymTMatrix(
46  const SymTMatrixSpace* owner_space
47  );
48 
50  ~SymTMatrix();
52 
62  void SetValues(
63  const Number* Values
64  );
66 
70  Index Nonzeros() const;
71 
77  const Index* Irows() const;
78 
84  const Index* Jcols() const;
85 
91  Number* Values();
92 
98  const Number* Values() const;
100 
104  void FillStruct(
105  ipfint* Irn,
106  ipfint* Jcn
107  ) const;
108 
110  void FillValues(
111  Number* Values
112  ) const;
114 
115 protected:
118  virtual void MultVectorImpl(
119  Number alpha,
120  const Vector& x,
121  Number beta,
122  Vector& y
123  ) const;
124 
125  virtual bool HasValidNumbersImpl() const;
126 
127  virtual void ComputeRowAMaxImpl(
128  Vector& rows_norms,
129  bool init
130  ) const;
131 
132  virtual void PrintImpl(
133  const Journalist& jnlst,
134  EJournalLevel level,
135  EJournalCategory category,
136  const std::string& name,
137  Index indent,
138  const std::string& prefix
139  ) const;
141 
142 private:
153  SymTMatrix();
154 
156  SymTMatrix(
157  const SymTMatrix&
158  );
159 
161  void operator=(
162  const SymTMatrix&
163  );
165 
170 
173 
176 };
177 
184 {
185 public:
197  Index dim,
198  Index nonZeros,
199  const Index* iRows,
200  const Index* jCols
201  );
202 
204  ~SymTMatrixSpace();
206 
207  virtual SymMatrix* MakeNewSymMatrix() const
208  {
209  return MakeNewSymTMatrix();
210  }
211 
214  {
215  return new SymTMatrix(this);
216  }
217 
221  Index Nonzeros() const
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 
239 private:
243  Number* AllocateInternalStorage() const;
244 
246  void FreeInternalStorage(
247  Number* values
248  ) const;
250 
254 
255  friend class SymTMatrix;
256 };
257 
258 /* Inline Methods */
260 {
261  return owner_space_->Nonzeros();
262 }
263 
264 inline const Index* SymTMatrix::Irows() const
265 {
266  return owner_space_->Irows();
267 }
268 
269 inline const Index* SymTMatrix::Jcols() const
270 {
271  return owner_space_->Jcols();
272 }
273 
274 } // namespace Ipopt
275 #endif
IpUtils.hpp
Ipopt::SymTMatrix::Jcols
const Index * Jcols() const
Obtain pointer to the internal Index array jcn_ without the intention to change the matrix data.
Definition: IpSymTMatrix.hpp:269
Ipopt::SymTMatrixSpace::Nonzeros
Index Nonzeros() const
Number of non-zeros in the sparse matrix.
Definition: IpSymTMatrix.hpp:221
Ipopt::SymTMatrixSpace::jCols_
Index * jCols_
Definition: IpSymTMatrix.hpp:253
Ipopt::SymTMatrixSpace
This is the matrix space for a SymTMatrix with fixed sparsity structure.
Definition: IpSymTMatrix.hpp:183
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:13
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Ipopt::SymTMatrixSpace::nonZeros_
const Index nonZeros_
Definition: IpSymTMatrix.hpp:251
Ipopt::SymTMatrix::initialized_
bool initialized_
Flag for Initialization.
Definition: IpSymTMatrix.hpp:175
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:31
Ipopt::SymTMatrixSpace::iRows_
Index * iRows_
Definition: IpSymTMatrix.hpp:252
Ipopt::SymTMatrixSpace::Irows
const Index * Irows() const
Row index of each non-zero element.
Definition: IpSymTMatrix.hpp:227
IPOPTLIB_EXPORT
#define IPOPTLIB_EXPORT
Definition: config_default.h:16
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Ipopt::SymTMatrix::Nonzeros
Index Nonzeros() const
Number of nonzero entries.
Definition: IpSymTMatrix.hpp:259
Ipopt::SymTMatrix::owner_space_
const SymTMatrixSpace * owner_space_
Copy of the owner_space ptr as a SymTMatrixSpace instead of a MatrixSpace.
Definition: IpSymTMatrix.hpp:169
ipfint
FORTRAN_INTEGER_TYPE ipfint
Definition: IpTypes.hpp:24
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:51
Ipopt::SymTMatrixSpace::MakeNewSymMatrix
virtual SymMatrix * MakeNewSymMatrix() const
Pure virtual method for creating a new matrix of this specific type.
Definition: IpSymTMatrix.hpp:207
IpSymMatrix.hpp
Ipopt::SymTMatrix::values_
Number * values_
Values of nonzeros.
Definition: IpSymTMatrix.hpp:172
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:116
Ipopt::SymTMatrix
Class for symmetric matrices stored in triplet format.
Definition: IpSymTMatrix.hpp:39
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:20
Ipopt::SymTMatrixSpace::MakeNewSymTMatrix
SymTMatrix * MakeNewSymTMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpSymTMatrix.hpp:213
Ipopt::SymMatrixSpace
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:85
Ipopt::SymTMatrix::Irows
const Index * Irows() const
Obtain pointer to the internal Index array irn_ without the intention to change the matrix data.
Definition: IpSymTMatrix.hpp:264
Ipopt::SymTMatrixSpace::Jcols
const Index * Jcols() const
Column index of each non-zero element.
Definition: IpSymTMatrix.hpp:233
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47