Ipopt
trunk
|
00001 // Copyright (C) 2004, 2008 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id$ 00006 // 00007 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 00008 00009 #ifndef __IPIDENTITYMATRIX_HPP__ 00010 #define __IPIDENTITYMATRIX_HPP__ 00011 00012 #include "IpUtils.hpp" 00013 #include "IpSymMatrix.hpp" 00014 00015 namespace Ipopt 00016 { 00017 00021 class IdentityMatrix : public SymMatrix 00022 { 00023 public: 00024 00027 00031 IdentityMatrix(const SymMatrixSpace* owner_space); 00032 00034 ~IdentityMatrix(); 00036 00038 void SetFactor(Number factor) 00039 { 00040 factor_ = factor; 00041 } 00042 00044 Number GetFactor() const 00045 { 00046 return factor_; 00047 } 00048 00050 Index Dim() const; 00051 00052 protected: 00055 virtual void MultVectorImpl(Number alpha, const Vector& x, 00056 Number beta, Vector& y) const; 00057 00058 virtual void AddMSinvZImpl(Number alpha, const Vector& S, 00059 const Vector& Z, Vector& X) const; 00060 00063 virtual bool HasValidNumbersImpl() const; 00064 00065 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const; 00066 00067 virtual void PrintImpl(const Journalist& jnlst, 00068 EJournalLevel level, 00069 EJournalCategory category, 00070 const std::string& name, 00071 Index indent, 00072 const std::string& prefix) const; 00074 00075 private: 00085 IdentityMatrix(); 00086 00088 IdentityMatrix(const IdentityMatrix&); 00089 00091 void operator=(const IdentityMatrix&); 00093 00095 Number factor_; 00096 }; 00097 00099 class IdentityMatrixSpace : public SymMatrixSpace 00100 { 00101 public: 00105 IdentityMatrixSpace(Index dim) 00106 : 00107 SymMatrixSpace(dim) 00108 {} 00109 00111 virtual ~IdentityMatrixSpace() 00112 {} 00114 00117 virtual SymMatrix* MakeNewSymMatrix() const 00118 { 00119 return MakeNewIdentityMatrix(); 00120 } 00121 00123 IdentityMatrix* MakeNewIdentityMatrix() const 00124 { 00125 return new IdentityMatrix(this); 00126 } 00127 00128 private: 00138 IdentityMatrixSpace(); 00139 00141 IdentityMatrixSpace(const IdentityMatrixSpace&); 00142 00144 void operator=(const IdentityMatrixSpace&); 00146 }; 00147 00148 } // namespace Ipopt 00149 #endif