Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpSumMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpSumMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPSUMMATRIX_HPP__
10 #define __IPSUMMATRIX_HPP__
11
12 #include "IpUtils.hpp"
13 #include "IpMatrix.hpp"
14
15 namespace Ipopt
16 {
17
18 /* forward declarations */
19 class SumMatrixSpace;
20
24 class SumMatrix : public Matrix
25 {
26 public:
27
32 SumMatrix(const SumMatrixSpace* owner_space);
33
35 virtual ~SumMatrix();
37
39 void SetTerm(Index iterm, Number factor, const Matrix& matrix);
40
43 void GetTerm(Index iterm, Number& factor, SmartPtr<const Matrix>& matrix) const;
44
46 Index NTerms() const;
47
48 protected:
51 virtual void MultVectorImpl(Number alpha, const Vector& x,
52 Number beta, Vector& y) const;
53
54 virtual void TransMultVectorImpl(Number alpha, const Vector& x,
55 Number beta, Vector& y) const;
56
59 virtual bool HasValidNumbersImpl() const;
60
61 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
62
63 virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const;
64
65 virtual void PrintImpl(const Journalist& jnlst,
66 EJournalLevel level,
67 EJournalCategory category,
68 const std::string& name,
69 Index indent,
70 const std::string& prefix) const;
72
73 private:
83 SumMatrix();
84
86 SumMatrix(const SumMatrix&);
87
89 void operator=(const SumMatrix&);
91
93 std::vector<Number> factors_;
94
96 std::vector<SmartPtr<const Matrix> > matrices_;
97
99 const SumMatrixSpace* owner_space_;
100 };
101
103 class SumMatrixSpace : public MatrixSpace
104 {
105 public:
111 SumMatrixSpace(Index nrows, Index ncols, Index nterms)
112 :
113 MatrixSpace(nrows, ncols),
114 nterms_(nterms)
115 {}
116
118 virtual ~SumMatrixSpace()
119 {}
121
123 Index NTerms() const
124 {
125 return nterms_;
126 }
127
130 void SetTermSpace(Index term_idx, const MatrixSpace& mat_space);
131
133 SmartPtr<const MatrixSpace> GetTermSpace(Index term_idx) const;
134
136 SumMatrix* MakeNewSumMatrix() const;
137
140 virtual Matrix* MakeNew() const;
141
142 private:
152 SumMatrixSpace();
153
155 SumMatrixSpace(const SumMatrixSpace&);
156
158 SumMatrixSpace& operator=(const SumMatrixSpace&);
160
161 const Index nterms_;
162
163 std::vector< SmartPtr<const MatrixSpace> > term_spaces_;
164 };
165
166 } // namespace Ipopt
167 #endif
Ipopt::SumMatrix::SetTerm
void SetTerm(Index iterm, Number factor, const Matrix &matrix)
Method for setting term iterm for the sum.
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::SumMatrixSpace::operator=
SumMatrixSpace & operator=(const SumMatrixSpace &)
Overloaded Equals Operator.
Ipopt::SumMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Compute the max-norm of the columns in the matrix.
IpUtils.hpp
Ipopt::SumMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Ipopt::SumMatrix::NTerms
Index NTerms() const
Return the number of terms.
Ipopt::SumMatrix::SumMatrix
SumMatrix()
Default Constructor.
Ipopt::SumMatrixSpace::SumMatrixSpace
SumMatrixSpace()
Default constructor.
Ipopt::SumMatrixSpace::SumMatrixSpace
SumMatrixSpace(Index nrows, Index ncols, Index nterms)
Constructor, given the number of row and columns, as well as the number of terms in the sum...
Definition: IpSumMatrix.hpp:111
Ipopt::SumMatrixSpace::term_spaces_
std::vector< SmartPtr< const MatrixSpace > > term_spaces_
Definition: IpSumMatrix.hpp:163
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::SumMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
IpMatrix.hpp
Ipopt::SumMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Ipopt::SumMatrixSpace
Class for matrix space for SumMatrix.
Definition: IpSumMatrix.hpp:103
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::SumMatrixSpace::~SumMatrixSpace
virtual ~SumMatrixSpace()
Destructor.
Definition: IpSumMatrix.hpp:118
Ipopt::SumMatrix::matrices_
std::vector< SmartPtr< const Matrix > > matrices_
std::vector storing the matrices for each term.
Definition: IpSumMatrix.hpp:96
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::SumMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
Ipopt::SumMatrixSpace::MakeNewSumMatrix
SumMatrix * MakeNewSumMatrix() const
Method for creating a new matrix of this specific type.
Ipopt::SumMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Ipopt::SumMatrix::~SumMatrix
virtual ~SumMatrix()
Destructor.
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::SumMatrixSpace::GetTermSpace
SmartPtr< const MatrixSpace > GetTermSpace(Index term_idx) const
Get the matrix space for a particular term.
Ipopt::SumMatrixSpace::SetTermSpace
void SetTermSpace(Index term_idx, const MatrixSpace &mat_space)
Set the appropriate matrix space for each term.
Ipopt::SumMatrix::factors_
std::vector< Number > factors_
std::vector storing the factors for each term.
Definition: IpSumMatrix.hpp:93
Ipopt::SumMatrixSpace::NTerms
Index NTerms() const
Accessor functions to get the number of terms in the sum.
Definition: IpSumMatrix.hpp:123
Ipopt::SumMatrix::operator=
void operator=(const SumMatrix &)
Overloaded Equals Operator.
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::SumMatrix::GetTerm
void GetTerm(Index iterm, Number &factor, SmartPtr< const Matrix > &matrix) const
Method for getting term iterm for the sum.
Ipopt::SumMatrix
Class for Matrices which are sum of matrices.
Definition: IpSumMatrix.hpp:24
Ipopt::SumMatrixSpace::nterms_
const Index nterms_
Definition: IpSumMatrix.hpp:161
Ipopt::SumMatrix::owner_space_
const SumMatrixSpace * owner_space_
Copy of the owner_space as a SumMatrixSpace.
Definition: IpSumMatrix.hpp:99
Ipopt::SumMatrix::PrintImpl
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Print detailed information about the matrix.
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70