C# implementation of Levenberg–Marquardt algorithm [closed]
Asked Answered
E

3

6

I am looking for a C# implementation of the Levenberg–Marquardt algorithm for non-linear least squares fit.

Enemy answered 31/10, 2011 at 8:52 Comment(0)
R
7

Levenberg-Marquardt.NET by Krzysztof Kniaz has worked very well for me.

Richelle answered 2/2, 2012 at 1:42 Comment(7)
Thanks! I had a look at it a while ago, I couldnt get it to work when I had several input and output parameters for each data point.Enemy
Thanks! I had a look at it a while ago, I couldnt get it to work when I had several input and output parameters for each data point. Basically I have 3-D input coordinates and 3-D output coordinates, and 3-D reference coordinates for each data point. The 12 parameter function is supposed to make the output equal to the reference value for each point. Thus I calculate the norm of the error (reference value - output value) for each data point in the set as the function I want to minimize. I wasnt able to rewrite the code so that it achieved this.Enemy
Instead I use a robust c++ program and a c++ to c# wrapper function.Enemy
Sorry that library did not work for you but good to hear you found a way to do it. Do you mind sharing which C++ library you used? Have you considered trying to port it to C#? Not worth the effort or are you concerned about speed?Richelle
joachimwuttke.de/lmfit/index.html the library is in c. the quick and dirty solution i did was to compile the source code as a c++ project, and create a dll that could be executed from c#, using DllExport() / DllImport()Enemy
I moved the lmfit repository to apps.jcns.fz-juelich.de/lmfit.Tailorbird
apps.jcns.fz-juelich.de/src/lmfit/lmfit-6.1.tgzBerns
W
6

You might want to try csmpfit. It is open source.

Update:

The project has been moved to GitHub at https://github.com/cureos/csmpfit.

Warship answered 2/5, 2013 at 6:35 Comment(1)
This one is really easy and works flawlesslyMisjoinder
G
2

Here is an explanation article plus C# code:

http://www.imagingshop.com/articles/least-squares

It uses Math.NET Numerics for linear algebra to simplify the Levenberg-Marquardt algorithm.

Giesser answered 8/10, 2013 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.