/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/LinAlg/IpSumMatrix.hpp

Go to the documentation of this file.
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: IpSumMatrix.hpp 735 2006-06-04 06:10:05Z 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 PrintImpl(const Journalist& jnlst,
00062                            EJournalLevel level,
00063                            EJournalCategory category,
00064                            const std::string& name,
00065                            Index indent,
00066                            const std::string& prefix) const;
00068 
00069   private:
00079     SumMatrix();
00080 
00082     SumMatrix(const SumMatrix&);
00083 
00085     void operator=(const SumMatrix&);
00087 
00089     std::vector<Number> factors_;
00090 
00092     std::vector<SmartPtr<const Matrix> > matrices_;
00093 
00095     const SumMatrixSpace* owner_space_;
00096   };
00097 
00099   class SumMatrixSpace : public MatrixSpace
00100   {
00101   public:
00107     SumMatrixSpace(Index nrows, Index ncols, Index nterms)
00108         :
00109         MatrixSpace(nrows, ncols),
00110         nterms_(nterms)
00111     {}
00112 
00114     virtual ~SumMatrixSpace()
00115     {}
00117 
00119     Index NTerms() const
00120     {
00121       return nterms_;
00122     }
00123 
00126     void SetTermSpace(Index term_idx, const MatrixSpace& mat_space);
00127 
00129     SmartPtr<const MatrixSpace> GetTermSpace(Index term_idx) const;
00130 
00132     SumMatrix* MakeNewSumMatrix() const;
00133 
00136     virtual Matrix* MakeNew() const;
00137 
00138   private:
00148     SumMatrixSpace();
00149 
00151     SumMatrixSpace(const SumMatrixSpace&);
00152 
00154     SumMatrixSpace& operator=(const SumMatrixSpace&);
00156 
00157     const Index nterms_;
00158 
00159     std::vector< SmartPtr<const MatrixSpace> > term_spaces_;
00160   };
00161 
00162 } // namespace Ipopt
00163 #endif

Generated on Sun Nov 14 14:06:36 2010 for Coin-All by  doxygen 1.4.7