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:
23 
26  const TransposeMatrixSpace* owner_space
27  );
28 
31  { }
32 
34  {
35  return ConstPtr(orig_matrix_);
36  }
38 
39 protected:
41  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:
107 
109  TransposeMatrix();
110 
113  const TransposeMatrix&
114  );
115 
117  void operator=(
118  const TransposeMatrix&
119  );
121 
124 };
125 
128 {
129 public:
131 
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:
170 
173 
176  const TransposeMatrixSpace&
177  );
178 
180  void operator=(
181  const TransposeMatrixSpace&
182  );
184 
187 };
188 
189 } // namespace Ipopt
190 #endif
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:672
void operator=(const TransposeMatrix &)
Default Assignment Operator.
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:350
SmartPtr< const Matrix > OrigMatrix() const
void operator=(const TransposeMatrixSpace &)
Default Assignment Operator.
SmartPtr< const MatrixSpace > orig_matrix_space_
Matrix space of the original matrix.
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix(transpose) vector multiply.
Vector Base Class.
Definition: IpVector.hpp:47
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
EJournalLevel
Print Level Enum.
TransposeMatrix * MakeNewTransposeMatrix() const
Method for creating a new matrix of this specific type.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:164
virtual bool HasValidNumbersImpl() const
Method for determining if all stored numbers are valid (i.e., no Inf or Nan).
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.
Index NCols() const
Accessor function for the number of columns.
Definition: IpMatrix.hpp:356
virtual void ComputeRowAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the rows in the matrix.
Matrix Base Class.
Definition: IpMatrix.hpp:27
TransposeMatrix()
Default Constructor.
Class for Matrices which are the transpose of another matrix.
This is the matrix space for TransposeMatrix.
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:326
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:27
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:663
TransposeMatrixSpace(const MatrixSpace *orig_matrix_space)
Constructor, given the dimension of the matrix.
Class responsible for all message output.
virtual void ComputeColAMaxImpl(Vector &rows_norms, bool init) const
Compute the max-norm of the columns in the matrix.
TransposeMatrixSpace()
Default Constructor.
SmartPtr< Matrix > orig_matrix_
Pointer to original matrix.
virtual ~TransposeMatrixSpace()
Destructor.
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
EJournalCategory
Category Selection Enum.