Ipopt Documentation  
 
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
29class SIPOPTLIB_EXPORT SchurData: public ReferencedObject
30{
31public:
33 : initialized_(false),
34 nrows_(0)
35 { }
36
37 virtual ~SchurData()
38 { }
39
41
42 /* Functions to set the Schurdata. At least one must be overloaded */
43
45 virtual void SetData_Flag(
46 Index dim,
47 const Index* flags,
48 Number v = 1.0
49 ) = 0;
50
52 virtual void SetData_Flag(
53 Index dim,
54 const Index* flags,
55 const Number* values
56 ) = 0;
57
59 Index dim,
60 const Index* flags,
61 Number v = 1.0
62 ) = 0;
63
64 virtual void SetData_List(
65 const std::vector<Index>& list,
66 Number v = 1.0
67 ) = 0;
68
69 virtual void AddData_List(
70 std::vector<Index> cols,
71 std::vector<Index>& delta_u_sort,
72 Index& new_du_size,
73 Index v
74 ) = 0;
75
77 virtual Index GetNRowsAdded() const
78 {
79 return nrows_;
80 }
81
82 virtual bool Is_Initialized() const
83 {
84 return initialized_;
85 }
86
88 virtual void GetRow(
89 Index i,
91 ) const = 0;
92
101 Index row,
102 std::vector<Index>& indices,
103 std::vector<Number>& factors
104 ) const = 0;
105
107 virtual void Multiply(
108 const IteratesVector& v,
109 Vector& u
110 ) const = 0;
111
113 virtual void TransMultiply(
114 const Vector& u,
116 ) const = 0;
117
118 virtual void PrintImpl(
119 const Journalist& jnlst,
120 EJournalLevel level,
121 EJournalCategory category,
122 const std::string& name,
123 Index indent,
124 const std::string& prefix
125 ) const = 0;
126
127 void Print(
128 const Journalist& jnlst,
129 EJournalLevel level,
130 EJournalCategory category,
131 const std::string& name,
132 Index indent = 0,
133 const std::string& prefix = ""
134 ) const
135 {
136 if( jnlst.ProduceOutput(level, category) )
137 {
138 PrintImpl(jnlst, level, category, name, indent, prefix);
139 }
140 }
141
142 void Print(
144 EJournalLevel level,
145 EJournalCategory category,
146 const std::string& name,
147 Index indent,
148 const std::string& prefix
149 ) const
150 {
151 if( IsValid(jnlst) && jnlst->ProduceOutput(level, category) )
152 {
153 PrintImpl(*jnlst, level, category, name, indent, prefix);
154 }
155 }
156
157protected:
158
159 virtual void Set_Initialized()
160 {
161 initialized_ = true;
162 }
163
164 virtual void Set_NRows(
165 Index nrows
166 )
167 {
168 nrows_ = nrows;
169 }
170
171private:
172
175
178};
179
180}
181
182#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...
Storing the reference count of all the smart pointers that currently reference it.
This interface serves as a reference point for multiple classes that need to use SchurData (PCalculat...
virtual void SetData_Flag(Index dim, const Index *flags, Number v=1.0)=0
Set Data to one for given indices.
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)
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
This file contains a base class for all exceptions and a set of macros to help with exceptions.
bool IsValid(const SmartPtr< U > &smart_ptr)
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
EJournalCategory
Category Selection Enum.
EJournalLevel
Print Level Enum.
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17