[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] MultiDimensional optimization with parameters in type of
From: |
Rajeev Singh |
Subject: |
Re: [Help-gsl] MultiDimensional optimization with parameters in type of gsl_vector and gsl_matrix |
Date: |
Wed, 2 Oct 2013 16:01:39 +0530 |
Hi,
You can use structure to pass arbitrary parameters as follows -
typedef struct {
gsl_vector * data_set_one;
gsl_matrix * data_set_two;
} myparameters;
double MLE_Target_Fun( gsl_vector * x, void *params)
{
myparameters * local_param = (myparameters *) params; // casting the pointer
// then use local_param->data_set_one to access the vector
......;
}
Hope it helps.
Rajeev
On Wed, Oct 2, 2013 at 1:24 PM, 袁振飞 <address@hidden> wrote:
> Hi, all.
>
> I'd like to use gsl multi dim optimization routines to solve a Maximum
> Likelihood Estimation problem. Hence the target function would take sample
> data as parameters as follows.
>
>
> double MLE_Target_Fun( gsl_vector * x, gsl_vector * data_set_one,
> gsl_matrix * data_set_two)
> {
> ......;
> }
>
> However I found the prototype of gsl_multimin_function as follow:
>
> double (* f) (const gsl_vector * x, void * params){}
>
>
> Would somebody help me how to write the gsl_multimin_function if parameters
> are one gsl_vector and one gsl_matrix ? I'd appreciate a lot for your help.
>
> Best regards,
> Zenfey