Registry / other / levmar

levmar

JSON →
library2.6vcpkgunverified

Levenberg-Marquardt nonlinear least squares optimization algorithm

vcpkg install levmar
INSTALL
IMPORT
SIG · LEVMAR
L
levmar
othercppv2.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

levmar.h
#include <levmar.h>

Fit a linear model y = p0*x + p1 using Levenberg-Marquardt

#include "levmar.h" #include <cstdio> int main() { double p[2] = {1.0, 1.0}; double x[4] = {0.0, 1.0, 2.0, 3.0}; double y[4] = {0.1, 0.9, 4.1, 9.0}; double opts[LM_OPTS_SZ] = {LM_INIT_MU, 1E-15, 1E-15, 1E-20, LM_DIFF_DELTA}; double info[LM_INFO_SZ]; int ret = dlevmar_der( [](double *p, double *hx, int m, int n, void *adata) { for(int i=0; i<n; ++i) hx[i] = p[0]*x[i] + p[1]; }, [](double *p, double *jac, int m, int n, void *adata) { for(int i=0; i<n; ++i) { jac[i*m+0] = x[i]; jac[i*m+1] = 1.0; } }, p, x, y, 2, 4, 1000, opts, info, NULL, NULL, NULL); printf("Result: p0=%f p1=%f\n", p[0], p[1]); return 0; }
Debug
Known issues
gotchalevmar requires LAPACK and BLAS; linking may fail if not found.
fix
Ensure LAPACK and BLAS are installed and linked.
affects: *
Upgrade
Version history
2.6latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources

No resource links recorded.

levmar — pip install levmar · libregistry