Ipopt  3.11.9
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 1861 2010-12-21 21:34:47Z andreasw $
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
Ipopt::MatrixSpace
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:239
Ipopt::TransposeMatrixSpace::~TransposeMatrixSpace
virtual ~TransposeMatrixSpace()
Destructor.
Definition: IpTransposeMatrix.hpp:126
Ipopt::TransposeMatrixSpace::MakeNew
virtual Matrix * MakeNew() const
Overloaded MakeNew method for the MatrixSpace base class.
Definition: IpTransposeMatrix.hpp:132
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::TransposeMatrixSpace::MakeNewTransposeMatrix
TransposeMatrix * MakeNewTransposeMatrix() const
Method for creating a new matrix of this specific type.
Definition: IpTransposeMatrix.hpp:138
Ipopt
Definition: matlabjournal.hpp:14
Ipopt::TransposeMatrix::orig_matrix_
SmartPtr< Matrix > orig_matrix_
Pointer to original matrix.
Definition: IpTransposeMatrix.hpp:109
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
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:168
Ipopt::EJournalLevel
EJournalLevel
Print Level Enum.
Definition: IpJournalist.hpp:51
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
x
Number * x
Input: Starting point Output: Optimal solution.
Definition: IpStdCInterface.h:238
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::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::SmartPtr
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:182
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
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace()
Default Constructor.
Ipopt::TransposeMatrix::operator=
void operator=(const TransposeMatrix &)
Overloaded Equals Operator.
Ipopt::TransposeMatrixSpace
This is the matrix space for TransposeMatrix.
Definition: IpTransposeMatrix.hpp:113
Ipopt::TransposeMatrixSpace::MakeNewOrigMatrix
Matrix * MakeNewOrigMatrix() const
Definition: IpTransposeMatrix.hpp:143
Ipopt::ConstPtr
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:582
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
IpMatrix.hpp
Ipopt::TransposeMatrix::~TransposeMatrix
~TransposeMatrix()
Destructor.
Definition: IpTransposeMatrix.hpp:35
Ipopt::IsValid
bool IsValid(const SmartPtr< U > &smart_ptr)
Definition: IpSmartPtr.hpp:589
Ipopt::TransposeMatrix
Class for Matrices which are the transpose of another matrix.
Definition: IpTransposeMatrix.hpp:23
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::MatrixSpace::NRows
Index NRows() const
Accessor function for the number of rows.
Definition: IpMatrix.hpp:264
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
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 &)
Overloaded Equals Operator.
Ipopt::TransposeMatrixSpace::TransposeMatrixSpace
TransposeMatrixSpace(const MatrixSpace *orig_matrix_space)
Constructor, given the dimension of the matrix.
Definition: IpTransposeMatrix.hpp:119
Ipopt::TransposeMatrix::MultVectorImpl
virtual void MultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Matrix-vector multiply.
Definition: IpTransposeMatrix.hpp:47
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47
Ipopt::TransposeMatrix::OrigMatrix
SmartPtr< const Matrix > OrigMatrix() const
Definition: IpTransposeMatrix.hpp:38