Ipopt  3.12.10
IpSymMatrix.hpp
Go to the documentation of this file.
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
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
81  class SymMatrixSpace : public MatrixSpace
82  {
83  public:
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 */
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
156  {
157  return owner_space_;
158  }
159
160 } // namespace Ipopt
161
162 #endif
Number * x
Input: Starting point Output: Optimal solution.
SmartPtr< const SymMatrixSpace > OwnerSymMatrixSpace() const
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const =0
Compute the max-norm of the rows in the matrix.
SymMatrixSpace(Index dim)
Constructor, given the dimension (identical to the number of rows and columns).
Definition: IpSymMatrix.hpp:89
virtual SymMatrix * MakeNewSymMatrix() const =0
Pure virtual method for creating a new matrix of this specific type.
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:264
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Vector Base Class.
Definition: IpVector.hpp:47
SymMatrix(const SymMatrixSpace *owner_space)
Constructor, taking the owner_space.
SymMatrixSpace()
default constructor
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:23
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Matrix Base Class.
Definition: IpMatrix.hpp:27
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
const SymMatrixSpace * owner_space_
Copy of the owner space ptr as a SymMatrixSpace instead of a MatrixSpace.
Definition: IpSymMatrix.hpp:75
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Index Dim() const
Accessor method for the dimension of the matrices in this matrix space.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
virtual ~SymMatrixSpace()
Destructor.
Definition: IpSymMatrix.hpp:95
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:81
virtual ~SymMatrix()
Destructor.
Definition: IpSymMatrix.hpp:34
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
void MultVector(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition: IpMatrix.hpp:52
Index Dim() const
Dimension of the matrix (number of rows and columns)
SymMatrixSpace & operator=(const SymMatrixSpace &)