/home/coin/SVN-release/Ipopt-3.5.5/Ipopt/src/LinAlg/IpDenseGenMatrix.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2005, 2008 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpDenseGenMatrix.hpp 1327 2008-09-18 19:01:17Z 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 
00125   protected:
00128     virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
00129                                 Vector &y) const;
00130 
00131     virtual void TransMultVectorImpl(Number alpha, const Vector& x,
00132                                      Number beta, Vector& y) const;
00133 
00136     virtual bool HasValidNumbersImpl() const;
00137 
00138     virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
00139 
00140     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
00141 
00142     virtual void PrintImpl(const Journalist& jnlst,
00143                            EJournalLevel level,
00144                            EJournalCategory category,
00145                            const std::string& name,
00146                            Index indent,
00147                            const std::string& prefix) const;
00149 
00150 
00151   private:
00161     DenseGenMatrix();
00162 
00164     DenseGenMatrix(const DenseGenMatrix&);
00165 
00167     void operator=(const DenseGenMatrix&);
00169 
00170     const DenseGenMatrixSpace* owner_space_;
00171 
00174     Number* values_;
00175 
00177     bool initialized_;
00178   };
00179 
00182   class DenseGenMatrixSpace : public MatrixSpace
00183   {
00184   public:
00190     DenseGenMatrixSpace(Index nRows, Index nCols);
00191 
00193     ~DenseGenMatrixSpace()
00194     {}
00196 
00198     DenseGenMatrix* MakeNewDenseGenMatrix() const
00199     {
00200       return new DenseGenMatrix(this);
00201     }
00202 
00205     virtual Matrix* MakeNew() const
00206     {
00207       return MakeNewDenseGenMatrix();
00208     }
00209 
00210   };
00211 
00212   inline
00213   SmartPtr<DenseGenMatrix> DenseGenMatrix::MakeNewDenseGenMatrix() const
00214   {
00215     return owner_space_->MakeNewDenseGenMatrix();
00216   }
00217 
00218 } // namespace Ipopt
00219 #endif

Generated on Wed Jan 14 03:00:33 2009 by  doxygen 1.4.7