JuliaMath / Interpolations.jl

Fast, continuous interpolation of discrete datasets in Julia

Home Page:http://juliamath.github.io/Interpolations.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request - GPU documentation - Vector of Interpolation Objects

Lincoln-Hannah opened this issue · comments

Would it be possible to have a Structure for a Vector of Interpolations across common x values and interpolation type ?

k       = 0:4
M       = eachrow(randn(1_000,5))
iv      = interpolate.( [(k,)],  M,  [Gridded(Linear())] )

#possible syntax
iv_new          = vector_of_interpolations( (k,),  M, Gridded(Linear()))        
iv_new.it       # GriddedLinear()
iv_new.knots    # ([0, 1, 2, 3, 4],)
iv_new.coefs    # = [j.coefs for j in iv]
iv_new( x )     # = [j(x) for j in iv]
iv_new[1](x)    # = iv[1](x)

In iv_new, knots and it are stored once. In iv (current syntax) they are stored for every vector element.
This would also make it easier to put the vector onto GPU. With iv, the interpolate elements can be moved to GPU but the vector holding them stays on CPU (I think).

This would be useful in banking calculations like VaR and XVAs where curves need to be simulated thousands of times.

Maybe also for sensitivity calculations. Each element of the vector could be the original curve with one point bumped.