How to return multiple return values by pycc

In @cc.report, I want to return four 1D arrays and one 2D array. How am I supppsed to do that?

I’d like to provide some additional information.

My function code is as follows:

@cc.export('MCMC', 'Tuple(f8[:], f8[:], f8[:], f8[:], f8[:,:])(f8, f8[:], i8, f8[:,:], f8[:], f8[:], f8[:], f8[:], f8[:], i8, i8, f8, f8, f8, f8, f8, f8, f8, f8, f8, f8, f8)')
@njit()
def MCMC(deltat, Y, T, V, mu, omega, psi, kappa, theta, BURNIN, N, mu0, sigma0, alphatilde0, p0, psi0, betatilde0, sigmath0, theta0, sigmakap0, kappa0, SIGMAN):   
    for i in range(1, BURNIN + N):
        mu[i] = update_mu(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, mu0, sigma0) 
        omega[i], psi[i] = update_omega_psi(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, alphatilde0, p0, psi0, betatilde0)
        theta[i] = update_theta(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, sigmath0, theta0)
        kappa[i] = update_kappa(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, sigmakap0, kappa0)
        V = update_V(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, SIGMAN)
        # print(i)
    return mu, omega, psi, theta, V

I’m using MCMC.nopython_signatures to output:

[(float64, Array(float64, 1, 'C', False, aligned=True), int64, Array(float64, 2, 'C', False, aligned=True), Array(float64, 1, 'C', False, aligned=True), Array(float64, 1, 'C', False, aligned=True), Array(float64, 1, 'C', False, aligned=True), Array(float64, 1, 'C', False, aligned=True), Array(float64, 1, 'C', False, aligned=True), int64, int64, float64, float64, float64, float64, float64, float64, float64, float64, float64, float64, float64) -> Tuple(array(float64, 1d, C), array(float64, 1d, C), array(float64, 1d, C), array(float64, 1d, C), array(float64, 2d, C))]

I’m not sure why I’m still encountering errors when compiling with pycc.

    @cc.export('MCMC', 'Tuple(f8[:], f8[:], f8[:], f8[:], f8[:,:])(f8, f8[:], i8, f8[:,:], f8[:], f8[:], f8[:], f8[:], f8[:], i8, i8, f8, f8, f8, f8, f8, f8, f8, f8, f8, f8, f8)')

  File D:\ProgramData\Anaconda\envs\pymc_env\lib\site-packages\numba\pycc\cc.py:139 in export
    fn_args, fn_retty = sigutils.normalize_signature(sig)

  File D:\ProgramData\Anaconda\envs\pymc_env\lib\site-packages\numba\core\sigutils.py:29 in normalize_signature
    parsed = _parse_signature_string(sig)

  File D:\ProgramData\Anaconda\envs\pymc_env\lib\site-packages\numba\core\sigutils.py:19 in _parse_signature_string
    return eval(signature_str, {}, types.__dict__)

  File <string>:1

  File D:\ProgramData\Anaconda\envs\pymc_env\lib\site-packages\numba\core\types\abstract.py:67 in __call__
    inst = type.__call__(cls, *args, **kwargs)

TypeError: __new__() takes 2 positional arguments but 6 were given

By the way, my other functions in MCMC have ALL compiled successfully.

Thanks in advance !

Sorry, guys!

I found out that it’s Tuple((f8[:], f8[:], f8[:], f8[:], f8[:,:])) not Tuple(f8[:], f8[:], f8[:], f8[:], f8[:,:]).