Ipopt 3.11.9
Loading...
Searching...
No Matches
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
14namespace Ipopt
15{
16
17
19 {
31 public:
32
34 {}
35
36 virtual ~SchurData()
37 {
38 }
39
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
Specialized CompoundVector class specifically for the algorithm iterates.
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...
ReferencedObject class.
virtual void SetData_Flag(Index dim, const Index *flags, Number v=1.0)=0
Functions to set the Schurdata.
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.
virtual Index GetNRowsAdded() const
Returns number of rows/columns in schur matrix.
void Print(SmartPtr< const Journalist > jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
virtual SmartPtr< SchurData > MakeNewSchurDataCopy() const =0
virtual void Set_NRows(Index nrows)
virtual void TransMultiply(const Vector &u, IteratesVector &v) const =0
Computes A*u with A in R(nxm), KKT in R(n,n)
bool initialized_
Makes sure that data is not set twice accidentially.
void Print(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent=0, const std::string &prefix="") const
virtual void GetRow(Index i, IteratesVector &v) const =0
Returns the i-th column vector of the matrix.
virtual void Set_Initialized()
Index nrows_
Number of columns/rows of corresponding Schur Matrix.
virtual void SetData_Flag(Index dim, const Index *flags, const Number *values)=0
Set Data to corresponing Number.
virtual bool Is_Initialized() const
virtual void Multiply(const IteratesVector &v, Vector &u) const =0
Computes B*v with B in R(mxn)
SchurData()
This interface serves as a reference point for multiple classes that need to use SchurData (PCalculat...
virtual void AddData_List(std::vector< Index > cols, std::vector< Index > &delta_u_sort, Index &new_du_size, Index v)=0
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const =0
virtual void SetData_List(const std::vector< Index > &list, Number v=1.0)=0
virtual Index SetData_Index(Index dim, const Index *flags, Number v=1.0)=0
Template class for Smart Pointers.
Vector Base Class.
Definition IpVector.hpp:48
bool IsValid(const SmartPtr< U > &smart_ptr)
EJournalCategory
Category Selection Enum.
int Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:19
EJournalLevel
Print Level Enum.
double Number
Type of all numbers.
Definition IpTypes.hpp:17