Ipopt Documentation  
 
Loading...
Searching...
No Matches
Ipopt::TripletToCSRConverter Class Reference

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>

+ Inheritance diagram for Ipopt::TripletToCSRConverter:

Classes

class  TripletEntry
 Class for one triplet position entry. More...
 

Public Types

enum  ETriFull { Triangular_Format , Full_Format }
 Enum to specify 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.
 
void ConvertValues (Index nonzeros_triplet, const Number *a_triplet, Index nonzeros_compressed, Number *a_compressed)
 Convert the values of the nonzero elements.
 
Constructor/Destructor
 TripletToCSRConverter (Index offset, ETriFull hf=Triangular_Format)
 
virtual ~TripletToCSRConverter ()
 Destructor.
 
Accessor methods
const IndexIA () const
 Return the IA array for the condensed format.
 
const IndexJA () const
 Return the JA array for the condensed format.
 
const IndexiPosFirst () const
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 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.
 
 TripletToCSRConverter (const TripletToCSRConverter &)
 Copy Constructor.
 
void operator= (const TripletToCSRConverter &)
 Default Assignment Operator.
 

Private Attributes

Index offset_
 Offset for CSR numbering.
 
ETriFull hf_
 Indicator of half (ie lower only) or full (both upr and lwr) matrix.
 
Indexia_
 Array storing the values for IA in the condensed format.
 
Indexja_
 Array storing the values for JA in the condensed format.
 
Index dim_
 Dimension of the matrix.
 
Index nonzeros_triplet_
 Number of nonzeros in the triplet format.
 
Index nonzeros_compressed_
 Number of nonzeros in the compressed format.
 
Index num_doubles_
 Number of repeated entries.
 
bool initialized_
 Flag indicating if initialize method had been called.
 
Arrays for cross-positions for the conversion of values.
Indexipos_first_
 First elements assignment.
 
Indexipos_double_triplet_
 Position of multiple elements in triplet matrix.
 
Indexipos_double_compressed_
 Position of multiple elements in compressed matrix.
 

Detailed Description

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 22 of file IpTripletToCSRConverter.hpp.

Member Enumeration Documentation

◆ ETriFull

Enum to specify 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 92 of file IpTripletToCSRConverter.hpp.

Constructor & Destructor Documentation

◆ TripletToCSRConverter() [1/3]

Ipopt::TripletToCSRConverter::TripletToCSRConverter ( Index  offset,
ETriFull  hf = Triangular_Format 
)

◆ ~TripletToCSRConverter()

virtual Ipopt::TripletToCSRConverter::~TripletToCSRConverter ( )
virtual

Destructor.

◆ TripletToCSRConverter() [2/3]

Ipopt::TripletToCSRConverter::TripletToCSRConverter ( )
private

Default Constructor.

◆ TripletToCSRConverter() [3/3]

Ipopt::TripletToCSRConverter::TripletToCSRConverter ( const TripletToCSRConverter )
private

Copy Constructor.

Member Function Documentation

◆ InitializeConverter()

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.

Returns
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 IA, JA, or ConvertValues.

◆ IA()

const Index * Ipopt::TripletToCSRConverter::IA ( ) const
inline

Return the IA array for the condensed format.

Definition at line 140 of file IpTripletToCSRConverter.hpp.

◆ JA()

const Index * Ipopt::TripletToCSRConverter::JA ( ) const
inline

Return the JA array for the condensed format.

Definition at line 147 of file IpTripletToCSRConverter.hpp.

◆ iPosFirst()

const Index * Ipopt::TripletToCSRConverter::iPosFirst ( ) const
inline

Definition at line 153 of file IpTripletToCSRConverter.hpp.

◆ ConvertValues()

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.

◆ operator=()

void Ipopt::TripletToCSRConverter::operator= ( const TripletToCSRConverter )
private

Default Assignment Operator.

Member Data Documentation

◆ offset_

Index Ipopt::TripletToCSRConverter::offset_
private

Offset for CSR numbering.

Definition at line 198 of file IpTripletToCSRConverter.hpp.

◆ hf_

ETriFull Ipopt::TripletToCSRConverter::hf_
private

Indicator of half (ie lower only) or full (both upr and lwr) matrix.

Definition at line 201 of file IpTripletToCSRConverter.hpp.

◆ ia_

Index* Ipopt::TripletToCSRConverter::ia_
private

Array storing the values for IA in the condensed format.

Definition at line 204 of file IpTripletToCSRConverter.hpp.

◆ ja_

Index* Ipopt::TripletToCSRConverter::ja_
private

Array storing the values for JA in the condensed format.

Definition at line 207 of file IpTripletToCSRConverter.hpp.

◆ dim_

Index Ipopt::TripletToCSRConverter::dim_
private

Dimension of the matrix.

Definition at line 210 of file IpTripletToCSRConverter.hpp.

◆ nonzeros_triplet_

Index Ipopt::TripletToCSRConverter::nonzeros_triplet_
private

Number of nonzeros in the triplet format.

Definition at line 213 of file IpTripletToCSRConverter.hpp.

◆ nonzeros_compressed_

Index Ipopt::TripletToCSRConverter::nonzeros_compressed_
private

Number of nonzeros in the compressed format.

Definition at line 216 of file IpTripletToCSRConverter.hpp.

◆ num_doubles_

Index Ipopt::TripletToCSRConverter::num_doubles_
private

Number of repeated entries.

Definition at line 219 of file IpTripletToCSRConverter.hpp.

◆ initialized_

bool Ipopt::TripletToCSRConverter::initialized_
private

Flag indicating if initialize method had been called.

Definition at line 222 of file IpTripletToCSRConverter.hpp.

◆ ipos_first_

Index* Ipopt::TripletToCSRConverter::ipos_first_
private

First elements assignment.

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 232 of file IpTripletToCSRConverter.hpp.

◆ ipos_double_triplet_

Index* Ipopt::TripletToCSRConverter::ipos_double_triplet_
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 239 of file IpTripletToCSRConverter.hpp.

◆ ipos_double_compressed_

Index* Ipopt::TripletToCSRConverter::ipos_double_compressed_
private

Position of multiple elements in compressed matrix.

Definition at line 242 of file IpTripletToCSRConverter.hpp.


The documentation for this class was generated from the following file: