Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpTransposeMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpTransposeMatrix.hpp 2269 2013-05-05 11:32:40Z stefan $
6 //
7 // Authors: Andreas Waechter IBM 2008-08-25
8
9 #ifndef __IPTRANSPOSEMATRIX_HPP__
10 #define __IPTRANSPOSEMATRIX_HPP__
11
12 #include "IpMatrix.hpp"
13
14 namespace Ipopt
15 {
16
17 /* forward declarations */
18 class TransposeMatrixSpace;
19
23 class TransposeMatrix : public Matrix
24 {
25 public:
26
29
32 TransposeMatrix(const TransposeMatrixSpace* owner_space);
33
35 ~TransposeMatrix()
36 {}
37
38 SmartPtr<const Matrix> OrigMatrix() const
39 {
40 return ConstPtr(orig_matrix_);
41 }
43
44 protected:
47 virtual void MultVectorImpl(Number alpha, const Vector& x,
48 Number beta, Vector& y) const
49 {
50 DBG_ASSERT(IsValid(orig_matrix_));
51 orig_matrix_->TransMultVector(alpha, x, beta, y);
52 }
53
54 virtual void TransMultVectorImpl(Number alpha, const Vector& x,
55 Number beta, Vector& y) const
56 {
57 DBG_ASSERT(IsValid(orig_matrix_));
58 orig_matrix_->MultVector(alpha, x, beta, y);
59 }
60
63 virtual bool HasValidNumbersImpl() const
64 {
65 DBG_ASSERT(IsValid(orig_matrix_));
66 return orig_matrix_->HasValidNumbers();
67 }
68
69 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const
70 {
71 DBG_ASSERT(IsValid(orig_matrix_));
72 orig_matrix_->ComputeColAMax(rows_norms, init);
73 }
74
75 virtual void ComputeColAMaxImpl(Vector& rows_norms, bool init) const
76 {
77 DBG_ASSERT(IsValid(orig_matrix_));
78 orig_matrix_->ComputeRowAMax(rows_norms, init);
79 }
80
81 virtual void PrintImpl(const Journalist& jnlst,
82 EJournalLevel level,
83 EJournalCategory category,
84 const std::string& name,
85 Index indent,
86 const std::string& prefix) const;
88
89 private:
99 TransposeMatrix();
100
102 TransposeMatrix(const TransposeMatrix&);
103
105 void operator=(const TransposeMatrix&);
107
109 SmartPtr<Matrix> orig_matrix_;
110 };
111
113 class TransposeMatrixSpace : public MatrixSpace
114 {
115 public:
119 TransposeMatrixSpace(const MatrixSpace* orig_matrix_space)
120 :
121 MatrixSpace(orig_matrix_space->NCols(), orig_matrix_space->NRows()),
122 orig_matrix_space_(orig_matrix_space)
123 {}
124
126 virtual ~TransposeMatrixSpace()
127 {}
129
132 virtual Matrix* MakeNew() const
133 {
134 return MakeNewTransposeMatrix();
135 }
136
138 TransposeMatrix* MakeNewTransposeMatrix() const
139 {
140 return new TransposeMatrix(this);
141 }
142
143 Matrix* MakeNewOrigMatrix() const
144 {
145 return orig_matrix_space_->MakeNew();
146 }
147
148 private:
158 TransposeMatrixSpace();
159
161 TransposeMatrixSpace(const TransposeMatrixSpace&);
162
164 void operator=(const TransposeMatrixSpace&);
166
168 SmartPtr<const MatrixSpace> orig_matrix_space_;
169 };
170
171 } // namespace Ipopt
172 #endif
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
Ipopt::TransposeMatrix::operator=
void operator=(const TransposeMatrix &)
Overloaded Equals Operator.
Ipopt::TransposeMatrixSpace::operator=
void operator=(const TransposeMatrixSpace &)
Overloaded Equals Operator.
Ipopt::TransposeMatrix::OrigMatrix
SmartPtr< const Matrix > OrigMatrix() const
Definition: IpTransposeMatrix.hpp:38
Ipopt::TransposeMatrixSpace::orig_matrix_space_
SmartPtr< const MatrixSpace > orig_matrix_space_
Matrix space of the original matrix.
Definition: IpTransposeMatrix.hpp:168
Ipopt::MatrixSpace::NRows
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:264
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::TransposeMatrixSpace::MakeNewTransposeMatrix
TransposeMatrix * MakeNewTransposeMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpTransposeMatrix.hpp:138
IpMatrix.hpp
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
Ipopt::TransposeMatrixSpace::MakeNewOrigMatrix
Matrix * MakeNewOrigMatrix() const
Definition: IpTransposeMatrix.hpp:143
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::TransposeMatrix::ComputeColAMaxImpl
virtual void ComputeColAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the columns in the matrix.
Definition: IpTransposeMatrix.hpp:75
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
Ipopt::TransposeMatrix::TransposeMatrix
TransposeMatrix()
Default Constructor.
Ipopt::TransposeMatrix
Class for Matrices which are the transpose of another matrix.
Definition: IpTransposeMatrix.hpp:23
Ipopt::TransposeMatrix::HasValidNumbersImpl
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
Definition: IpTransposeMatrix.hpp:63
Ipopt::TransposeMatrixSpace
This is the matrix space for TransposeMatrix.
Definition: IpTransposeMatrix.hpp:113
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::TransposeMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition: IpTransposeMatrix.hpp:47
Ipopt::TransposeMatrix::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.
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::TransposeMatrix::ComputeRowAMaxImpl
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Definition: IpTransposeMatrix.hpp:69
Ipopt::TransposeMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Definition: IpTransposeMatrix.hpp:132
Ipopt::TransposeMatrix::~TransposeMatrix
~TransposeMatrix()
Destructor.
Definition: IpTransposeMatrix.hpp:35
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace(const MatrixSpace *orig_matrix_space)
Constructor, given the dimension of the matrix.
Definition: IpTransposeMatrix.hpp:119
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace()
Default Constructor.
Ipopt::TransposeMatrix::orig_matrix_
SmartPtr< Matrix > orig_matrix_
Pointer to original matrix.
Definition: IpTransposeMatrix.hpp:109
Ipopt::TransposeMatrixSpace::~TransposeMatrixSpace
virtual ~TransposeMatrixSpace()
Destructor.
Definition: IpTransposeMatrix.hpp:126
Ipopt::TransposeMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
Definition: IpTransposeMatrix.hpp:54
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:70
Ipopt::MatrixSpace::NCols
Index NCols() const
Accessor function for the number of columns.
Definition: IpMatrix.hpp:269