Ipopt 3.11.9
Loading...
Searching...
No Matches
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 2161 2013-01-01 20:39:05Z 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
15namespace 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
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:
76 };
77
78
82 {
83 public:
90 :
91 MatrixSpace(dim,dim)
92 {}
93
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:
130
131 /* Copy constructor */
133
137
138 };
139
140 /* inline methods */
141 inline
143 :
144 Matrix(owner_space),
145 owner_space_(owner_space)
146 {}
147
148 inline
150 {
151 return owner_space_->Dim();
152 }
153
154 inline
159
160} // namespace Ipopt
161
162#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:38
Number * x
Input: Starting point Output: Optimal solution.
MatrixSpace base class, corresponding to the Matrix base class.
Definition IpMatrix.hpp:240
Index NCols() const
Accessor function for the number of columns.
Definition IpMatrix.hpp:269
Index NRows() const
Accessor function for the number of rows.
Definition IpMatrix.hpp:264
Matrix Base Class.
Definition IpMatrix.hpp:28
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const =0
Compute the max-norm of the rows in the matrix.
void MultVector(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition IpMatrix.hpp:52
Template class for Smart Pointers.
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Index Dim() const
Accessor method for the dimension of the matrices in this matrix space.
SymMatrixSpace(Index dim)
Constructor, given the dimension (identical to the number of rows and columns).
SymMatrixSpace & operator=(const SymMatrixSpace &)
Overloaded Equals Operator.
SymMatrixSpace(const SymMatrixSpace &)
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
SymMatrixSpace()
default constructor
virtual SymMatrix * MakeNewSymMatrix() const =0
Pure virtual method for creating a new matrix of this specific type.
virtual ~SymMatrixSpace()
Destructor.
This is the base class for all derived symmetric matrix types.
virtual ~SymMatrix()
Destructor.
SmartPtr< const SymMatrixSpace > OwnerSymMatrixSpace() const
const SymMatrixSpace * owner_space_
Copy of the owner space ptr as a SymMatrixSpace instead of a MatrixSpace.
SymMatrix(const SymMatrixSpace *owner_space)
Constructor, taking the owner_space.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Since the matrix is symmetric, the row and column max norms are identical.
Index Dim() const
Dimension of the matrix (number of rows and columns)
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...
Vector Base Class.
Definition IpVector.hpp:48
int Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:19
double Number
Type of all numbers.
Definition IpTypes.hpp:17