# How to pass a preconditioner to NLopt?

**URL:** <https://discourse.julialang.org/t/how-to-pass-a-preconditioner-to-nlopt/16361>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [October 15, 2018, 7:46pm UTC](https://discourse.julialang.org/t/how-to-pass-a-preconditioner-to-nlopt/16361 "2018-10-15T19:46:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [October 15, 2018, 7:46pm UTC](https://discourse.julialang.org/t/how-to-pass-a-preconditioner-to-nlopt/16361/1 "2018-10-15T19:46:03Z")

</div>

I found very scarce documentation about this.

[https://nlopt.readthedocs.io/en/stable/NLopt\_Reference/#preconditioning-with-approximate-hessians](https://nlopt.readthedocs.io/en/stable/NLopt_Reference/#preconditioning-with-approximate-hessians)

This only describes the C interface, and it seems to only support the method `LD_CCSAQ`.

So how can I pass a preconditioner in Julia? Is it possible to pass a preconditioner to other methods (in particular LBFGS)? Can I pass a sparse Hessian approximation (e.g., a diagonal matrix)?

I also opened a Github issue as a feature request: [How to pass preconditioner? · Issue #122 · JuliaOpt/NLopt.jl · GitHub](https://github.com/JuliaOpt/NLopt.jl/issues/122).
