• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/tmp/buildd/coinor-ipopt-3.8.3/Ipopt/src/LinAlg/IpDenseGenMatrix.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2005, 2009 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpDenseGenMatrix.hpp 1522 2009-07-15 23:32:57Z andreasw $
00006 //
00007 // Authors:  Andreas Waechter             IBM    2005-12-24
00008 
00009 #ifndef __IPDENSEGENMATRIX_HPP__
00010 #define __IPDENSEGENMATRIX_HPP__
00011 
00012 #include "IpUtils.hpp"
00013 #include "IpMatrix.hpp"
00014 #include "IpDenseVector.hpp"
00015 #include "IpDenseSymMatrix.hpp"
00016 
00017 namespace Ipopt
00018 {
00019 
00021   class DenseGenMatrixSpace;
00022 
00026   class DenseGenMatrix : public Matrix
00027   {
00028   public:
00029 
00032 
00035     DenseGenMatrix(const DenseGenMatrixSpace* owner_space);
00036 
00038     ~DenseGenMatrix();
00040 
00042     SmartPtr<DenseGenMatrix> MakeNewDenseGenMatrix() const;
00043 
00048     Number* Values()
00049     {
00050       initialized_ = true;
00051       ObjectChanged();
00052       return values_;
00053     }
00054 
00058     const Number* Values() const
00059     {
00060       DBG_ASSERT(initialized_);
00061       return values_;
00062     }
00063 
00066     void Copy(const DenseGenMatrix& M);
00067 
00070     void FillIdentity(Number factor=1.);
00071 
00074     void ScaleColumns(const DenseVector& scal_vec);
00075 
00077     void AddMatrixProduct(Number alpha, const DenseGenMatrix& A,
00078                           bool transA, const DenseGenMatrix& B,
00079                           bool transB, Number beta);
00080 
00084     void HighRankUpdateTranspose(Number alpha,
00085                                  const MultiVectorMatrix& V1,
00086                                  const MultiVectorMatrix& V2,
00087                                  Number beta);
00088 
00094     bool ComputeCholeskyFactor(const DenseSymMatrix& M);
00095 
00101     bool ComputeEigenVectors(const DenseSymMatrix& M,
00102                              DenseVector& Evalues);
00103 
00109     void CholeskyBackSolveMatrix(bool trans, Number alpha,
00110                                  DenseGenMatrix& B) const;
00111 
00116     void CholeskySolveVector(DenseVector& b) const;
00117 
00123     void CholeskySolveMatrix(DenseGenMatrix& B) const;
00124 
00127     bool ComputeLUFactorInPlace();
00128 
00131     void LUSolveMatrix(DenseGenMatrix& B) const;
00132 
00135     void LUSolveVector(DenseVector& b) const;
00136 
00137   protected:
00140     virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
00141                                 Vector &y) const;
00142 
00143     virtual void TransMultVectorImpl(Number alpha, const Vector& x,
00144                                      Number beta, Vector& y) const;
00145 
00148     virtual bool HasValidNumbersImpl() const;
00149 
00150     virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
00151 
00152     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
00153 
00154     virtual void PrintImpl(const Journalist& jnlst,
00155                            EJournalLevel level,
00156                            EJournalCategory category,
00157                            const std::string& name,
00158                            Index indent,
00159                            const std::string& prefix) const;
00161 
00162 
00163   private:
00173     DenseGenMatrix();
00174 
00176     DenseGenMatrix(const DenseGenMatrix&);
00177 
00179     void operator=(const DenseGenMatrix&);
00181 
00182     const DenseGenMatrixSpace* owner_space_;
00183 
00186     Number* values_;
00187 
00189     bool initialized_;
00190 
00192     enum Factorization
00193     {
00194       NONE,
00195       LU,
00196       CHOL
00197     };
00198 
00200     Factorization factorization_;
00201 
00203     int* pivot_;
00204   };
00205 
00208   class DenseGenMatrixSpace : public MatrixSpace
00209   {
00210   public:
00216     DenseGenMatrixSpace(Index nRows, Index nCols);
00217 
00219     ~DenseGenMatrixSpace()
00220     {}
00222 
00224     DenseGenMatrix* MakeNewDenseGenMatrix() const
00225     {
00226       return new DenseGenMatrix(this);
00227     }
00228 
00231     virtual Matrix* MakeNew() const
00232     {
00233       return MakeNewDenseGenMatrix();
00234     }
00235 
00236   };
00237 
00238   inline
00239   SmartPtr<DenseGenMatrix> DenseGenMatrix::MakeNewDenseGenMatrix() const
00240   {
00241     return owner_space_->MakeNewDenseGenMatrix();
00242   }
00243 
00244 } // namespace Ipopt
00245 #endif

Generated on Thu Jul 29 2010 19:56:08 by  doxygen 1.7.1