# forum.alglib.net

ALGLIB forum
 It is currently Thu Apr 25, 2024 8:20 am

 All times are UTC

### Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: LMA calculation of sum of squares in an extern functionPosted: Thu Jun 23, 2011 9:28 am

Joined: Thu Jun 23, 2011 9:21 am
Posts: 1
Hey guys,

I have a non-linear 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[n-1])-y[n-1])^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!

Top

 Post subject: Re: LMA calculation of sum of squares in an extern functionPosted: Fri Jun 24, 2011 10:42 am

Joined: Fri May 07, 2010 7:06 am
Posts: 906
There are two units which implement LM algorithm: lsfit and minlm.

lsfit is a high-level wrapper which solves fitting problem, i.e. minimizes F(c) = (f(c,x[0])-y[0])^2 + ... + (f(c,x[n-1])-y[n-1])^2. It needs a list of points, it automatically passes them one by one to the user-defined 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 non-dummy, 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.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 69 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: