Ipopt  3.12.8
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 
36  {}
37 
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  {
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  {
58  orig_matrix_->MultVector(alpha, x, beta, y);
59  }
60 
63  virtual bool HasValidNumbersImpl() const
64  {
66  return orig_matrix_->HasValidNumbers();
67  }
68 
69  virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const
70  {
72  orig_matrix_->ComputeColAMax(rows_norms, init);
73  }
74 
75  virtual void ComputeColAMaxImpl(Vector& rows_norms, bool init) const
76  {
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:
100 
103 
105  void operator=(const TransposeMatrix&);
107 
110  };
111 
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 
127  {}
129 
132  virtual Matrix* MakeNew() const
133  {
134  return MakeNewTransposeMatrix();
135  }
136 
139  {
140  return new TransposeMatrix(this);
141  }
142 
144  {
145  return orig_matrix_space_->MakeNew();
146  }
147 
148  private:
159 
162 
164  void operator=(const TransposeMatrixSpace&);
166 
169  };
170 
171 } // namespace Ipopt
172 #endif
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:579
Number * x
Input: Starting point Output: Optimal solution.
void operator=(const TransposeMatrix &)
Overloaded Equals Operator.
SmartPtr< const Matrix > OrigMatrix() const
SmartPtr< const MatrixSpace > orig_matrix_space_
Matrix space of the original matrix.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
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
Overloaded MakeNew method for the MatrixSpace base class.
EJournalLevel
Print Level Enum.
TransposeMatrix * MakeNewTransposeMatrix() const
Method for creating a new matrix of this specific type.
Index NCols() const
Number of columns.
Definition: IpMatrix.hpp:316
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:172
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.
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:239
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Index NRows() const
Number of rows.
Definition: IpMatrix.hpp:310
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:572
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.
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.