/build/buildd/coinor-ipopt-3.10.1/Ipopt/contrib/sIPOPT/src/SensSchurData.hpp
Go to the documentation of this file.
00001 // Copyright 2009, 2011 Hans Pirnay
00002 // All Rights Reserved.
00003 // This code is published under the Eclipse Public License.
00004 //
00005 // Date   : 2009-05-06
00006 
00007 #ifndef __ASSCHURDATA_HPP__
00008 #define __ASSCHURDATA_HPP__
00009 
00010 #include "IpVector.hpp"
00011 #include "IpIteratesVector.hpp"
00012 #include <vector>
00013 
00014 namespace Ipopt
00015 {
00016 
00017 
00018   class SchurData : public ReferencedObject
00019   {
00031   public:
00032 
00033     SchurData()  : initialized_(false), nrows_(0)
00034     {}
00035 
00036     virtual ~SchurData()
00037     {
00038     }
00039 
00040     virtual SmartPtr<SchurData> MakeNewSchurDataCopy() const =0;
00041 
00045     virtual void SetData_Flag(Index dim, const Index* flags, Number v=1.0)=0;
00046 
00048     virtual void SetData_Flag(Index dim, const Index* flags, const Number* values)=0;
00049 
00050     virtual Index SetData_Index(Index dim, const Index* flags, Number v=1.0)=0;
00051 
00052     virtual void SetData_List(const std::vector<Index>& list, Number v=1.0) =0;
00053 
00054     virtual void AddData_List(std::vector<Index> cols, std::vector<Index>& delta_u_sort, Index& new_du_size, Index v)=0;
00055 
00057     virtual Index GetNRowsAdded() const
00058     {
00059       return nrows_;
00060     }
00061 
00062     virtual bool Is_Initialized() const
00063     {
00064       return initialized_;
00065     }
00066 
00067 
00069     virtual void GetRow(Index i, IteratesVector& v) const = 0;
00070 
00076     virtual void GetMultiplyingVectors(Index row, std::vector<Index>& indices, std::vector<Number>& factors) const =0;
00077 
00079     virtual void Multiply(const IteratesVector& v, Vector& u) const =0;
00080 
00082     virtual void TransMultiply(const Vector& u, IteratesVector& v) const =0;
00083 
00084     virtual void PrintImpl(const Journalist& jnlst,
00085                            EJournalLevel level,
00086                            EJournalCategory category,
00087                            const std::string& name,
00088                            Index indent,
00089                            const std::string& prefix) const =0;
00090 
00091     void Print(const Journalist& jnlst,
00092                EJournalLevel level,
00093                EJournalCategory category,
00094                const std::string& name,
00095                Index indent=0,
00096                const std::string& prefix="") const
00097     {
00098       if (jnlst.ProduceOutput(level, category)) {
00099         PrintImpl(jnlst, level, category, name, indent, prefix);
00100       }
00101     }
00102 
00103     void Print(SmartPtr<const Journalist> jnlst,
00104                EJournalLevel level,
00105                EJournalCategory category,
00106                const std::string& name,
00107                Index indent,
00108                const std::string& prefix) const
00109     {
00110       if (IsValid(jnlst) && jnlst->ProduceOutput(level, category)) {
00111         PrintImpl(*jnlst, level, category, name, indent, prefix);
00112       }
00113     }
00114 
00115   protected:
00116 
00117     virtual void Set_Initialized()
00118     {
00119       initialized_ = true;
00120     }
00121 
00122     virtual void Set_NRows(Index nrows)
00123     {
00124       nrows_ = nrows;
00125     }
00126 
00127   private:
00128 
00130     bool initialized_;
00131 
00133     Index nrows_;
00134 
00135   };
00136 
00137 }
00138 
00139 #endif