File SDPAFormatManager.h
-
template<typename NT>
class SdpaFormatManager - #include <SDPAFormatManager.h>
Reads/writes files according to the SDPA format for sdps. Currently supported Format:
<objective function vector> <i-th row of j-th matrix>
For example: 2 3 1 1
- Template Parameters:
NT – Numerical Type
Public Functions
-
inline void loadSDPAFormatFile(std::ifstream &is, std::vector<MT> &matrices, VT &objectiveFunction)
Reads an SDPA format file
- Parameters:
is – [in] An open stram pointing to the file
matrices – [out] the matrices A0, A1, A2, …, An
objectiveFunction – [out] The objective function of the sdp
-
inline void writeSDPAFormatFile(std::ostream &os, std::vector<MT> const &matrices, VT const &objectiveFunction)
Create a SDPA format file
- Parameters:
os – [in] Open stream to file
matrices – [in] The matrices A0, …, An
objectiveFunction – [in] The objective function of the sdp
-
template<typename Spectrahedron, typename Point>
inline void loadSDPAFormatFile(std::ifstream &is, Spectrahedron &spectrahedron, Point &objectiveFunction) Read a spectrahedron and a vector (objective function) from a SDPA format input file
- Template Parameters:
Point –
- Parameters:
is – [in] opened stream to input file
spectrahedron – [out]
objectiveFunction – [out]
-
template<typename Spectrahedron, typename Point>
inline void writeSDPAFormatFile(std::ostream &os, Spectrahedron const &spectrahedron, Point const &objectiveFunction) Write a spectrahedron and a vector (objective function) to a SDPA format output file
- Template Parameters:
Point –
- Parameters:
is – [in] opened stream to output file
spectrahedron – [in]
objectiveFunction – [in]
Private Types
Private Functions
-
inline char consumeSymbol(string_it &at, string_it &end)
Return the first non white space/tab character and advance the iterator one position
- Parameters:
it – [inout] Current position
end – [in] End of string
- Returns:
First non white space/tab character
-
inline bool isCommentLine(std::string &line)
Determine if current line is a comment
- Parameters:
line – [in] The current line
- Returns:
true if line is a comment, false otherwise
-
inline int fetchNumber(std::string &string)
Get an integer from the string
- Parameters:
string – [in]
- Returns:
an integer
-
inline listVector readVector(std::string &string)
Read a vector of the form {val1, val2, …, valn}
- Parameters:
string – Contains the vector
- Returns:
a list with the n numbers