Ipopt
3.12.12
|
Class for converting symmetric matrices given in triplet format to matrices in compressed sparse row (CSR) format of the upper triangular part (or, equivalently, compressed sparse column (CSC) format for the lower triangular part). More...
#include <IpTripletToCSRConverter.hpp>
Classes | |
class | TripletEntry |
Class for one triplet position entry. More... | |
Public Types | |
enum | ETriFull { Triangular_Format, Full_Format } |
Enum to specifiy half or full matrix storage. More... | |
Public Member Functions | |
Index | InitializeConverter (Index dim, Index nonzeros, const Index *airn, const Index *ajcn) |
Initialize the converter, given the fixed structure of the matrix. More... | |
void | ConvertValues (Index nonzeros_triplet, const Number *a_triplet, Index nonzeros_compressed, Number *a_compressed) |
Convert the values of the nonzero elements. More... | |
Constructor/Destructor | |
TripletToCSRConverter (Index offset, ETriFull hf=Triangular_Format) | |
virtual | ~TripletToCSRConverter () |
Destructor. More... | |
Accessor methods | |
const Index * | IA () const |
Return the IA array for the condensed format. More... | |
const Index * | JA () const |
Return the JA array for the condensed format. More... | |
const Index * | iPosFirst () const |
![]() | |
ReferencedObject () | |
virtual | ~ReferencedObject () |
Index | ReferenceCount () const |
void | AddRef (const Referencer *referencer) const |
void | ReleaseRef (const Referencer *referencer) const |
Private Member Functions | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
TripletToCSRConverter () | |
Default Constructor. More... | |
TripletToCSRConverter (const TripletToCSRConverter &) | |
Copy Constructor. More... | |
void | operator= (const TripletToCSRConverter &) |
Overloaded Equals Operator. More... | |
Private Attributes | |
Index | offset_ |
Offset for CSR numbering. More... | |
ETriFull | hf_ |
Indicator of half (ie lower only) or full (both upr and lwr) matrix. More... | |
Index * | ia_ |
Array storing the values for IA in the condensed format. More... | |
Index * | ja_ |
Array storing the values for JA in the condensed format. More... | |
Index | dim_ |
Dimension of the matrix. More... | |
Index | nonzeros_triplet_ |
Number of nonzeros in the triplet format. More... | |
Index | nonzeros_compressed_ |
Number of nonzeros in the compressed format. More... | |
Index | num_doubles_ |
Number of repeated entries. More... | |
bool | initialized_ |
Flag indicating if initialize method had been called. More... | |
Arrays for cross-positions for the conversion of values. | |
Index * | ipos_first_ |
First elements assignement. More... | |
Index * | ipos_double_triplet_ |
Position of multiple elements in triplet matrix. More... | |
Index * | ipos_double_compressed_ |
Position of multiple elements in compressed matrix. More... | |
Class for converting symmetric matrices given in triplet format to matrices in compressed sparse row (CSR) format of the upper triangular part (or, equivalently, compressed sparse column (CSC) format for the lower triangular part).
In the description for this class, we assume that we discuss the CSR format.
Definition at line 23 of file IpTripletToCSRConverter.hpp.
Enum to specifiy half or full matrix storage.
Enumerator | |
---|---|
Triangular_Format |
Lower (or Upper) triangular stored only. |
Full_Format |
Store both lower and upper parts. |
Definition at line 82 of file IpTripletToCSRConverter.hpp.
Ipopt::TripletToCSRConverter::TripletToCSRConverter | ( | Index | offset, |
ETriFull | hf = Triangular_Format |
||
) |
|
virtual |
Destructor.
|
private |
Default Constructor.
|
private |
Copy Constructor.
Index Ipopt::TripletToCSRConverter::InitializeConverter | ( | Index | dim, |
Index | nonzeros, | ||
const Index * | airn, | ||
const Index * | ajcn | ||
) |
Initialize the converter, given the fixed structure of the matrix.
There, ndim gives the number of rows and columns of the matrix, nonzeros give the number of nonzero elements, and airn and acjn give the positions of the nonzero elements. The return value is the number of nonzeros in the condensed matrix. (Since nonzero elements can be listed several times in the triplet format, it is possible that this value is different from the input value nonzeros.) This method must be called before the GetIA, GetJA, Convert Values methods are called.
|
inline |
Return the IA array for the condensed format.
Definition at line 118 of file IpTripletToCSRConverter.hpp.
|
inline |
Return the JA array for the condensed format.
Definition at line 125 of file IpTripletToCSRConverter.hpp.
|
inline |
Definition at line 130 of file IpTripletToCSRConverter.hpp.
void Ipopt::TripletToCSRConverter::ConvertValues | ( | Index | nonzeros_triplet, |
const Number * | a_triplet, | ||
Index | nonzeros_compressed, | ||
Number * | a_compressed | ||
) |
Convert the values of the nonzero elements.
Given the values a_triplet for the triplet format, return the array of values for the condensed format in a_condensed. nonzeros_condensed is the length of the array a_condensed and must be identical to the return value of InitializeConverter.
|
private |
Overloaded Equals Operator.
|
private |
Offset for CSR numbering.
Definition at line 165 of file IpTripletToCSRConverter.hpp.
|
private |
Indicator of half (ie lower only) or full (both upr and lwr) matrix.
Definition at line 168 of file IpTripletToCSRConverter.hpp.
|
private |
Array storing the values for IA in the condensed format.
Definition at line 171 of file IpTripletToCSRConverter.hpp.
|
private |
Array storing the values for JA in the condensed format.
Definition at line 174 of file IpTripletToCSRConverter.hpp.
|
private |
Dimension of the matrix.
Definition at line 177 of file IpTripletToCSRConverter.hpp.
|
private |
Number of nonzeros in the triplet format.
Definition at line 180 of file IpTripletToCSRConverter.hpp.
|
private |
Number of nonzeros in the compressed format.
Definition at line 183 of file IpTripletToCSRConverter.hpp.
|
private |
Number of repeated entries.
Definition at line 186 of file IpTripletToCSRConverter.hpp.
|
private |
Flag indicating if initialize method had been called.
Definition at line 189 of file IpTripletToCSRConverter.hpp.
|
private |
First elements assignement.
For i with 0 <= i <= nonzeros_compressed-1, the i-th element in the compressed format is obtained from copying the ipos_filter_[i]-th element from the triplet format.
Definition at line 197 of file IpTripletToCSRConverter.hpp.
|
private |
Position of multiple elements in triplet matrix.
For i = 0,..,nonzeros_triplet_-nonzeros_compressed_, the ipos_double_triplet_[i]-th element in the triplet matrix has to be added to the ipos_double_compressed_[i]-th element in the compressed matrix.
Definition at line 203 of file IpTripletToCSRConverter.hpp.
|
private |
Position of multiple elements in compressed matrix.
Definition at line 205 of file IpTripletToCSRConverter.hpp.