Ipopt  3.12.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SensSchurData.hpp
Go to the documentation of this file.
1 // Copyright 2009, 2011 Hans Pirnay
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Date : 2009-05-06
6 
7 #ifndef __ASSCHURDATA_HPP__
8 #define __ASSCHURDATA_HPP__
9 
10 #include "IpVector.hpp"
11 #include "IpIteratesVector.hpp"
12 #include <vector>
13 
14 namespace Ipopt
15 {
16 
17 
18  class SchurData : public ReferencedObject
19  {
31  public:
32 
33  SchurData() : initialized_(false), nrows_(0)
34  {}
35 
36  virtual ~SchurData()
37  {
38  }
39 
40  virtual SmartPtr<SchurData> MakeNewSchurDataCopy() const =0;
41 
45  virtual void SetData_Flag(Index dim, const Index* flags, Number v=1.0)=0;
46 
48  virtual void SetData_Flag(Index dim, const Index* flags, const Number* values)=0;
49 
50  virtual Index SetData_Index(Index dim, const Index* flags, Number v=1.0)=0;
51 
52  virtual void SetData_List(const std::vector<Index>& list, Number v=1.0) =0;
53 
54  virtual void AddData_List(std::vector<Index> cols, std::vector<Index>& delta_u_sort, Index& new_du_size, Index v)=0;
55 
57  virtual Index GetNRowsAdded() const
58  {
59  return nrows_;
60  }
61 
62  virtual bool Is_Initialized() const
63  {
64  return initialized_;
65  }
66 
67 
69  virtual void GetRow(Index i, IteratesVector& v) const = 0;
70 
76  virtual void GetMultiplyingVectors(Index row, std::vector<Index>& indices, std::vector<Number>& factors) const =0;
77 
79  virtual void Multiply(const IteratesVector& v, Vector& u) const =0;
80 
82  virtual void TransMultiply(const Vector& u, IteratesVector& v) const =0;
83 
84  virtual void PrintImpl(const Journalist& jnlst,
85  EJournalLevel level,
86  EJournalCategory category,
87  const std::string& name,
88  Index indent,
89  const std::string& prefix) const =0;
90 
91  void Print(const Journalist& jnlst,
92  EJournalLevel level,
93  EJournalCategory category,
94  const std::string& name,
95  Index indent=0,
96  const std::string& prefix="") const
97  {
98  if (jnlst.ProduceOutput(level, category)) {
99  PrintImpl(jnlst, level, category, name, indent, prefix);
100  }
101  }
102 
104  EJournalLevel level,
105  EJournalCategory category,
106  const std::string& name,
107  Index indent,
108  const std::string& prefix) const
109  {
110  if (IsValid(jnlst) && jnlst->ProduceOutput(level, category)) {
111  PrintImpl(*jnlst, level, category, name, indent, prefix);
112  }
113  }
114 
115  protected:
116 
117  virtual void Set_Initialized()
118  {
119  initialized_ = true;
120  }
121 
122  virtual void Set_NRows(Index nrows)
123  {
124  nrows_ = nrows;
125  }
126 
127  private:
128 
131 
134 
135  };
136 
137 }
138 
139 #endif
virtual ~SchurData()
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
virtual void SetData_List(const std::vector< Index > &list, Number v=1.0)=0
Specialized CompoundVector class specifically for the algorithm iterates.
virtual Index SetData_Index(Index dim, const Index *flags, Number v=1.0)=0
SchurData()
This interface serves as a reference point for multiple classes that need to use SchurData (PCalculat...
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Vector Base Class.
Definition: IpVector.hpp:47
virtual void AddData_List(std::vector< Index > cols, std::vector< Index > &delta_u_sort, Index &new_du_size, Index v)=0
EJournalLevel
Print Level Enum.
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
virtual void Set_NRows(Index nrows)
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
ReferencedObject class.
virtual void GetMultiplyingVectors(Index row, std::vector< Index > &indices, std::vector< Number > &factors) const =0
Returns two vectors that are needed for matrix-vector multiplication of B and P.
Index nrows_
Number of columns/rows of corresponding Schur Matrix.
virtual bool Is_Initialized() const
virtual Index GetNRowsAdded() const
Returns number of rows/columns in schur matrix.
virtual void Set_Initialized()
bool initialized_
Makes sure that data is not set twice accidentially.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
virtual void GetRow(Index i, IteratesVector &v) const =0
Returns the i-th column vector of the matrix.
virtual void SetData_Flag(Index dim, const Index *flags, Number v=1.0)=0
Functions to set the Schurdata.
virtual void Multiply(const IteratesVector &v, Vector &u) const =0
Computes B*v with B in R(mxn)
virtual void TransMultiply(const Vector &u, IteratesVector &v) const =0
Computes A*u with A in R(nxm), KKT in R(n,n)
Class responsible for all message output.
virtual bool ProduceOutput(EJournalLevel level, EJournalCategory category) const
Method that returns true if there is a Journal that would write output for the given JournalLevel and...
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
EJournalCategory
Category Selection Enum.
virtual SmartPtr< SchurData > MakeNewSchurDataCopy() const =0