domokane / FinancePy

A Python Finance Library that focuses on the pricing and risk-management of Financial Derivatives, including fixed-income, equity, FX and credit derivatives.
GNU General Public License v3.0
2.14k stars 321 forks source link

Implement numba'd conjugate gradient minimiser #59

Open domokane opened 3 years ago

domokane commented 3 years ago

The conjugate gradient descent algorithm in scipy is slow and prevents the calling function from being jitted by numba. Idea is to find a python version of the CG minimiser that can be jitted to give faster minimisations.

idorrington92 commented 1 year ago

I'd be happy to have a go at this

domokane commented 1 year ago

I am not sure this is still needed. Look in utils at solver_cg.py and solver_nm.py to see the functions that were added and where they are used to see if everything is as fast as it can be. I had lots of issues with numba but I think they now work. But I have sort of forgotten so I am not 100% sure.

idorrington92 commented 1 year ago

I saw solver_cg but it didn't look like it was being used anywhere... and it looks like equity_vol_surface (and others) are using the scipy solver. Though it looks like it tries solver_nm and only uses scipy's CG when that fails to converge (or when the user specifies to use it).

domokane commented 1 year ago

Yes. My main focus was on the FX surface solver. If you see a need to work on it let me know. I am jammed on other things right now but if there is stuff to be done on this it would be very helpful.