Ipopt  3.12.13
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 // $Id$
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPDIAGMATRIX_HPP__
10 #define __IPDIAGMATRIX_HPP__
11 
12 #include "IpUtils.hpp"
13 #include "IpSymMatrix.hpp"
14 
15 namespace Ipopt
16 {
17 
20  class DiagMatrix : public SymMatrix
21  {
22  public:
23 
26 
28  DiagMatrix(const SymMatrixSpace* owner_space);
29 
31  ~DiagMatrix();
33 
35  void SetDiag(const Vector& diag)
36  {
37  diag_ = &diag;
38  }
39 
42  {
43  return diag_;
44  }
45 
46  protected:
49  virtual void MultVectorImpl(Number alpha, const Vector& x,
50  Number beta, Vector& y) const;
51 
54  virtual bool HasValidNumbersImpl() const;
55 
56  virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
57 
58  virtual void PrintImpl(const Journalist& jnlst,
59  EJournalLevel level,
60  EJournalCategory category,
61  const std::string& name,
62  Index indent,
63  const std::string& prefix) const;
65 
66  private:
76  DiagMatrix();
77 
79  DiagMatrix(const DiagMatrix&);
80 
82  void operator=(const DiagMatrix&);
84 
87  };
88 
91  {
92  public:
97  :
98  SymMatrixSpace(dim)
99  {}
100 
103  {}
105 
108  virtual SymMatrix* MakeNewSymMatrix() const
109  {
110  return MakeNewDiagMatrix();
111  }
112 
115  {
116  return new DiagMatrix(this);
117  }
118 
119  private:
129  DiagMatrixSpace();
130 
133 
135  void operator=(const DiagMatrixSpace&);
137 
138  };
139 
140 } // namespace Ipopt
141 #endif
Ipopt::DiagMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
IpUtils.hpp
Ipopt::DiagMatrixSpace
This is the matrix space for DiagMatrix.
Definition: IpDiagMatrix.hpp:90
Ipopt::DiagMatrixSpace::DiagMatrixSpace
DiagMatrixSpace()
Default Constructor.
Ipopt::DiagMatrix::SetDiag
void SetDiag(const Vector &diag)
Method for setting the diagonal elements (as a Vector).
Definition: IpDiagMatrix.hpp:35
Ipopt::DiagMatrix::diag_
SmartPtr< const Vector > diag_
Vector storing the diagonal elements.
Definition: IpDiagMatrix.hpp:86
Ipopt::DiagMatrixSpace::~DiagMatrixSpace
virtual ~DiagMatrixSpace()
Destructor.
Definition: IpDiagMatrix.hpp:102
Ipopt
Definition: matlabjournal.hpp:14
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::DiagMatrix::DiagMatrix
DiagMatrix()
Default Constructor.
Ipopt::DiagMatrixSpace::MakeNewSymMatrix
virtual SymMatrix * MakeNewSymMatrix() const
Overloaded MakeNew method for the SymMatrixSpace base class.
Definition: IpDiagMatrix.hpp:108
Ipopt::DiagMatrix::~DiagMatrix
~DiagMatrix()
Destructor.
Ipopt::DiagMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::DiagMatrix::GetDiag
SmartPtr< const Vector > GetDiag() const
Method for setting the diagonal elements.
Definition: IpDiagMatrix.hpp:41
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::DiagMatrixSpace::MakeNewDiagMatrix
DiagMatrix * MakeNewDiagMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpDiagMatrix.hpp:114
IpSymMatrix.hpp
Ipopt::DiagMatrixSpace::operator=
void operator=(const DiagMatrixSpace &)
Overloaded Equals Operator.
Ipopt::DiagMatrix
Class for diagonal matrices.
Definition: IpDiagMatrix.hpp:20
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:23
Ipopt::SymMatrixSpace
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:81
Ipopt::DiagMatrix::operator=
void operator=(const DiagMatrix &)
Overloaded Equals Operator.
Ipopt::DiagMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::DiagMatrix::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::DiagMatrixSpace::DiagMatrixSpace
DiagMatrixSpace(Index dim)
Constructor, given the dimension of the matrix.
Definition: IpDiagMatrix.hpp:96