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

/build/buildd/coinor-ipopt-3.8.3/Ipopt/src/LinAlg/IpSymMatrix.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2008 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpSymMatrix.hpp 1280 2008-08-10 21:19:31Z 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()
00034     {}
00036 
00040     Index Dim() const;
00042 
00043     SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const;
00044 
00045   protected:
00053     virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta,
00054                                      Vector& y) const
00055     {
00056       // Since this matrix is symetric, this is the same operation as
00057       // MultVector
00058       MultVector(alpha, x, beta, y);
00059     }
00062     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const
00063     {
00064       ComputeRowAMaxImpl(cols_norms, init);
00065     }
00067 
00068   private:
00072     const SymMatrixSpace* owner_space_;
00073   };
00074 
00075 
00078   class SymMatrixSpace : public MatrixSpace
00079   {
00080   public:
00086     SymMatrixSpace(Index dim)
00087         :
00088         MatrixSpace(dim,dim)
00089     {}
00090 
00092     virtual ~SymMatrixSpace()
00093     {}
00095 
00098     virtual SymMatrix* MakeNewSymMatrix() const=0;
00099 
00102     virtual Matrix* MakeNew() const
00103     {
00104       return MakeNewSymMatrix();
00105     }
00106 
00110     Index Dim() const
00111     {
00112       DBG_ASSERT(NRows() == NCols());
00113       return NRows();
00114     }
00115 
00116   private:
00126     SymMatrixSpace();
00127 
00128     /* Copy constructor */
00129     SymMatrixSpace(const SymMatrixSpace&);
00130 
00132     SymMatrixSpace& operator=(const SymMatrixSpace&);
00134 
00135   };
00136 
00137   /* inline methods */
00138   inline
00139   SymMatrix::SymMatrix(const SymMatrixSpace* owner_space)
00140       :
00141       Matrix(owner_space),
00142       owner_space_(owner_space)
00143   {}
00144 
00145   inline
00146   Index SymMatrix::Dim() const
00147   {
00148     return owner_space_->Dim();
00149   }
00150 
00151   inline
00152   SmartPtr<const SymMatrixSpace> SymMatrix::OwnerSymMatrixSpace() const
00153   {
00154     return owner_space_;
00155   }
00156 
00157 } // namespace Ipopt
00158 
00159 #endif

Generated on Sat Oct 16 2010 02:54:51 by  doxygen 1.7.1