Skip to content

[QP Solver] In-place LDLT decomposition of KKT matrix #15

@msplr

Description

@msplr

The most significant memory cost of the dense QP solver come form storing the KKT matrix and its decomposition.
Eigen allows for in-place LDLT decomposition that reuses the coefficient matrix and to save memory.
The in-place decomposition requires a reference to the coefficient matrix at construction, which is not available at that point.
However, construction can be delayed using a placement new, which is illustrated below.

using linear_solver_t = Eigen::LDLT<Eigen::Ref<kkt_mat_t>>;
char linear_solver_buf[sizeof(linear_solver_t)]; // enforce some alignment somehow?
linear_solver_t* linear_solver;
//...
p = (void*) linear_solver_buf;
linear_solver = new(p) linear_solver_t(kkt_mat);

Note: Another option would be to construct the linear solver as a local object on the stack.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions