- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/SVN-release/Ipopt-3.2.1/Ipopt/src/LinAlg/IpLowRankUpdateSymMatrix.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: IpLowRankUpdateSymMatrix.hpp 759 2006-07-07 03:07:08Z 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 PrintImpl(const Journalist& jnlst,
    00107                            EJournalLevel level,
    00108                            EJournalCategory category,
    00109                            const std::string& name,
    00110                            Index indent,
    00111                            const std::string& prefix) const;
    00113
    00114   private:
    00124     LowRankUpdateSymMatrix();
    00125
    00127     LowRankUpdateSymMatrix(const LowRankUpdateSymMatrix&);
    00128
    00130     void operator=(const LowRankUpdateSymMatrix&);
    00132
    00134     SmartPtr<const LowRankUpdateSymMatrixSpace> owner_space_;
    00135
    00137     SmartPtr<const Vector> D_;
    00138
    00140     SmartPtr<const MultiVectorMatrix> V_;
    00141
    00143     SmartPtr<const MultiVectorMatrix> U_;
    00144   };
    00145
    00147   class LowRankUpdateSymMatrixSpace : public SymMatrixSpace
    00148   {
    00149   public:
    00153     LowRankUpdateSymMatrixSpace(Index dim,
    00154                                 SmartPtr<const Matrix> P_LowRank,
    00155                                 SmartPtr<const VectorSpace> LowRankVectorSpace,
    00156                                 bool reduced_diag)
    00157         :
    00158         SymMatrixSpace(dim),
    00159         P_LowRank_(P_LowRank),
    00160         lowrank_vector_space_(LowRankVectorSpace),
    00161         reduced_diag_(reduced_diag)
    00162     {
    00163       DBG_ASSERT(IsValid(lowrank_vector_space_));
    00164     }
    00165
    00167     virtual ~LowRankUpdateSymMatrixSpace()
    00168     {}
    00170
    00173     virtual SymMatrix* MakeNewSymMatrix() const
    00174     {
    00175       return MakeNewLowRankUpdateSymMatrix();
    00176     }
    00177
    00179     LowRankUpdateSymMatrix* MakeNewLowRankUpdateSymMatrix() const
    00180     {
    00181       return new LowRankUpdateSymMatrix(this);
    00182     }
    00183
    00184     SmartPtr<const Matrix> P_LowRank() const
    00185     {
    00186       return P_LowRank_;
    00187     }
    00188
    00189     SmartPtr<const VectorSpace> LowRankVectorSpace() const
    00190     {
    00191       return lowrank_vector_space_;
    00192     }
    00193
    00194     bool ReducedDiag() const
    00195     {
    00196       return reduced_diag_;
    00197     }
    00198
    00199   private:
    00209     LowRankUpdateSymMatrixSpace();
    00210
    00212     LowRankUpdateSymMatrixSpace(const LowRankUpdateSymMatrixSpace&);
    00213
    00215     void operator=(const LowRankUpdateSymMatrixSpace&);
    00217
    00221     SmartPtr<const Matrix> P_LowRank_;
    00222
    00225     SmartPtr<const VectorSpace> lowrank_vector_space_;
    00226
    00229     bool reduced_diag_;
    00230   };
    00231
    00232   inline
    00233   SmartPtr<const Matrix> LowRankUpdateSymMatrix::P_LowRank() const
    00234   {
    00235     return owner_space_->P_LowRank();
    00236   }
    00237
    00238   inline
    00239   SmartPtr<const VectorSpace> LowRankUpdateSymMatrix::LowRankVectorSpace() const
    00240   {
    00241     return owner_space_->LowRankVectorSpace();
    00242   }
    00243
    00244   inline
    00245   bool LowRankUpdateSymMatrix::ReducedDiag() const
    00246   {
    00247     return owner_space_->ReducedDiag();
    00248   }
    00249
    00250 } // namespace Ipopt
    00251 #endif