Hi,

2011/4/18 Michael Braun <bra...@mit.edu>:
> When I run this code, it prints the current state of the minimizer as 
> expected (as you can see in this output).  The problem comes when trying to 
> free Y.  The error is generated by the gsl_vector_free(Y) call.  I have no 
> idea what I could be doing wrong here.

You are changing the pointer Y in this line:

>     // ASSIGNING CURRENT VALUE TO Y
>     Y = gsl_multimin_fdfminimizer_x(s);

Now it does not point to the address you've allocated in the 'Y =
gsl_vector_alloc(2)' statement, but to some memory which is owned by
the gsl_multimin_fdfminimizer object. This memory is free'd when you
call 'gsl_multimin_fdfminimizer_free (s)', such that any attempt to
free the memory again later on will result in an error.

To fix this, you should copy the values of the vector returned by
'gsl_multimin_fdfminimizer_x(s)' to the vector that 'Y' points to,
rather than changing the pointer itself.

Cheers,
Frank

_______________________________________________
Bug-gsl mailing list
Bug-gsl@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to