vegasflow icon indicating copy to clipboard operation
vegasflow copied to clipboard

rpy to tensor

Open divagora opened this issue 1 year ago • 1 comments

I'm beginner. Im running a MC integration to compute the CDF of a vinecopula model (involving 6 different variables). However, I have a lack of speed and efficency in the process. Tackling it, I'm trying to perform my model using VEGASFLOW, but I'm not sure how can I convert a rpy object to tensor, and also how can I set the limits of integration .

Here is my code using VEGAS:

`@vegas.batchintegrand def integrate_fun(k): # Calculate VineCopula pdf pdf_vine = np.array(VineCopula.RVinePDF(k, θ)) return pdf_vine

def vegas_6D(θ,u,v,w,x,y,z): integ = vegas.Integrator([[0, u], [0, v], [0, w], [0, x], [0, y], [0, z]]) result = integ(integrate_fun, nitn = 10, neval = 10000) return result.mean`

where u,v,w,x,y,z are: np. linspace between 0 and 1

Thank you in advance for your help

divagora avatar Mar 09 '23 15:03 divagora