# IpExpandedMultiVectorMatrix.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2009 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Eclipse Public License.
    00004 //
    00005 // $Id: IpExpandedMultiVectorMatrix.hpp 1861 2010-12-21 21:34:47Z andreasw $
    00006 //
    00007 // Authors:  Andreas Waechter             IBM    2009-11-05
    00008
    00009 #ifndef __IPEXPANDEDMULTIVECTORMATRIX_HPP__
    00010 #define __IPEXPANDEDMULTIVECTORMATRIX_HPP__
    00011
    00012 #include "IpUtils.hpp"
    00013 #include "IpMatrix.hpp"
    00014 #include "IpExpansionMatrix.hpp"
    00015
    00016 namespace Ipopt
    00017 {
    00018
    00020   class ExpandedMultiVectorMatrixSpace;
    00021
    00029   class ExpandedMultiVectorMatrix : public Matrix
    00030   {
    00031   public:
    00032
    00035
    00038     ExpandedMultiVectorMatrix(const ExpandedMultiVectorMatrixSpace* owner_space);
    00039
    00041     virtual ~ExpandedMultiVectorMatrix()
    00042     {}
    00044
    00045     SmartPtr<ExpandedMultiVectorMatrix> MakeNewExpandedMultiVectorMatrix() const;
    00046
    00049     void SetVector(Index i, SmartPtr<const Vector> vec);
    00050
    00052     inline SmartPtr<const Vector> GetVector(Index i) const
    00053     {
    00054       DBG_ASSERT(i < NRows());
    00055       return vecs_[i];
    00056     }
    00057
    00059     SmartPtr<const VectorSpace> RowVectorSpace() const;
    00060
    00062     SmartPtr<const ExpandedMultiVectorMatrixSpace>
    00063     ExpandedMultiVectorMatrixOwnerSpace() const;
    00064
    00067     SmartPtr<const ExpansionMatrix> GetExpansionMatrix() const;
    00068
    00069   protected:
    00072     virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta,
    00073                                 Vector &y) const;
    00074
    00075     virtual void TransMultVectorImpl(Number alpha, const Vector& x,
    00076                                      Number beta, Vector& y) const;
    00077
    00080     virtual bool HasValidNumbersImpl() const;
    00081
    00082     virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
    00083
    00084     virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
    00085
    00086     virtual void PrintImpl(const Journalist& jnlst,
    00087                            EJournalLevel level,
    00088                            EJournalCategory category,
    00089                            const std::string& name,
    00090                            Index indent,
    00091                            const std::string& prefix) const;
    00093
    00094
    00095   private:
    00105     ExpandedMultiVectorMatrix();
    00106
    00108     ExpandedMultiVectorMatrix(const ExpandedMultiVectorMatrix&);
    00109
    00111     void operator=(const ExpandedMultiVectorMatrix&);
    00113
    00114     const ExpandedMultiVectorMatrixSpace* owner_space_;
    00115
    00117     std::vector<SmartPtr<const Vector> > vecs_;
    00118
    00119   };
    00120
    00123   class ExpandedMultiVectorMatrixSpace : public MatrixSpace
    00124   {
    00125   public:
    00131     ExpandedMultiVectorMatrixSpace(Index nrows,
    00132                                    const VectorSpace& vec_space,
    00133                                    SmartPtr<const ExpansionMatrix> exp_matrix);
    00135     virtual ~ExpandedMultiVectorMatrixSpace()
    00136     {}
    00138
    00140     ExpandedMultiVectorMatrix* MakeNewExpandedMultiVectorMatrix() const
    00141     {
    00142       return new ExpandedMultiVectorMatrix(this);
    00143     }
    00144
    00147     virtual Matrix* MakeNew() const
    00148     {
    00149       return MakeNewExpandedMultiVectorMatrix();
    00150     }
    00151
    00153     SmartPtr<const VectorSpace> RowVectorSpace() const
    00154     {
    00155       return vec_space_;
    00156     }
    00157
    00158     SmartPtr<const ExpansionMatrix> GetExpansionMatrix() const
    00159     {
    00160       return exp_matrix_;
    00161     }
    00162
    00163   private:
    00164     SmartPtr<const VectorSpace> vec_space_;
    00165
    00166     SmartPtr<const ExpansionMatrix> exp_matrix_;
    00167   };
    00168
    00169   inline
    00170   SmartPtr<ExpandedMultiVectorMatrix> ExpandedMultiVectorMatrix::MakeNewExpandedMultiVectorMatrix() const
    00171   {
    00172     return owner_space_->MakeNewExpandedMultiVectorMatrix();
    00173   }
    00174
    00175   inline
    00176   SmartPtr<const VectorSpace> ExpandedMultiVectorMatrix::RowVectorSpace() const
    00177   {
    00178     return owner_space_->RowVectorSpace();
    00179   }
    00180
    00181   inline
    00182   SmartPtr<const ExpansionMatrix> ExpandedMultiVectorMatrix::GetExpansionMatrix() const
    00183   {
    00184     return owner_space_->GetExpansionMatrix();
    00185   }
    00186
    00187   inline
    00188   SmartPtr<const ExpandedMultiVectorMatrixSpace>
    00189   ExpandedMultiVectorMatrix::ExpandedMultiVectorMatrixOwnerSpace() const
    00190   {
    00191     return owner_space_;
    00192   }
    00193
    00194 } // namespace Ipopt
    00195 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines