torch/optim — pull request #21 by jonathantompson (2014-08-17 17:16:46+00:00)
Title: updated lbfgs to support cuda tensors.

This is a pretty naive update to BFGS in order to support Cuda tensors. All I did was replace the overloaded arithmetic operations with CudaTensor supported clone, mul, add and sum operators. Note that the arithmetic operations create new tensors, so the changes here are equivalent I think.

A better version would pre-allocate a lot of temporary tensors to avoid lots of dynamic memory allocations (I might take a stab at this if I find lbfgs useful for my particular application).

As written, the lbfgs implementation here is very slow, but it's no slower than it was before the PR.