Ipopt Documentation  
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 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6 
7 #ifndef __IPSYMMATRIX_HPP__
8 #define __IPSYMMATRIX_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpMatrix.hpp"
12 
13 namespace Ipopt
14 {
15 
16 /* forward declarations */
17 class SymMatrixSpace;
18 
21 {
22 public:
27  inline SymMatrix(
28  const SymMatrixSpace* owner_space
29  );
30 
32  virtual ~SymMatrix()
33  { }
35 
39  inline Index Dim() const;
41 
42  inline SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const;
43 
44 protected:
53  virtual void TransMultVectorImpl(
54  Number alpha,
55  const Vector& x,
56  Number beta,
57  Vector& y
58  ) const
59  {
60  // Since this matrix is symmetric, this is the same operation as MultVector
61  MultVector(alpha, x, beta, y);
62  }
63 
68  virtual void ComputeColAMaxImpl(
69  Vector& cols_norms,
70  bool init
71  ) const
72  {
73  ComputeRowAMaxImpl(cols_norms, init);
74  }
76 
77 private:
82 };
83 
86 {
87 public:
94  Index dim
95  )
96  : MatrixSpace(dim, dim)
97  { }
98 
100  virtual ~SymMatrixSpace()
101  { }
103 
105  virtual SymMatrix* MakeNewSymMatrix() const = 0;
106 
107  virtual Matrix* MakeNew() const
108  {
109  return MakeNewSymMatrix();
110  }
111 
115  Index Dim() const
116  {
117  DBG_ASSERT(NRows() == NCols());
118  return NRows();
119  }
120 
121 private:
133 
134  /* Copy constructor */
136  const SymMatrixSpace&
137  );
138 
141  const SymMatrixSpace&
142  );
144 
145 };
146 
147 /* inline methods */
149  const SymMatrixSpace* owner_space
150 )
151  : Matrix(owner_space),
152  owner_space_(owner_space)
153 { }
154 
155 inline Index SymMatrix::Dim() const
156 {
157  return owner_space_->Dim();
158 }
159 
161 {
162  return owner_space_;
163 }
164 
165 } // namespace Ipopt
166 
167 #endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:327
Matrix Base Class.
Definition: IpMatrix.hpp:28
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:86
virtual SymMatrix * MakeNewSymMatrix() const =0
Pure virtual method for creating a new matrix of this specific type.
Index Dim() const
Accessor method for the dimension of the matrices in this matrix space.
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
SymMatrixSpace(Index dim)
Constructor, given the dimension (identical to the number of rows and columns).
Definition: IpSymMatrix.hpp:93
SymMatrixSpace & operator=(const SymMatrixSpace &)
Default Assignment Operator.
SymMatrixSpace(const SymMatrixSpace &)
SymMatrixSpace()
Default constructor.
virtual ~SymMatrixSpace()
Destructor.
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:21
virtual ~SymMatrix()
Destructor.
Definition: IpSymMatrix.hpp:32
SmartPtr< const SymMatrixSpace > OwnerSymMatrixSpace() const
const SymMatrixSpace * owner_space_
Copy of the owner space ptr as a SymMatrixSpace instead of a MatrixSpace.
Definition: IpSymMatrix.hpp:81
SymMatrix(const SymMatrixSpace *owner_space)
Constructor, taking the owner_space.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Implementation of ComputeColAMaxImpl, which calls ComputeRowAMaxImpl.
Definition: IpSymMatrix.hpp:68
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
Implementation of TransMultVectorImpl, which calls MultVectorImpl.
Definition: IpSymMatrix.hpp:53
Vector Base Class.
Definition: IpVector.hpp:48
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
double Number
Type of all numbers.
Definition: IpTypes.hpp:15