Ipopt Documentation  
 
Loading...
Searching...
No Matches
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// Authors: Carl Laird, Andreas Waechter IBM 2005-03-13
6
7#ifndef __IPTRIPLETTOCSRCONVERTER_HPP__
8#define __IPTRIPLETTOCSRCONVERTER_HPP__
9
10#include "IpUtils.hpp"
11#include "IpReferenced.hpp"
12namespace Ipopt
13{
14
23{
26 {
27 public:
28
30 void Set(
31 Index i_row,
32 Index j_col,
33 Index i_pos_triplet
34 )
35 {
36 if( i_row > j_col )
37 {
38 i_row_ = j_col;
39 j_col_ = i_row;
40 }
41 else
42 {
43 i_row_ = i_row;
44 j_col_ = j_col;
45 }
46 i_pos_triplet_ = i_pos_triplet;
47 }
48
51
52 Index IRow() const
53 {
54 return i_row_;
55 }
56
58 Index JCol() const
59 {
60 return j_col_;
61 }
62
65 {
66 return i_pos_triplet_;
67 }
69
75 const TripletEntry& Tentry
76 ) const
77 {
78 return ((i_row_ < Tentry.i_row_) || (i_row_ == Tentry.i_row_ && j_col_ < Tentry.j_col_));
79 }
80
81 private:
88 };
89
90public:
99
102 /* Constructor.
103 *
104 * If offset is 0, then the counting of indices in the compressed
105 * format starts a 0 (C-style numbering); if offset is 1, then the
106 * counting starts at 1 (Fortran-type numbering).
107 */
109 Index offset,
111 );
112
116
131 Index dim,
132 Index nonzeros,
133 const Index* airn,
134 const Index* ajcn
135 );
136
139
140 const Index* IA() const
141 {
143 return ia_;
144 }
145
147 const Index* JA() const
148 {
150 return ja_;
151 }
152
153 const Index* iPosFirst() const
154 {
156 return ipos_first_;
157 }
159
168 Index nonzeros_triplet,
169 const Number* a_triplet,
170 Index nonzeros_compressed,
171 Number* a_compressed
172 );
173
174private:
183
185
189 );
190
194 );
196
199
202
205
208
211
214
217
220
223
226
233
240
244};
245
246} // namespace Ipopt
247
248#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:27
Storing the reference count of all the smart pointers that currently reference it.
Class for one triplet position entry.
void Set(Index i_row, Index j_col, Index i_pos_triplet)
Set the values of an entry.
Index PosTriplet() const
Index in original triplet matrix.
bool operator<(const TripletEntry &Tentry) const
Comparison operator.
Class for converting symmetric matrices given in triplet format to matrices in compressed sparse row ...
TripletToCSRConverter(const TripletToCSRConverter &)
Copy Constructor.
Index offset_
Offset for CSR numbering.
const Index * JA() const
Return the JA array for the condensed format.
void ConvertValues(Index nonzeros_triplet, const Number *a_triplet, Index nonzeros_compressed, Number *a_compressed)
Convert the values of the nonzero elements.
const Index * IA() const
Return the IA array for the condensed format.
Index * ipos_double_compressed_
Position of multiple elements in compressed matrix.
Index * ipos_double_triplet_
Position of multiple elements in triplet matrix.
Index nonzeros_triplet_
Number of nonzeros in the triplet format.
Index nonzeros_compressed_
Number of nonzeros in the compressed format.
Index * ja_
Array storing the values for JA in the condensed format.
virtual ~TripletToCSRConverter()
Destructor.
bool initialized_
Flag indicating if initialize method had been called.
Index num_doubles_
Number of repeated entries.
Index * ia_
Array storing the values for IA in the condensed format.
Index dim_
Dimension of the matrix.
TripletToCSRConverter(Index offset, ETriFull hf=Triangular_Format)
TripletToCSRConverter()
Default Constructor.
void operator=(const TripletToCSRConverter &)
Default Assignment Operator.
ETriFull hf_
Indicator of half (ie lower only) or full (both upr and lwr) matrix.
Index InitializeConverter(Index dim, Index nonzeros, const Index *airn, const Index *ajcn)
Initialize the converter, given the fixed structure of the matrix.
Index * ipos_first_
First elements assignment.
ETriFull
Enum to specify half or full matrix storage.
@ Full_Format
Store both lower and upper parts.
@ Triangular_Format
Lower (or Upper) triangular stored only.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17