Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __IPTRANSPOSEMATRIX_HPP__
00010 #define __IPTRANSPOSEMATRIX_HPP__
00011
00012 #include "IpMatrix.hpp"
00013
00014 namespace Ipopt
00015 {
00016
00017
00018 class TransposeMatrixSpace;
00019
00023 class TransposeMatrix : public Matrix
00024 {
00025 public:
00026
00029
00032 TransposeMatrix(const TransposeMatrixSpace* owner_space);
00033
00035 ~TransposeMatrix()
00036 {}
00037
00038 SmartPtr<const Matrix> OrigMatrix() const
00039 {
00040 return ConstPtr(orig_matrix_);
00041 }
00043
00044 protected:
00047 virtual void MultVectorImpl(Number alpha, const Vector& x,
00048 Number beta, Vector& y) const
00049 {
00050 DBG_ASSERT(IsValid(orig_matrix_));
00051 orig_matrix_->TransMultVector(alpha, x, beta, y);
00052 }
00053
00054 virtual void TransMultVectorImpl(Number alpha, const Vector& x,
00055 Number beta, Vector& y) const
00056 {
00057 DBG_ASSERT(IsValid(orig_matrix_));
00058 orig_matrix_->MultVector(alpha, x, beta, y);
00059 }
00060
00063 virtual bool HasValidNumbersImpl() const
00064 {
00065 DBG_ASSERT(IsValid(orig_matrix_));
00066 return orig_matrix_->HasValidNumbers();
00067 }
00068
00069 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const
00070 {
00071 DBG_ASSERT(IsValid(orig_matrix_));
00072 orig_matrix_->ComputeColAMax(rows_norms, init);
00073 }
00074
00075 virtual void ComputeColAMaxImpl(Vector& rows_norms, bool init) const
00076 {
00077 DBG_ASSERT(IsValid(orig_matrix_));
00078 orig_matrix_->ComputeRowAMax(rows_norms, init);
00079 }
00080
00081 virtual void PrintImpl(const Journalist& jnlst,
00082 EJournalLevel level,
00083 EJournalCategory category,
00084 const std::string& name,
00085 Index indent,
00086 const std::string& prefix) const;
00088
00089 private:
00099 TransposeMatrix();
00100
00102 TransposeMatrix(const TransposeMatrix&);
00103
00105 void operator=(const TransposeMatrix&);
00107
00109 SmartPtr<Matrix> orig_matrix_;
00110 };
00111
00113 class TransposeMatrixSpace : public MatrixSpace
00114 {
00115 public:
00119 TransposeMatrixSpace(const MatrixSpace* orig_matrix_space)
00120 :
00121 MatrixSpace(orig_matrix_space->NCols(), orig_matrix_space->NRows()),
00122 orig_matrix_space_(orig_matrix_space)
00123 {}
00124
00126 virtual ~TransposeMatrixSpace()
00127 {}
00129
00132 virtual Matrix* MakeNew() const
00133 {
00134 return MakeNewTransposeMatrix();
00135 }
00136
00138 TransposeMatrix* MakeNewTransposeMatrix() const
00139 {
00140 return new TransposeMatrix(this);
00141 }
00142
00143 Matrix* MakeNewOrigMatrix() const
00144 {
00145 return orig_matrix_space_->MakeNew();
00146 }
00147
00148 private:
00158 TransposeMatrixSpace();
00159
00161 TransposeMatrixSpace(const TransposeMatrixSpace&);
00162
00164 void operator=(const TransposeMatrixSpace&);
00166
00168 SmartPtr<const MatrixSpace> orig_matrix_space_;
00169 };
00170
00171 }
00172 #endif