Ipopt  3.11.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpDenseGenMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpDenseGenMatrix.hpp 1861 2010-12-21 21:34:47Z andreasw $
6 //
7 // Authors: Andreas Waechter IBM 2005-12-24
8 
9 #ifndef __IPDENSEGENMATRIX_HPP__
10 #define __IPDENSEGENMATRIX_HPP__
11 
12 #include "IpUtils.hpp"
13 #include "IpMatrix.hpp"
14 #include "IpDenseVector.hpp"
15 #include "IpDenseSymMatrix.hpp"
16 
17 namespace Ipopt
18 {
19 
21  class DenseGenMatrixSpace;
22 
26  class DenseGenMatrix : public Matrix
27  {
28  public:
29 
32 
35  DenseGenMatrix(const DenseGenMatrixSpace* owner_space);
36 
40 
43 
49  {
50  initialized_ = true;
51  ObjectChanged();
52  return values_;
53  }
54 
58  const Number* Values() const
59  {
61  return values_;
62  }
63 
66  void Copy(const DenseGenMatrix& M);
67 
70  void FillIdentity(Number factor=1.);
71 
74  void ScaleColumns(const DenseVector& scal_vec);
75 
77  void AddMatrixProduct(Number alpha, const DenseGenMatrix& A,
78  bool transA, const DenseGenMatrix& B,
79  bool transB, Number beta);
80 
85  const MultiVectorMatrix& V1,
86  const MultiVectorMatrix& V2,
87  Number beta);
88 
95 
101  bool ComputeEigenVectors(const DenseSymMatrix& M,
102  DenseVector& Evalues);
103 
109  void CholeskyBackSolveMatrix(bool trans, Number alpha,
110  DenseGenMatrix& B) const;
111 
116  void CholeskySolveVector(DenseVector& b) const;
117 
123  void CholeskySolveMatrix(DenseGenMatrix& B) const;
124 
127  bool ComputeLUFactorInPlace();
128 
131  void LUSolveMatrix(DenseGenMatrix& B) const;
132 
135  void LUSolveVector(DenseVector& b) const;
136 
137  protected:
140  virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
141  Vector &y) const;
142 
143  virtual void TransMultVectorImpl(Number alpha, const Vector& x,
144  Number beta, Vector& y) const;
145 
148  virtual bool HasValidNumbersImpl() const;
149 
150  virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
151 
152  virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
153 
154  virtual void PrintImpl(const Journalist& jnlst,
155  EJournalLevel level,
156  EJournalCategory category,
157  const std::string& name,
158  Index indent,
159  const std::string& prefix) const;
161 
162 
163  private:
173  DenseGenMatrix();
174 
177 
179  void operator=(const DenseGenMatrix&);
181 
183 
187 
190 
193  {
195  LU,
197  };
198 
201 
203  int* pivot_;
204  };
205 
209  {
210  public:
216  DenseGenMatrixSpace(Index nRows, Index nCols);
217 
220  {}
222 
225  {
226  return new DenseGenMatrix(this);
227  }
228 
231  virtual Matrix* MakeNew() const
232  {
233  return MakeNewDenseGenMatrix();
234  }
235 
236  };
237 
238  inline
240  {
242  }
243 
244 } // namespace Ipopt
245 #endif