You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found that I'm starting to use Tuples significantly more in math models for speed/allocations when considering small number of parameters.
My current workaround has been to do...
@.f(x::Tuple, p) = p[1]*exp(-x*p[2])
xdata = (0.5, 1.5, 2.5, 4.5, 6.5)
ydata =f(xdata, (1.0, 2.0))
model(x, p) = [f(Tuple(x for x in x), p)...]
p0 = [1.5, 0.5]
fit =curve_fit(model, [xdata...], [ydata...], p0)
Which works but obviously allocates a lot more. Is there perhaps a better workaround for this if f must accept a tuple? Possibly just use the inplace version?
The text was updated successfully, but these errors were encountered:
It would be nice if the example function could also work for
NTuple
types such asI've found that I'm starting to use Tuples significantly more in math models for speed/allocations when considering small number of parameters.
My current workaround has been to do...
Which works but obviously allocates a lot more. Is there perhaps a better workaround for this if
f
must accept a tuple? Possibly just use the inplace version?The text was updated successfully, but these errors were encountered: