Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __IPSYMMATRIX_HPP__
00010 #define __IPSYMMATRIX_HPP__
00011
00012 #include "IpUtils.hpp"
00013 #include "IpMatrix.hpp"
00014
00015 namespace Ipopt
00016 {
00017
00018
00019 class SymMatrixSpace;
00020
00023 class SymMatrix : public Matrix
00024 {
00025 public:
00030 SymMatrix(const SymMatrixSpace* owner_space);
00031
00033 virtual ~SymMatrix()
00034 {}
00036
00040 Index Dim() const;
00042
00043 SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const;
00044
00045 protected:
00053 virtual void TransMultVectorImpl(Number alpha, const Vector& x, Number beta,
00054 Vector& y) const
00055 {
00056
00057
00058 MultVector(alpha, x, beta, y);
00059 }
00062 virtual void ComputeColAMaxImpl(Vector& cols_norms, bool init) const
00063 {
00064 ComputeRowAMaxImpl(cols_norms, init);
00065 }
00067
00068 private:
00072 const SymMatrixSpace* owner_space_;
00073 };
00074
00075
00078 class SymMatrixSpace : public MatrixSpace
00079 {
00080 public:
00086 SymMatrixSpace(Index dim)
00087 :
00088 MatrixSpace(dim,dim)
00089 {}
00090
00092 virtual ~SymMatrixSpace()
00093 {}
00095
00098 virtual SymMatrix* MakeNewSymMatrix() const=0;
00099
00102 virtual Matrix* MakeNew() const
00103 {
00104 return MakeNewSymMatrix();
00105 }
00106
00110 Index Dim() const
00111 {
00112 DBG_ASSERT(NRows() == NCols());
00113 return NRows();
00114 }
00115
00116 private:
00126 SymMatrixSpace();
00127
00128
00129 SymMatrixSpace(const SymMatrixSpace&);
00130
00132 SymMatrixSpace& operator=(const SymMatrixSpace&);
00134
00135 };
00136
00137
00138 inline
00139 SymMatrix::SymMatrix(const SymMatrixSpace* owner_space)
00140 :
00141 Matrix(owner_space),
00142 owner_space_(owner_space)
00143 {}
00144
00145 inline
00146 Index SymMatrix::Dim() const
00147 {
00148 return owner_space_->Dim();
00149 }
00150
00151 inline
00152 SmartPtr<const SymMatrixSpace> SymMatrix::OwnerSymMatrixSpace() const
00153 {
00154 return owner_space_;
00155 }
00156
00157 }
00158
00159 #endif