00001 // Copyright (C) 2004, 2006 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // $Id: IpSymMatrix.hpp 759 2006-07-07 03:07:08Z andreasw $ 00006 // 00007 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 00008 00009 #ifndef __IPSYMMATRIX_HPP__ 00010 #define __IPSYMMATRIX_HPP__ 00011 00012 #include "IpUtils.hpp" 00013 #include "IpMatrix.hpp" 00014 00015 namespace Ipopt 00016 { 00017 00018 /* forward declarations */ 00019 class SymMatrixSpace; 00020 00023 class SymMatrix : public Matrix 00024 { 00025 public: 00030 SymMatrix(const SymMatrixSpace* owner_space); 00031 00033 virtual ~SymMatrix(); 00035 00039 Index Dim() const; 00041 00042 SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const; 00043 00044 protected: 00052 virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta, 00053 Vector& y) const; 00055 00056 private: 00060 const SymMatrixSpace* owner_space_; 00061 }; 00062 00063 00066 class SymMatrixSpace : public MatrixSpace 00067 { 00068 public: 00074 SymMatrixSpace(Index dim); 00075 00077 virtual ~SymMatrixSpace(); 00079 00082 virtual SymMatrix* MakeNewSymMatrix() const=0; 00083 00086 virtual Matrix* MakeNew() const; 00087 00091 Index Dim() const; 00092 00093 private: 00103 SymMatrixSpace(); 00104 00105 /* Copy constructor */ 00106 SymMatrixSpace(const SymMatrixSpace&); 00107 00109 SymMatrixSpace& operator=(const SymMatrixSpace&); 00111 00112 }; 00113 00114 /* inline methods */ 00115 inline 00116 Index SymMatrixSpace::Dim() const 00117 { 00118 DBG_ASSERT(NRows() == NCols()); 00119 return NRows(); 00120 } 00121 00122 inline 00123 Index SymMatrix::Dim() const 00124 { 00125 return owner_space_->Dim(); 00126 } 00127 00128 } // namespace Ipopt 00129 00130 #endif