forum.alglib.net http://forum.alglib.net/ 

LMA calculation of sum of squares in an extern function http://forum.alglib.net/viewtopic.php?f=2&t=393 
Page 1 of 1 
Author:  Georg [ Thu Jun 23, 2011 9:28 am ] 
Post subject:  LMA calculation of sum of squares in an extern function 
Hey guys, I have a nonlinear optimization problem and I want to use the alglib's LMA implementation to solve it. However, it is very unpractical for me to give the algorithm all the N points, i.e. the x and y to solve: F(c) = (f(c,x[0])y[0])^2 + ... + (f(c,x[n1])y[n1])^2 I'd rather calculate the sum of squares by myself in a function, since I want to do the calculations on the GPU. Is there any drawback if I simple pass a dummy x and dummy y containing only 1 element and doing all the complex calculations, which actually involve 100k points bymyself in a function? Greetz! 
Author:  Sergey.Bochkanov [ Fri Jun 24, 2011 10:42 am ] 
Post subject:  Re: LMA calculation of sum of squares in an extern function 
There are two units which implement LM algorithm: lsfit and minlm. lsfit is a highlevel wrapper which solves fitting problem, i.e. minimizes F(c) = (f(c,x[0])y[0])^2 + ... + (f(c,x[n1])y[n1])^2. It needs a list of points, it automatically passes them one by one to the userdefined function and so on... You probably talk about this unit because this is the only unit which explicitly mentions points and c, x, y arrays. lsfit will work with dummy arrays  you may pass dummy x containing only one element  index of the point, and to fetch data from already calculated array of f's using this index. y, however, must be nondummy, because its value is used by the algorithm. minlm unit, from the other side, solves general form minimization problem without any explicit connection with some data to be fitted: min f(c) = f0(c)^2 + ... + fn_1(c)^2. It does not mention x and y, which is exactly the thing you need. Maybe it is better to use minlm in your situation. 
Page 1 of 1  All times are UTC 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 