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

/tmp/buildd/coinor-ipopt-3.8.3/Ipopt/src/LinAlg/IpLowRankUpdateSymMatrix.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: IpLowRankUpdateSymMatrix.hpp 1324 2008-09-16 14:19:26Z andreasw $
00006 //
00007 // Authors:  Andreas Waechter            IBM    2005-12-25
00008 
00009 #ifndef __IPLOWRANKUPDATESYMMATRIX_HPP__
00010 #define __IPLOWRANKUPDATESYMMATRIX_HPP__
00011 
00012 #include "IpUtils.hpp"
00013 #include "IpSymMatrix.hpp"
00014 #include "IpMultiVectorMatrix.hpp"
00015 
00016 namespace Ipopt
00017 {
00018 
00019   /* forward declarations */
00020   class LowRankUpdateSymMatrixSpace;
00021 
00031   class LowRankUpdateSymMatrix : public SymMatrix
00032   {
00033   public:
00034 
00037 
00039     LowRankUpdateSymMatrix(const LowRankUpdateSymMatrixSpace* owner_space);
00040 
00042     ~LowRankUpdateSymMatrix();
00044 
00046     void SetDiag(const Vector& D)
00047     {
00048       D_ = &D;
00049       ObjectChanged();
00050     }
00051 
00053     SmartPtr<const Vector> GetDiag() const
00054     {
00055       return D_;
00056     }
00057 
00059     void SetV(const MultiVectorMatrix& V)
00060     {
00061       V_ = &V;
00062       ObjectChanged();
00063     }
00064 
00066     SmartPtr<const MultiVectorMatrix> GetV() const
00067     {
00068       return V_;
00069     }
00070 
00072     void SetU(const MultiVectorMatrix& U)
00073     {
00074       U_ = &U;
00075       ObjectChanged();
00076     }
00077 
00079     SmartPtr<const MultiVectorMatrix> GetU() const
00080     {
00081       return U_;
00082     }
00083 
00086     SmartPtr<const Matrix> P_LowRank() const;
00087 
00090     SmartPtr<const VectorSpace> LowRankVectorSpace() const;
00091 
00094     bool ReducedDiag() const;
00095 
00096   protected:
00099     virtual void MultVectorImpl(Number alpha, const Vector& x,
00100                                 Number beta, Vector& y) const;
00101 
00104     virtual bool HasValidNumbersImpl() const;
00105 
00106     virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
00107 
00108     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
00109 
00110     virtual void PrintImpl(const Journalist& jnlst,
00111                            EJournalLevel level,
00112                            EJournalCategory category,
00113                            const std::string& name,
00114                            Index indent,
00115                            const std::string& prefix) const;
00117 
00118   private:
00128     LowRankUpdateSymMatrix();
00129 
00131     LowRankUpdateSymMatrix(const LowRankUpdateSymMatrix&);
00132 
00134     void operator=(const LowRankUpdateSymMatrix&);
00136 
00138     SmartPtr<const LowRankUpdateSymMatrixSpace> owner_space_;
00139 
00141     SmartPtr<const Vector> D_;
00142 
00144     SmartPtr<const MultiVectorMatrix> V_;
00145 
00147     SmartPtr<const MultiVectorMatrix> U_;
00148   };
00149 
00151   class LowRankUpdateSymMatrixSpace : public SymMatrixSpace
00152   {
00153   public:
00157     LowRankUpdateSymMatrixSpace(Index dim,
00158                                 SmartPtr<const Matrix> P_LowRank,
00159                                 SmartPtr<const VectorSpace> LowRankVectorSpace,
00160                                 bool reduced_diag)
00161         :
00162         SymMatrixSpace(dim),
00163         P_LowRank_(P_LowRank),
00164         lowrank_vector_space_(LowRankVectorSpace),
00165         reduced_diag_(reduced_diag)
00166     {
00167       DBG_ASSERT(IsValid(lowrank_vector_space_));
00168     }
00169 
00171     virtual ~LowRankUpdateSymMatrixSpace()
00172     {}
00174 
00177     virtual SymMatrix* MakeNewSymMatrix() const
00178     {
00179       return MakeNewLowRankUpdateSymMatrix();
00180     }
00181 
00183     LowRankUpdateSymMatrix* MakeNewLowRankUpdateSymMatrix() const
00184     {
00185       return new LowRankUpdateSymMatrix(this);
00186     }
00187 
00188     SmartPtr<const Matrix> P_LowRank() const
00189     {
00190       return P_LowRank_;
00191     }
00192 
00193     SmartPtr<const VectorSpace> LowRankVectorSpace() const
00194     {
00195       return lowrank_vector_space_;
00196     }
00197 
00198     bool ReducedDiag() const
00199     {
00200       return reduced_diag_;
00201     }
00202 
00203   private:
00213     LowRankUpdateSymMatrixSpace();
00214 
00216     LowRankUpdateSymMatrixSpace(const LowRankUpdateSymMatrixSpace&);
00217 
00219     void operator=(const LowRankUpdateSymMatrixSpace&);
00221 
00225     SmartPtr<const Matrix> P_LowRank_;
00226 
00229     SmartPtr<const VectorSpace> lowrank_vector_space_;
00230 
00233     bool reduced_diag_;
00234   };
00235 
00236   inline
00237   SmartPtr<const Matrix> LowRankUpdateSymMatrix::P_LowRank() const
00238   {
00239     return owner_space_->P_LowRank();
00240   }
00241 
00242   inline
00243   SmartPtr<const VectorSpace> LowRankUpdateSymMatrix::LowRankVectorSpace() const
00244   {
00245     return owner_space_->LowRankVectorSpace();
00246   }
00247 
00248   inline
00249   bool LowRankUpdateSymMatrix::ReducedDiag() const
00250   {
00251     return owner_space_->ReducedDiag();
00252   }
00253 
00254 } // namespace Ipopt
00255 #endif

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