Ipopt  3.11.8
 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 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 
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