Ipopt  3.11.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpTripletToCSRConverter.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpTripletToCSRConverter.hpp 2087 2012-02-16 11:12:26Z stefan $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2005-03-13
8 
9 #ifndef __IPTRIPLETTOCSRCONVERTER_HPP__
10 #define __IPTRIPLETTOCSRCONVERTER_HPP__
11 
12 #include "IpUtils.hpp"
13 #include "IpReferenced.hpp"
14 namespace Ipopt
15 {
16 
24  {
27  {
28  public:
33  {}
34 
37  {}
38 
41  {
42  i_row_ = rhs.i_row_;
43  j_col_ = rhs.j_col_;
45  }
46 
49  {
50  if (this!=&rhs) {
51  i_row_ = rhs.i_row_;
52  j_col_ = rhs.j_col_;
54  }
55  return *this;
56  }
58 
60  void Set(Index i_row, Index j_col, Index i_pos_triplet)
61  {
62  if (i_row>j_col) {
63  i_row_ = j_col;
64  j_col_ = i_row;
65  }
66  else {
67  i_row_ = i_row;
68  j_col_ = j_col;
69  }
70  i_pos_triplet_ = i_pos_triplet;
71  }
72 
76  Index IRow() const
77  {
78  return i_row_;
79  }
81  Index JCol() const
82  {
83  return j_col_;
84  }
86  Index PosTriplet() const
87  {
88  return i_pos_triplet_;
89  }
91 
93  bool operator< (const TripletEntry& Tentry) const
94  {
95  return ((i_row_ < Tentry.i_row_) ||
96  (i_row_==Tentry.i_row_ && j_col_<Tentry.j_col_));
97  }
98 
99  private:
109  //TripletEntry();
110 
112  /*
113  TripletEntry(const TripletEntry&);
114  */
116 
123  };
124 
125  public:
127  enum ETriFull {
132  };
133 
136  /* Constructor. If offset is 0, then the counting of indices in
137  the compressed format starts a 0 (C-style numbering); if offset
138  is 1, then the counting starts at 1 (Fortran-type
139  numbering). */
141 
143  virtual ~TripletToCSRConverter();
145 
156  Index InitializeConverter(Index dim, Index nonzeros,
157  const Index* airn,
158  const Index* ajcn);
159 
163  const Index* IA() const
164  {
166  return ia_;
167  }
168 
170  const Index* JA() const
171  {
173  return ja_;
174  }
175  const Index* iPosFirst() const
176  {
178  return ipos_first_;
179  }
181 
187  void ConvertValues(Index nonzeros_triplet, const Number* a_triplet,
188  Index nonzeros_compressed, Number* a_compressed);
189 
190  private:
201 
204 
206  void operator=(const TripletToCSRConverter&);
208 
211 
214 
217 
220 
223 
226 
229 
232 
235 
252  };
253 
254 
255 } // namespace Ipopt
256 
257 #endif