Ipopt Documentation  
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 // Authors: Andreas Waechter IBM 2008-08-25
6 
7 #ifndef __IPTRANSPOSEMATRIX_HPP__
8 #define __IPTRANSPOSEMATRIX_HPP__
9 
10 #include "IpMatrix.hpp"
11 
12 namespace Ipopt
13 {
14 
15 /* forward declarations */
16 class TransposeMatrixSpace;
17 
19 class TransposeMatrix: public Matrix
20 {
21 public:
26  const TransposeMatrixSpace* owner_space
27  );
28 
31  { }
32 
34  {
35  return ConstPtr(orig_matrix_);
36  }
38 
39 protected:
42  virtual void MultVectorImpl(
43  Number alpha,
44  const Vector& x,
45  Number beta,
46  Vector& y
47  ) const
48  {
50  orig_matrix_->TransMultVector(alpha, x, beta, y);
51  }
52 
53  virtual void TransMultVectorImpl(
54  Number alpha,
55  const Vector& x,
56  Number beta,
57  Vector& y
58  ) const
59  {
61  orig_matrix_->MultVector(alpha, x, beta, y);
62  }
63 
64  virtual bool HasValidNumbersImpl() const
65  {
67  return orig_matrix_->HasValidNumbers();
68  }
69 
70  virtual void ComputeRowAMaxImpl(
71  Vector& rows_norms,
72  bool init
73  ) const
74  {
76  orig_matrix_->ComputeColAMax(rows_norms, init);
77  }
78 
79  virtual void ComputeColAMaxImpl(
80  Vector& rows_norms,
81  bool init
82  ) const
83  {
85  orig_matrix_->ComputeRowAMax(rows_norms, init);
86  }
87 
88  virtual void PrintImpl(
89  const Journalist& jnlst,
90  EJournalLevel level,
91  EJournalCategory category,
92  const std::string& name,
93  Index indent,
94  const std::string& prefix
95  ) const;
97 
98 private:
110 
113  const TransposeMatrix&
114  );
115 
117  void operator=(
118  const TransposeMatrix&
119  );
121 
124 };
125 
128 {
129 public:
134  const MatrixSpace* orig_matrix_space
135  )
136  : MatrixSpace(orig_matrix_space->NCols(), orig_matrix_space->NRows()),
137  orig_matrix_space_(orig_matrix_space)
138  { }
139 
142  { }
144 
145  virtual Matrix* MakeNew() const
146  {
147  return MakeNewTransposeMatrix();
148  }
149 
152  {
153  return new TransposeMatrix(this);
154  }
155 
157  {
158  return orig_matrix_space_->MakeNew();
159  }
160 
161 private:
173 
176  const TransposeMatrixSpace&
177  );
178 
180  void operator=(
181  const TransposeMatrixSpace&
182  );
184 
187 };
188 
189 } // namespace Ipopt
190 #endif
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:327
Ipopt::TransposeMatrixSpace::~TransposeMatrixSpace
virtual ~TransposeMatrixSpace()
Destructor.
Definition: IpTransposeMatrix.hpp:141
Ipopt::TransposeMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
Definition: IpTransposeMatrix.hpp:145
Ipopt::TransposeMatrix::TransposeMatrix
TransposeMatrix(const TransposeMatrixSpace *owner_space)
Constructor, initializing with dimensions of the matrix.
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:79
Ipopt::TransposeMatrixSpace::MakeNewTransposeMatrix
TransposeMatrix * MakeNewTransposeMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpTransposeMatrix.hpp:151
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace(const TransposeMatrixSpace &)
Copy Constructor.
Ipopt
This file contains a base class for all exceptions and a set of macros to help with exceptions.
Definition: IpInexactAlgBuilder.hpp:14
Ipopt::TransposeMatrix::orig_matrix_
SmartPtr< Matrix > orig_matrix_
Pointer to original matrix.
Definition: IpTransposeMatrix.hpp:123
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:28
Ipopt::TransposeMatrix::TransposeMatrix
TransposeMatrix()
Default Constructor.
Ipopt::TransposeMatrixSpace::orig_matrix_space_
SmartPtr< const MatrixSpace > orig_matrix_space_
Matrix space of the original matrix.
Definition: IpTransposeMatrix.hpp:186
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:32
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:64
Ipopt::TransposeMatrix::TransMultVectorImpl
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
Definition: IpTransposeMatrix.hpp:53
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
Ipopt::EJournalCategory
EJournalCategory
Category Selection Enum.
Definition: IpJournalist.hpp:52
Ipopt::MatrixSpace::NCols
Index NCols() const
Accessor function for the number of columns.
Definition: IpMatrix.hpp:356
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace()
Default Constructor.
Ipopt::TransposeMatrix::operator=
void operator=(const TransposeMatrix &)
Default Assignment Operator.
Ipopt::TransposeMatrixSpace
This is the matrix space for TransposeMatrix.
Definition: IpTransposeMatrix.hpp:128
Ipopt::TransposeMatrixSpace::MakeNewOrigMatrix
Matrix * MakeNewOrigMatrix() const
Definition: IpTransposeMatrix.hpp:156
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:665
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:117
IpMatrix.hpp
Ipopt::TransposeMatrix::~TransposeMatrix
~TransposeMatrix()
Destructor.
Definition: IpTransposeMatrix.hpp:30
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:674
Ipopt::TransposeMatrix
Class for Matrices which are the transpose of another matrix.
Definition: IpTransposeMatrix.hpp:20
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:70
Ipopt::MatrixSpace::NRows
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:350
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:28
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.
Ipopt::TransposeMatrixSpace::operator=
void operator=(const TransposeMatrixSpace &)
Default Assignment Operator.
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace(const MatrixSpace *orig_matrix_space)
Constructor, given the dimension of the matrix.
Definition: IpTransposeMatrix.hpp:133
Ipopt::TransposeMatrix::TransposeMatrix
TransposeMatrix(const TransposeMatrix &)
Copy Constructor.
Ipopt::TransposeMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition: IpTransposeMatrix.hpp:42
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:48
Ipopt::TransposeMatrix::OrigMatrix
SmartPtr< const Matrix > OrigMatrix() const
Definition: IpTransposeMatrix.hpp:33