Re: [Numpy-discussion] memoization with ndarray arguments

2009-03-23 Thread Francesc Alted
A Saturday 21 March 2009, Paul Northug escrigué: [clip] > numpy arrays are not hashable, maybe for a good reason. Numpy array are not hashable because they are mutable. > I tried > anyway by keeping a dict of hash(tuple(X)), but started having > collisions. So I switched to md5.new(X).digest()

Re: [Numpy-discussion] memoization with ndarray arguments

2009-03-22 Thread Gael Varoquaux
On Sat, Mar 21, 2009 at 07:18:56PM +0100, Paul Northug wrote: > I would like to 'memoize' the objective, derivative and hessian > functions, each taking a 1d double ndarray argument X, that are passed > as arguments to > scipy.optimize.fmin_ncg. I have develop a library that does this. It uses hea

Re: [Numpy-discussion] memoization with ndarray arguments

2009-03-22 Thread Gregor Thalhammer
Paul Northug schrieb: > I would like to 'memoize' the objective, derivative and hessian > functions, each taking a 1d double ndarray argument X, that are passed > as arguments to > scipy.optimize.fmin_ncg. > > Each of these 3 functions has calculations in common that are > expensive to compute and

[Numpy-discussion] memoization with ndarray arguments

2009-03-21 Thread Paul Northug
I would like to 'memoize' the objective, derivative and hessian functions, each taking a 1d double ndarray argument X, that are passed as arguments to scipy.optimize.fmin_ncg. Each of these 3 functions has calculations in common that are expensive to compute and are a function of X. It seems fmin_