IpTripletToDenseConverter.hpp

Go to the documentation of this file.
00001 
00002 #ifndef __IPTRIPLETTODENSECONVERTER_HPP__
00003 #define __IPTRIPLETTODENSECONVERTER_HPP__
00004 
00005 #include "IpUtils.hpp"
00006 #include "IpReferenced.hpp"
00007 namespace Ipopt
00008 {
00009 
00013   class TripletToDenseConverter: public ReferencedObject
00014   {
00016     class TripletEntry
00017     {
00018     public:
00022       TripletEntry()
00023       {}
00024 
00026       ~TripletEntry()
00027       {}
00028 
00033       TripletEntry(const TripletEntry&)
00034       {}
00036 
00038       void Set(Index i_row, Index j_col, Index i_pos_triplet)
00039       {
00040         if (i_row>j_col) {
00041           i_row_ = j_col;
00042           j_col_ = i_row;
00043         }
00044         else {
00045           i_row_ = i_row;
00046           j_col_ = j_col;
00047         }
00048         i_pos_triplet_ = i_pos_triplet;
00049       }
00050 
00054       Index IRow() const
00055       {
00056         return i_row_;
00057       }
00059       Index JCol() const
00060       {
00061         return j_col_;
00062       }
00064       Index PosTriplet() const
00065       {
00066         return i_pos_triplet_;
00067       }
00069 
00071       bool operator< (const TripletEntry& Tentry) const
00072       {
00073         return ((i_row_ < Tentry.i_row_) ||
00074                 (i_row_==Tentry.i_row_ && j_col_<Tentry.j_col_));
00075       }
00076 
00077     private:
00087       //TripletEntry();
00088 
00090       /*
00091       TripletEntry(const TripletEntry&);
00092       */
00093 
00095       void operator=(const TripletEntry&);
00097 
00100       Index i_row_;
00101       Index j_col_;
00102       Index i_pos_triplet_;
00104     };
00105 
00106   public:
00109     /* Constructor.  If offset is 0, then the counting of indices in
00110        the compressed format starts a 0 (C-style numbering); if offset
00111        is 1, then the counting starts at 1 (Fortran-type
00112        numbering). */
00113     TripletToDenseConverter(Index offset);
00114 
00116     virtual ~TripletToDenseConverter();
00118 
00129     Index InitializeConverter(Index dim, Index nonzeros,
00130                               const Index* airn,
00131                               const Index* ajcn);
00132 
00134     const Index* IA() const
00135     {
00136       DBG_ASSERT(initialized_);
00137       return ia_;
00138     }
00139 
00141     const Index* JA() const
00142     {
00143       DBG_ASSERT(initialized_);
00144       return ja_;
00145     }
00146 
00152     void ConvertValues(Index nonzeros_triplet, const Number* a_triplet,
00153                        Index nonzeros_compressed, Number* a_compressed);
00154 
00155   private:
00165     TripletToDenseConverter();
00166 
00168     TripletToDenseConverter(const TripletToDenseConverter&);
00169 
00171     void operator=(const TripletToDenseConverter&);
00173 
00175     Index offset_;
00176 
00178     Index* ia_;
00179 
00181     Index* ja_;
00182 
00184     Index dim_;
00185 
00187     Index nonzeros_triplet_;
00188 
00190     Index nonzeros_compressed_;
00191 
00193     bool initialized_;
00194 
00201     Index* ipos_first_;
00207     Index* ipos_double_triplet_;
00209     Index* ipos_double_compressed_;
00211   };
00212 
00213 
00214 } // namespace Ipopt
00215 
00216 #endif

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