1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Copyright (C) 2008 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors: Andreas Waechter IBM 2008-08-25
#ifndef __IPTRANSPOSEMATRIX_HPP__
#define __IPTRANSPOSEMATRIX_HPP__
#include "IpMatrix.hpp"
namespace Ipopt
{
/* forward declarations */
class TransposeMatrixSpace;
/** Class for Matrices which are the transpose of another matrix. */
class TransposeMatrix: public Matrix
{
public:
/**@name Constructors / Destructors */
///@{
/** Constructor, initializing with dimensions of the matrix. */
TransposeMatrix(
const TransposeMatrixSpace* owner_space
);
/** Destructor */
~TransposeMatrix()
{ }
SmartPtr<const Matrix> OrigMatrix() const
{
return ConstPtr(orig_matrix_);
}
///@}
protected:
/**@name Methods overloaded from matrix */
///@{
virtual void MultVectorImpl(
Number alpha,
const Vector& x,
Number beta,
Vector& y
) const
{
DBG_ASSERT(IsValid(orig_matrix_));
orig_matrix_->TransMultVector(alpha, x, beta, y);
}
virtual void TransMultVectorImpl(
Number alpha,
const Vector& x,
Number beta,
Vector& y
) const
{
DBG_ASSERT(IsValid(orig_matrix_));
orig_matrix_->MultVector(alpha, x, beta, y);
}
virtual bool HasValidNumbersImpl() const
{
DBG_ASSERT(IsValid(orig_matrix_));
return orig_matrix_->HasValidNumbers();
}
virtual void ComputeRowAMaxImpl(
Vector& rows_norms,
bool init
) const
{
DBG_ASSERT(IsValid(orig_matrix_));
orig_matrix_->ComputeColAMax(rows_norms, init);
}
virtual void ComputeColAMaxImpl(
Vector& rows_norms,
bool init
) const
{
DBG_ASSERT(IsValid(orig_matrix_));
orig_matrix_->ComputeRowAMax(rows_norms, init);
}
virtual void PrintImpl(
const Journalist& jnlst,
EJournalLevel level,
EJournalCategory category,
const std::string& name,
Index indent,
const std::string& prefix
) const;
///@}
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called.
*/
///@{
/** Default Constructor */
TransposeMatrix();
/** Copy Constructor */
TransposeMatrix(
const TransposeMatrix&
);
/** Default Assignment Operator */
void operator=(
const TransposeMatrix&
);
///@}
/** Pointer to original matrix */
SmartPtr<Matrix> orig_matrix_;
};
/** This is the matrix space for TransposeMatrix. */
class TransposeMatrixSpace: public MatrixSpace
{
public:
/** @name Constructors / Destructors */
///@{
/** Constructor, given the dimension of the matrix. */
TransposeMatrixSpace(
const MatrixSpace* orig_matrix_space
)
: MatrixSpace(orig_matrix_space->NCols(), orig_matrix_space->NRows()),
orig_matrix_space_(orig_matrix_space)
{ }
/** Destructor */
virtual ~TransposeMatrixSpace()
{ }
///@}
virtual Matrix* MakeNew() const
{
return MakeNewTransposeMatrix();
}
/** Method for creating a new matrix of this specific type. */
TransposeMatrix* MakeNewTransposeMatrix() const
{
return new TransposeMatrix(this);
}
Matrix* MakeNewOrigMatrix() const
{
return orig_matrix_space_->MakeNew();
}
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called.
*/
///@{
/** Default Constructor */
TransposeMatrixSpace();
/** Copy Constructor */
TransposeMatrixSpace(
const TransposeMatrixSpace&
);
/** Default Assignment Operator */
void operator=(
const TransposeMatrixSpace&
);
///@}
/** Matrix space of the original matrix */
SmartPtr<const MatrixSpace> orig_matrix_space_;
};
} // namespace Ipopt
#endif