Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __IPSYMTMATRIX_HPP__
00010 #define __IPSYMTMATRIX_HPP__
00011
00012 #include "IpUtils.hpp"
00013 #include "IpSymMatrix.hpp"
00014
00015 namespace Ipopt
00016 {
00017
00018
00019 class SymTMatrixSpace;
00020
00042 class SymTMatrix : public SymMatrix
00043 {
00044 public:
00045
00048
00051 SymTMatrix(const SymTMatrixSpace* owner_space);
00052
00054 ~SymTMatrix();
00056
00064 void SetValues(const Number* Values);
00066
00070 Index Nonzeros() const;
00071
00076 const Index* Irows() const;
00077
00082 const Index* Jcols() const;
00083
00088 Number* Values();
00093 const Number* Values() const;
00095
00099 void FillStruct(ipfint* Irn, ipfint* Jcn) const;
00100
00102 void FillValues(Number* Values) const;
00104
00105 protected:
00108 virtual void MultVectorImpl(Number alpha, const Vector& x, Number beta,
00109 Vector& y) const;
00110
00113 virtual bool HasValidNumbersImpl() const;
00114
00115 virtual void ComputeRowAMaxImpl(Vector& rows_norms, bool init) const;
00116
00117 virtual void PrintImpl(const Journalist& jnlst,
00118 EJournalLevel level,
00119 EJournalCategory category,
00120 const std::string& name,
00121 Index indent,
00122 const std::string& prefix) const;
00124
00125 private:
00135 SymTMatrix();
00136
00138 SymTMatrix(const SymTMatrix&);
00139
00141 void operator=(const SymTMatrix&);
00143
00147 const SymTMatrixSpace* owner_space_;
00148
00150 Number* values_;
00151
00153 bool initialized_;
00154
00155 };
00156
00161 class SymTMatrixSpace : public SymMatrixSpace
00162 {
00163 public:
00174 SymTMatrixSpace(Index dim, Index nonZeros, const Index* iRows,
00175 const Index* jCols);
00176
00178 ~SymTMatrixSpace();
00180
00183 virtual SymMatrix* MakeNewSymMatrix() const
00184 {
00185 return MakeNewSymTMatrix();
00186 }
00187
00189 SymTMatrix* MakeNewSymTMatrix() const
00190 {
00191 return new SymTMatrix(this);
00192 }
00193
00197 Index Nonzeros() const
00198 {
00199 return nonZeros_;
00200 }
00201
00203 const Index* Irows() const
00204 {
00205 return iRows_;
00206 }
00207
00209 const Index* Jcols() const
00210 {
00211 return jCols_;
00212 }
00214
00215 private:
00219 Number* AllocateInternalStorage() const;
00220
00222 void FreeInternalStorage(Number* values) const;
00224
00225 const Index nonZeros_;
00226 Index* iRows_;
00227 Index* jCols_;
00228
00229 friend class SymTMatrix;
00230 };
00231
00232
00233 inline
00234 Index SymTMatrix::Nonzeros() const
00235 {
00236 return owner_space_->Nonzeros();
00237 }
00238
00239 inline
00240 const Index* SymTMatrix::Irows() const
00241 {
00242 return owner_space_->Irows();
00243 }
00244
00245 inline
00246 const Index* SymTMatrix::Jcols() const
00247 {
00248 return owner_space_->Jcols();
00249 }
00250
00251
00252 }
00253 #endif