Ipopt Documentation  
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
FORTRAN_INTEGER_TYPE ipfint
Definition: IpTypes.hpp:24
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Vector Base Class.
Definition: IpVector.hpp:47
virtual SymMatrix * MakeNewSymMatrix() const
Pure virtual method for creating a new matrix of this specific type.
EJournalLevel
Print Level Enum.
SymTMatrix * MakeNewSymTMatrix() const
Method for creating a new matrix of this specific type.
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:20
const Index * Irows() const
Obtain pointer to the internal Index array irn_ without the intention to change the matrix data...
Index Nonzeros() const
Number of nonzero entries.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
const Index * Jcols() const
Column index of each non-zero element.
Index Nonzeros() const
Number of non-zeros in the sparse matrix.
#define IPOPTLIB_EXPORT
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:85
Class responsible for all message output.
const Index * Jcols() const
Obtain pointer to the internal Index array jcn_ without the intention to change the matrix data...
Class for symmetric matrices stored in triplet format.
const Index * Irows() const
Row index of each non-zero element.
const SymTMatrixSpace * owner_space_
Copy of the owner_space ptr as a SymTMatrixSpace instead of a MatrixSpace.
This is the matrix space for a SymTMatrix with fixed sparsity structure.
EJournalCategory
Category Selection Enum.
bool initialized_
Flag for Initialization.
Number * values_
Values of nonzeros.