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 1861 2010-12-21 21:34:47Z andreasw $
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  SymMatrix(const SymMatrixSpace* owner_space);
31 
33  virtual ~SymMatrix()
34  {}
36 
40  Index Dim() const;
42 
44 
45  protected:
53  virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta,
54  Vector& y) const
55  {
56  // Since this matrix is symetric, this is the same operation as
57  // MultVector
58  MultVector(alpha, x, beta, y);
59  }
62  virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const
63  {
64  ComputeRowAMaxImpl(cols_norms, init);
65  }
67 
68  private:
73  };
74 
75 
78  class SymMatrixSpace : public MatrixSpace
79  {
80  public:
87  :
88  MatrixSpace(dim,dim)
89  {}
90 
92  virtual ~SymMatrixSpace()
93  {}
95 
98  virtual SymMatrix* MakeNewSymMatrix() const=0;
99 
102  virtual Matrix* MakeNew() const
103  {
104  return MakeNewSymMatrix();
105  }
106 
110  Index Dim() const
111  {
112  DBG_ASSERT(NRows() == NCols());
113  return NRows();
114  }
115 
116  private:
126  SymMatrixSpace();
127 
128  /* Copy constructor */
130 
134 
135  };
136 
137  /* inline methods */
138  inline
140  :
141  Matrix(owner_space),
142  owner_space_(owner_space)
143  {}
144 
145  inline
147  {
148  return owner_space_->Dim();
149  }
150 
151  inline
153  {
154  return owner_space_;
155  }
156 
157 } // namespace Ipopt
158 
159 #endif