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

Go to the documentation of this file.
00001 // Copyright (C) 2005, 2006 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpDenseGenMatrix.hpp 735 2006-06-04 06:10:05Z 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 PrintImpl(const Journalist& jnlst,
00139                            EJournalLevel level,
00140                            EJournalCategory category,
00141                            const std::string& name,
00142                            Index indent,
00143                            const std::string& prefix) const;
00145 
00146 
00147   private:
00157     DenseGenMatrix();
00158 
00160     DenseGenMatrix(const DenseGenMatrix&);
00161 
00163     void operator=(const DenseGenMatrix&);
00165 
00166     const DenseGenMatrixSpace* owner_space_;
00167 
00170     Number* values_;
00171 
00173     bool initialized_;
00174   };
00175 
00178   class DenseGenMatrixSpace : public MatrixSpace
00179   {
00180   public:
00186     DenseGenMatrixSpace(Index nRows, Index nCols);
00187 
00189     ~DenseGenMatrixSpace()
00190     {}
00192 
00194     DenseGenMatrix* MakeNewDenseGenMatrix() const
00195     {
00196       return new DenseGenMatrix(this);
00197     }
00198 
00201     virtual Matrix* MakeNew() const
00202     {
00203       return MakeNewDenseGenMatrix();
00204     }
00205 
00206   };
00207 
00208   inline
00209   SmartPtr<DenseGenMatrix> DenseGenMatrix::MakeNewDenseGenMatrix() const
00210   {
00211     return owner_space_->MakeNewDenseGenMatrix();
00212   }
00213 
00214 } // namespace Ipopt
00215 #endif

Generated on Sun Nov 14 14:06:36 2010 for Coin-All by  doxygen 1.4.7