Hello,
I have a function like this:
function f(dim::Integer, pdf::Function)
......
function pdf_j(xptr, distr)
x = map(i -> unsafe_load(xptr, i), 1:dim)
return pdf(x)::Cdouble
end
pdf_c = @cfunction(
pdf_j,
Cdouble,
(Ptr{Cdouble}, Ptr{UNUR_DISTR})
)
......
end
That does not work: pdf_j
undefined, Julia says.
So I tried:
pdf_c = @cfunction(
(xptr, distr) -> pdf(map(i -> unsafe_load(xptr, i), 1:dim))::Cdouble,
Cdouble,
(Ptr{Cdouble}, Ptr{UNUR_DISTR})
)
but this time Julia says dim
undefined.
Could you help please?