Hi,
It really was a problem in the installation, i tested in another computer and it worked.
But now i am having another problem, with the [.SampleMulti(double* x)] member. i wrote the following code so far:
import ROOT as root
from math import sqrt,exp
from array import array
def gaus3d(x,p):
sigma_x = p[0]
sigma_y = p[1]
sigma_z = p[2]
rho = p[2]
u = x[0] / sigma_x
v = x[1] / sigma_y
w = x[2] / sigma_z
c = 1 - rho*rho
result = (1 / (2 * root.TMath.Pi() * sigma_x * sigma_y * sigma_z * sqrt(c)))* exp (-(u * u - 2 * rho * u * v + v * v + w*w) / (2 * c))
return result
f = root.TF3("f",gaus3d,-10,10,-10,10,-10,10,3,3)
f.SetParameters(2,2,0.5)
dist = root.TUnuranMultiContDist(f)
unr = root.TUnuran(root.gRandom)
method = "hitro"
unr.Init(dist,method)
x = root.TArrayD(3)
h1 = root.TH3D("h13D","gaussian 3D distribution from Unuran",50,-10,10,50,-10,10,50,-10,10)
for i in range(1000):
unr.SampleMulti(root.AddressOf(x))
h1.Fill(x[0],x[1],x[2])
And i am having the following error:
Traceback (most recent call last):
File "test.py", line 33, in <module>
unr.SampleMulti(root.AddressOf(x))
TypeError: bool TUnuran::SampleMulti(double* x) =>
TypeError: could not convert argument 1 (could not convert argument to buffer or nullptr)
I tried to input different forms of python and root arrays in the .SampleMulti(double* x) object, but none worked. What i am doing wrong here?