Ipopt Documentation  
IpDiagMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2008 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 __IPDIAGMATRIX_HPP__
8 #define __IPDIAGMATRIX_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpSymMatrix.hpp"
12 
13 namespace Ipopt
14 {
15 
21 {
22 public:
23 
26 
28  const SymMatrixSpace* owner_space
29  );
30 
34 
36  void SetDiag(
37  const Vector& diag
38  )
39  {
40  diag_ = &diag;
41  }
42 
45  {
46  return diag_;
47  }
48 
49 protected:
52  virtual void MultVectorImpl(
53  Number alpha,
54  const Vector& x,
55  Number beta,
56  Vector& y
57  ) const;
58 
59  virtual bool HasValidNumbersImpl() const;
60 
61  virtual void ComputeRowAMaxImpl(
62  Vector& rows_norms,
63  bool init
64  ) const;
65 
66  virtual void PrintImpl(
67  const Journalist& jnlst,
68  EJournalLevel level,
69  EJournalCategory category,
70  const std::string& name,
71  Index indent,
72  const std::string& prefix
73  ) const;
75 
76 private:
85 
87 
90  const DiagMatrix&
91  );
92 
94  void operator=(
95  const DiagMatrix&
96  );
98 
101 };
102 
105 {
106 public:
109 
111  Index dim
112  )
113  : SymMatrixSpace(dim)
114  { }
115 
118  { }
120 
121  virtual SymMatrix* MakeNewSymMatrix() const
122  {
123  return MakeNewDiagMatrix();
124  }
125 
128  {
129  return new DiagMatrix(this);
130  }
131 
132 private:
141 
143 
146  const DiagMatrixSpace&
147  );
148 
150  void operator=(
151  const DiagMatrixSpace&
152  );
154 
155 };
156 
157 } // namespace Ipopt
158 #endif
This is the matrix space for DiagMatrix.
virtual SymMatrix * MakeNewSymMatrix() const
Pure virtual method for creating a new matrix of this specific type.
DiagMatrix * MakeNewDiagMatrix() const
Method for creating a new matrix of this specific type.
DiagMatrixSpace(Index dim)
Constructor, given the dimension of the matrix.
DiagMatrixSpace(const DiagMatrixSpace &)
Copy Constructor.
DiagMatrixSpace()
Default Constructor.
void operator=(const DiagMatrixSpace &)
Default Assignment Operator.
virtual ~DiagMatrixSpace()
Destructor.
Class for diagonal matrices.
DiagMatrix()
Default Constructor.
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.
DiagMatrix(const SymMatrixSpace *owner_space)
Constructor, given the corresponding matrix space.
SmartPtr< const Vector > GetDiag() const
Get the diagonal elements.
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
void operator=(const DiagMatrix &)
Default Assignment Operator.
~DiagMatrix()
Destructor.
void SetDiag(const Vector &diag)
Set the diagonal elements (as a Vector).
SmartPtr< const Vector > diag_
Vector storing the diagonal elements.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
DiagMatrix(const DiagMatrix &)
Copy Constructor.
Class responsible for all message output.
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:86
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:21
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.
EJournalCategory
Category Selection Enum.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
EJournalLevel
Print Level Enum.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15