IpSymTMatrix.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2006 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpSymTMatrix.hpp 759 2006-07-07 03:07:08Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
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   /* forward declarations */
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 PrintImpl(const Journalist& jnlst,
00116                            EJournalLevel level,
00117                            EJournalCategory category,
00118                            const std::string& name,
00119                            Index indent,
00120                            const std::string& prefix) const;
00122 
00123   private:
00133     SymTMatrix();
00134 
00136     SymTMatrix(const SymTMatrix&);
00137 
00139     void operator=(const SymTMatrix&);
00141 
00145     const SymTMatrixSpace* owner_space_;
00146 
00148     Number* values_;
00149 
00151     bool initialized_;
00152 
00153   };
00154 
00159   class SymTMatrixSpace : public SymMatrixSpace
00160   {
00161   public:
00172     SymTMatrixSpace(Index dim, Index nonZeros, const Index* iRows,
00173                     const Index* jCols);
00174 
00176     ~SymTMatrixSpace();
00178 
00181     virtual SymMatrix* MakeNewSymMatrix() const
00182     {
00183       return MakeNewSymTMatrix();
00184     }
00185 
00187     SymTMatrix* MakeNewSymTMatrix() const
00188     {
00189       return new SymTMatrix(this);
00190     }
00191 
00195     Index Nonzeros() const
00196     {
00197       return nonZeros_;
00198     }
00199 
00201     const Index* Irows() const
00202     {
00203       return iRows_;
00204     }
00205 
00207     const Index* Jcols() const
00208     {
00209       return jCols_;
00210     }
00212 
00213   private:
00217     Number* AllocateInternalStorage() const;
00218 
00220     void FreeInternalStorage(Number* values) const;
00222 
00223     const Index nonZeros_;
00224     Index* iRows_;
00225     Index* jCols_;
00226 
00227     friend class SymTMatrix;
00228   };
00229 
00230   /* Inline Methods */
00231   inline
00232   Index SymTMatrix::Nonzeros() const
00233   {
00234     return owner_space_->Nonzeros();
00235   }
00236 
00237   inline
00238   const Index* SymTMatrix::Irows() const
00239   {
00240     return owner_space_->Irows();
00241   }
00242 
00243   inline
00244   const Index* SymTMatrix::Jcols() const
00245   {
00246     return owner_space_->Jcols();
00247   }
00248 
00249 
00250 } // namespace Ipopt
00251 #endif

Generated on Fri Sep 26 07:44:13 2008 for SimTKcore by  doxygen 1.5.6