Ipopt  3.11.7
 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
Index * ipos_double_triplet_
Position of multiple elements in triplet matrix.
Class for one triplet position entry.
TripletEntry(const TripletEntry &rhs)
Copy constructor, required for std::list.
Lower (or Upper) triangular stored only.
TripletToCSRConverter()
Default Constructor.
void ConvertValues(Index nonzeros_triplet, const Number *a_triplet, Index nonzeros_compressed, Number *a_compressed)
Convert the values of the nonzero elements.
bool operator<(const TripletEntry &Tentry) const
Comparison operator.
Index offset_
Offset for CSR numbering.
Index InitializeConverter(Index dim, Index nonzeros, const Index *airn, const Index *ajcn)
Initialize the converter, given the fixed structure of the matrix.
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Class for converting symmetric matrices given in triplet format to matrices in compressed sparse row ...
void Set(Index i_row, Index j_col, Index i_pos_triplet)
Set the values of an entry.
Index * ipos_first_
First elements assignement.
Index PosTriplet() const
Index in original triplet matrix.
Index * ja_
Array storing the values for JA in the condensed format.
ReferencedObject class.
void operator=(const TripletToCSRConverter &)
Overloaded Equals Operator.
bool initialized_
Flag indicating if initialize method had been called.
ETriFull
Enum to specifiy half or full matrix storage.
Index * ia_
Array storing the values for IA in the condensed format.
const Index * IA() const
Return the IA array for the condensed format.
Index nonzeros_triplet_
Number of nonzeros in the triplet format.
Index dim_
Dimension of the matrix.
Index num_doubles_
Number of repeated entries.
ETriFull hf_
Indicator of half (ie lower only) or full (both upr and lwr) matrix.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
TripletEntry & operator=(const TripletEntry &rhs)
Equals Operator, required for std::list.
Index nonzeros_compressed_
Number of nonzeros in the compressed format.
Index * ipos_double_compressed_
Position of multiple elements in compressed matrix.
virtual ~TripletToCSRConverter()
Destructor.
const Index * JA() const
Return the JA array for the condensed format.