In Cython, can a Python function take cdef variable as a parameter?
I am wondering if it is possible to pass in a cdef variable as a parameter for a Python function to draw a random multivariate normal sample.
See the code below:
import scipy.stats as st cdef np.double_t[:] gamma_hat = ... cdef np.double_t[:,:] gamma_hat_var = ... # st.multivariate_normal.rvs is a Python function # but the parameters gamma_hat and gamma_hat_var are C variables # would this work? st.multivariate_normal.rvs(mean = gamma_hat, cov = gamma_hat_var, size = 1)
in the code above,
st.multivariate_normal.rvs is a pre-defined Python function, but the parameters that I pass into this Python function (
gamma_hat, gamma_hat_var) are defined as C variable. Is such a practice allowed in Cython? would this work?
I should try it myself, but I am in a circumstance where I can't really give it a try, so a help would be highly appreciated. Thank you.