Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpSymMatrix.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: IpSymMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPSYMMATRIX_HPP__
10 #define __IPSYMMATRIX_HPP__
11
12 #include "IpUtils.hpp"
13 #include "IpMatrix.hpp"
14
15 namespace Ipopt
16 {
17
18 /* forward declarations */
19 class SymMatrixSpace;
20
23 class SymMatrix : public Matrix
24 {
25 public:
30 inline
31 SymMatrix(const SymMatrixSpace* owner_space);
32
34 virtual ~SymMatrix()
35 {}
37
41 inline
42 Index Dim() const;
44
45 inline
46 SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const;
47
48 protected:
56 virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta,
57 Vector& y) const
58 {
59 // Since this matrix is symetric, this is the same operation as
60 // MultVector
61 MultVector(alpha, x, beta, y);
62 }
65 virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const
66 {
67 ComputeRowAMaxImpl(cols_norms, init);
68 }
70
71 private:
75 const SymMatrixSpace* owner_space_;
76 };
77
78
81 class SymMatrixSpace : public MatrixSpace
82 {
83 public:
89 SymMatrixSpace(Index dim)
90 :
91 MatrixSpace(dim,dim)
92 {}
93
95 virtual ~SymMatrixSpace()
96 {}
98
101 virtual SymMatrix* MakeNewSymMatrix() const=0;
102
105 virtual Matrix* MakeNew() const
106 {
107 return MakeNewSymMatrix();
108 }
109
113 Index Dim() const
114 {
115 DBG_ASSERT(NRows() == NCols());
116 return NRows();
117 }
118
119 private:
129 SymMatrixSpace();
130
131 /* Copy constructor */
132 SymMatrixSpace(const SymMatrixSpace&);
133
135 SymMatrixSpace& operator=(const SymMatrixSpace&);
137
138 };
139
140 /* inline methods */
141 inline
142 SymMatrix::SymMatrix(const SymMatrixSpace* owner_space)
143 :
144 Matrix(owner_space),
145 owner_space_(owner_space)
146 {}
147
148 inline
149 Index SymMatrix::Dim() const
150 {
151 return owner_space_->Dim();
152 }
153
154 inline
155 SmartPtr<const SymMatrixSpace> SymMatrix::OwnerSymMatrixSpace() const
156 {
157 return owner_space_;
158 }
159
160 } // namespace Ipopt
161
162 #endif
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
IpUtils.hpp
Ipopt::SymMatrix::OwnerSymMatrixSpace
SmartPtr< const SymMatrixSpace > OwnerSymMatrixSpace() const
Definition: IpSymMatrix.hpp:155
Ipopt::Matrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const =0
Compute the max-norm of the rows in the matrix.
Ipopt::SymMatrixSpace::SymMatrixSpace
SymMatrixSpace(Index dim)
Constructor, given the dimension (identical to the number of rows and columns).
Definition: IpSymMatrix.hpp:89
Ipopt::SymMatrixSpace::MakeNewSymMatrix
virtual SymMatrix * MakeNewSymMatrix() const =0
Pure virtual method for creating a new matrix of this specific type.
Ipopt::SymMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Definition: IpSymMatrix.hpp:105
Ipopt::MatrixSpace::NRows
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:264
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::SymMatrix::SymMatrix
SymMatrix(const SymMatrixSpace *owner_space)
Constructor, taking the owner_space.
Definition: IpSymMatrix.hpp:142
IpMatrix.hpp
Ipopt::SymMatrixSpace::SymMatrixSpace
SymMatrixSpace()
default constructor
Ipopt::SymMatrix
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:23
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
Ipopt::SymMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Since the matrix is symmetric, the row and column max norms are identical.
Definition: IpSymMatrix.hpp:65
Ipopt::SymMatrix::owner_space_
const SymMatrixSpace * owner_space_
Copy of the owner space ptr as a SymMatrixSpace instead of a MatrixSpace.
Definition: IpSymMatrix.hpp:75
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Ipopt::SymMatrixSpace::Dim
Index Dim() const
Accessor method for the dimension of the matrices in this matrix space.
Definition: IpSymMatrix.hpp:113
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::SymMatrixSpace::~SymMatrixSpace
virtual ~SymMatrixSpace()
Destructor.
Definition: IpSymMatrix.hpp:95
Ipopt::SymMatrixSpace
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:81
Ipopt::SymMatrix::~SymMatrix
virtual ~SymMatrix()
Destructor.
Definition: IpSymMatrix.hpp:34
Ipopt::SymMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Since the matrix is symmetric, it is only necessary to implement the MultVectorImpl method in a class...
Definition: IpSymMatrix.hpp:56
Ipopt::Matrix::MultVector
void MultVector(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition: IpMatrix.hpp:52
Ipopt::SymMatrix::Dim
Index Dim() const
Dimension of the matrix (number of rows and columns)
Definition: IpSymMatrix.hpp:149
Ipopt::SymMatrixSpace::operator=
SymMatrixSpace & operator=(const SymMatrixSpace &)
Overloaded Equals Operator.
Ipopt::MatrixSpace::NCols
Index NCols() const
Accessor function for the number of columns.
Definition: IpMatrix.hpp:269