Ipopt Documentation  
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
27  DiagMatrix(
28  const SymMatrixSpace* owner_space
29  );
30 
32  ~DiagMatrix();
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:
86  DiagMatrix();
87 
89  DiagMatrix(
90  const DiagMatrix&
91  );
92 
94  void operator=(
95  const DiagMatrix&
96  );
98 
101 };
102 
105 {
106 public:
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:
142  DiagMatrixSpace();
143 
146  const DiagMatrixSpace&
147  );
148 
150  void operator=(
151  const DiagMatrixSpace&
152  );
154 
155 };
156 
157 } // namespace Ipopt
158 #endif
SmartPtr< const Vector > GetDiag() const
Get the diagonal elements.
Class for diagonal matrices.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Vector Base Class.
Definition: IpVector.hpp:47
void SetDiag(const Vector &diag)
Set the diagonal elements (as a Vector).
EJournalLevel
Print Level Enum.
virtual ~DiagMatrixSpace()
Destructor.
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:20
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
#define IPOPTLIB_EXPORT
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:85
SmartPtr< const Vector > diag_
Vector storing the diagonal elements.
Class responsible for all message output.
DiagMatrixSpace(Index dim)
Constructor, given the dimension of the matrix.
DiagMatrix * MakeNewDiagMatrix() const
Method for creating a new matrix of this specific type.
virtual SymMatrix * MakeNewSymMatrix() const
Pure virtual method for creating a new matrix of this specific type.
This is the matrix space for DiagMatrix.
EJournalCategory
Category Selection Enum.