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

/build/buildd/coinor-ipopt-3.8.3/Ipopt/src/LinAlg/IpSumMatrix.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: IpSumMatrix.hpp 1280 2008-08-10 21:19:31Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPSUMMATRIX_HPP__
00010 #define __IPSUMMATRIX_HPP__
00011 
00012 #include "IpUtils.hpp"
00013 #include "IpMatrix.hpp"
00014 
00015 namespace Ipopt
00016 {
00017 
00018   /* forward declarations */
00019   class SumMatrixSpace;
00020 
00024   class SumMatrix : public Matrix
00025   {
00026   public:
00027 
00032     SumMatrix(const SumMatrixSpace* owner_space);
00033 
00035     virtual ~SumMatrix();
00037 
00039     void SetTerm(Index iterm, Number factor, const Matrix& matrix);
00040 
00043     void GetTerm(Index iterm, Number& factor, SmartPtr<const Matrix>& matrix) const;
00044 
00046     Index NTerms() const;
00047 
00048   protected:
00051     virtual void MultVectorImpl(Number alpha, const Vector& x,
00052                                 Number beta, Vector& y) const;
00053 
00054     virtual void TransMultVectorImpl(Number alpha, const Vector& x,
00055                                      Number beta, Vector& y) const;
00056 
00059     virtual bool HasValidNumbersImpl() const;
00060 
00061     virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
00062 
00063     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
00064 
00065     virtual void PrintImpl(const Journalist& jnlst,
00066                            EJournalLevel level,
00067                            EJournalCategory category,
00068                            const std::string& name,
00069                            Index indent,
00070                            const std::string& prefix) const;
00072 
00073   private:
00083     SumMatrix();
00084 
00086     SumMatrix(const SumMatrix&);
00087 
00089     void operator=(const SumMatrix&);
00091 
00093     std::vector<Number> factors_;
00094 
00096     std::vector<SmartPtr<const Matrix> > matrices_;
00097 
00099     const SumMatrixSpace* owner_space_;
00100   };
00101 
00103   class SumMatrixSpace : public MatrixSpace
00104   {
00105   public:
00111     SumMatrixSpace(Index nrows, Index ncols, Index nterms)
00112         :
00113         MatrixSpace(nrows, ncols),
00114         nterms_(nterms)
00115     {}
00116 
00118     virtual ~SumMatrixSpace()
00119     {}
00121 
00123     Index NTerms() const
00124     {
00125       return nterms_;
00126     }
00127 
00130     void SetTermSpace(Index term_idx, const MatrixSpace& mat_space);
00131 
00133     SmartPtr<const MatrixSpace> GetTermSpace(Index term_idx) const;
00134 
00136     SumMatrix* MakeNewSumMatrix() const;
00137 
00140     virtual Matrix* MakeNew() const;
00141 
00142   private:
00152     SumMatrixSpace();
00153 
00155     SumMatrixSpace(const SumMatrixSpace&);
00156 
00158     SumMatrixSpace& operator=(const SumMatrixSpace&);
00160 
00161     const Index nterms_;
00162 
00163     std::vector< SmartPtr<const MatrixSpace> > term_spaces_;
00164   };
00165 
00166 } // namespace Ipopt
00167 #endif

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