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:
46  const SymTMatrixSpace* owner_space
47  );
48 
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 
92 
98  const Number* Values() const;
100 
105  ipfint* Irn,
106  ipfint* Jcn
107  ) const;
108 
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:
154 
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 
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:
244 
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::SymTMatrix::FillValues
void FillValues(Number *Values) const
Copy the value data into provided space.
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::SymTMatrix::Values
const Number * Values() const
Obtain pointer to the internal Number array values_ without the intention to change the matrix data.
Ipopt::SymTMatrixSpace::FreeInternalStorage
void FreeInternalStorage(Number *values) const
Deallocate internal storage for the SymTMatrix values.
Ipopt::SymTMatrixSpace
This is the matrix space for a SymTMatrix with fixed sparsity structure.
Definition: IpSymTMatrix.hpp:184
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:14
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::SymTMatrix::Values
Number * Values()
Obtain pointer to the internal Number array values_ with the intention to change the matrix data.
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:32
Ipopt::SymTMatrixSpace::iRows_
Index * iRows_
Definition: IpSymTMatrix.hpp:252
Ipopt::SymTMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
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::SymTMatrix::~SymTMatrix
~SymTMatrix()
Destructor.
Ipopt::SymTMatrix::SymTMatrix
SymTMatrix(const SymTMatrixSpace *owner_space)
Constructor, taking the corresponding matrix space.
Ipopt::SymTMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Ipopt::SymTMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
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::SymTMatrixSpace::AllocateInternalStorage
Number * AllocateInternalStorage() const
Allocate internal storage for the SymTMatrix values.
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
Ipopt::SymTMatrix::operator=
void operator=(const SymTMatrix &)
Default Assignment Operator.
Ipopt::SymTMatrix::SetValues
void SetValues(const Number *Values)
Set values of nonzero elements.
ipfint
FORTRAN_INTEGER_TYPE ipfint
Definition: IpTypes.hpp:24
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:52
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:117
Ipopt::SymTMatrix
Class for symmetric matrices stored in triplet format.
Definition: IpSymTMatrix.hpp:40
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:21
Ipopt::SymTMatrix::SymTMatrix
SymTMatrix()
Default Constructor.
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:86
Ipopt::SymTMatrixSpace::~SymTMatrixSpace
~SymTMatrixSpace()
Destructor.
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::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::SymTMatrix::SymTMatrix
SymTMatrix(const SymTMatrix &)
Copy Constructor.
Ipopt::SymTMatrixSpace::Jcols
const Index * Jcols() const
Column index of each non-zero element.
Definition: IpSymTMatrix.hpp:233
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...
Ipopt::SymTMatrix::FillStruct
void FillStruct(ipfint *Irn, ipfint *Jcn) const
Copy the nonzero structure into provided space.
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:48