namespace
SparseMatrixHelperSparseMatrixHelper namespace is a namespace that contains helper function to handle osqp matrix.
Use it to create to update or manage an osqp sparse matrix. osqp sparse matrix in compressed-column or triplet form.
Functions
-
template<typename Derived>auto createOsqpSparseMatrix(const Eigen::SparseCompressedBase<Derived>& eigenSparseMatrix, csc*& osqpSparseMatrix) -> bool
- Allocate an osqpSparseMatrix struct.
-
template<typename T>auto osqpSparseMatrixToEigenSparseMatrix(const csc*const& osqpSparseMatrix, Eigen::SparseMatrix<T>& eigenSparseMatrix) -> bool
- Convert an osqp sparse matrix into an eigen sparse matrix.
-
template<typename T>auto osqpSparseMatrixToTriplets(const csc*const& osqpSparseMatrix, std::vector<Eigen::Triplet<T>>& tripletList) -> bool
- Convert an osqp sparse matrix into a eigen triplet list.
-
template<typename Derived, typename T>auto eigenSparseMatrixToTriplets(const Eigen::SparseCompressedBase<Derived>& eigenSparseMatrix, std::vector<Eigen::Triplet<T>>& tripletList) -> bool
- Convert an eigen sparse matrix into a eigen triplet list.
Function documentation
template<typename Derived>
bool OsqpEigen:: SparseMatrixHelper:: createOsqpSparseMatrix(const Eigen::SparseCompressedBase<Derived>& eigenSparseMatrix,
csc*& osqpSparseMatrix)
Allocate an osqpSparseMatrix struct.
Returns | a const point to the csc struct. |
---|
NOTE: c_malloc
function is used to allocate memory please call c_free
to deallcate memory.
template<typename T>
bool OsqpEigen:: SparseMatrixHelper:: osqpSparseMatrixToEigenSparseMatrix(const csc*const& osqpSparseMatrix,
Eigen::SparseMatrix<T>& eigenSparseMatrix)
Convert an osqp sparse matrix into an eigen sparse matrix.
Parameters | |
---|---|
osqpSparseMatrix | is a constant pointer to a constant csc struct; |
eigenSparseMatrix | is the eigen sparse matrix object. |
Returns | a const point to the csc struct. |
template<typename T>
bool OsqpEigen:: SparseMatrixHelper:: osqpSparseMatrixToTriplets(const csc*const& osqpSparseMatrix,
std::vector<Eigen::Triplet<T>>& tripletList)
Convert an osqp sparse matrix into a eigen triplet list.
Parameters | |
---|---|
osqpSparseMatrix | is reference to a constant pointer to a constant csc struct; |
tripletList | is a std::vector containing the triplet. |
Returns | a const point to the csc struct. |
template<typename Derived, typename T>
bool OsqpEigen:: SparseMatrixHelper:: eigenSparseMatrixToTriplets(const Eigen::SparseCompressedBase<Derived>& eigenSparseMatrix,
std::vector<Eigen::Triplet<T>>& tripletList)
Convert an eigen sparse matrix into a eigen triplet list.
Parameters | |
---|---|
eigenSparseMatrix | is the eigen sparse matrix object; |
tripletList | is a std::vector containing the triplet. |
Returns | a const point to the csc struct. |