I have a function that repeatedly solves an ODE, maximizing a certain parameter, and I want to do that for many various inputs. Each input takes several minutes, so I'm using parcellfun to speed things up - but it stops working with a large number of inputs/outputs.

When I do this over a range of values, with a total of less than ~30 inputs, than it works fine - plotting the resulting data ends up giving a nice exponential decay. If I do too many though (ex 100), it starts breaking down, and and randomly returns 0 vectors for the solution - which I know is incorrect. I'm using 1000 points for lsode, so in the end I should have 100 solutions, each with 1000 data points with 2 components - I don't think there should be a memory problem here, but that's the only thing I can think of.

Basically, it looks something like this:

N = 28;

inputs = linspace(.1,2,N)

cellinputs = mat2cell( inputs, ... something else...)

solutions = cellfun( functionthatuseslsode,inputs)

for i=1:N

y=solutions{1}(1,1)

end

plot(inputs,y)

so - it works fine while N is small, but I begin getting nonsensical answers as N is increased >~50 ( I would expect it to be the same - but more points on the plot at the end)

I have tried just using cellfun as well - same results.

I know lsode uses fortran based code - is there any problem with this?

_______________________________________________

Help-octave mailing list

[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave