forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 1:36 pm

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.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: minlmoptimize function wrap
PostPosted: Wed Dec 07, 2016 5:10 am 
Offline

Joined: Wed Dec 07, 2016 5:00 am
Posts: 3
Hi there,

I have a problem related with using minlmoptimize method for curve fitting.
I tried to create a vector of fi[i] of each data point, as shown below, then pass them into the minlmoptimize function.

Code:
        public static void function_fvec(double[] vars, double[] fi, object obj)
        {                       
            double[] tempfuncs = new double[10];
           
            for (int i = 0; i < 10; i++)
            {
                tempfuncs[i] = Math.Abs(data_y[i] - simu(vars, data_x[i])); //compare input data and calculated results.
            }

            fi= tempfuncs;           
        }


However, it seems does not work. Can someone help me out?

Thank you!


Top
 Profile  
 
 Post subject: Re: minlmoptimize function wrap
PostPosted: Wed Dec 07, 2016 10:04 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
Hi!

You should rewrite elements of fi, not create new array. As you may see, fi[] is passed by value, so when you create tempfuncs[] there is no way to tell optimizer that it should work with newly allocated array.


Top
 Profile  
 
 Post subject: Re: minlmoptimize function wrap
PostPosted: Wed Dec 07, 2016 1:53 pm 
Offline

Joined: Wed Dec 07, 2016 5:00 am
Posts: 3
Hello Mr.Bochkanov,

Thank you for replying in person! Now the problem is fixed, your solver works wonderfully!

Maybe another quick question, is there a way to get the correlation matrix of the fitting varables?

Many thanks!


Top
 Profile  
 
 Post subject: Re: minlmoptimize function wrap
PostPosted: Thu Dec 08, 2016 1:24 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
No, LM optimizer does not support covariance matrix estimation. Only linear LS solver provides such option.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 52 guests


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group