On Sun, Oct 19, 2008 at 12:52 PM, Robin <
robince@gmail.com> wrote:
> On Sun, Oct 19, 2008 at 11:28 AM, Maximilian Fabricius <
mxhf@gmx.net> wrote:
>> Robin,
>>
>> thank you for the quick reply.
>> Indeed, but this would still involve to swap parameters around between
>> fixed and non-fixed and
>> changing the lambda function manually rather then just switching the
>> fissint on and off
>> with a single variable.
>>
>> But no doubt, a wrapper can be done.
>
> I couldn't think of a way to squeeze it into a lamdba single
> statement, but something like this would do:
>
> def fit_function(x, fit, y):
> p0 = zeros(fit.size)
> p0[fit] = x
> p0[~fit] = y
>
> where fit is a boolean array, x is the ones to optimised and y are the
> fixed values.
> You have the extra overhead of the p0 array allocation for every
> iteration of the function - but perhaps that is worth it for the
> convenience.
>
> Robin
> _______________________________________________
> Scipy-dev mailing list
>
Scipy-dev@scipy.org
>
http://projects.scipy.org/mailman/listinfo/scipy-dev
>