+
    
þÎj:  ã                   óä   € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
HtHtHtHtHt ^ RIHtHtHtHt ^ RIHt ^ RIHt RR	 ltR
 tR tR tR tR tR tR t R t!R t"R t#R t$R t%R# )é    N)ÚStringIO)ÚPath)ÚsymbolsÚEq)ÚautowrapÚbinary_functionÚCythonCodeWrapperÚUfuncifyCodeWrapperÚCodeWrapper)ÚCCodeGenÚ
C99CodeGenÚCodeGenArgumentListErrorÚmake_routine)Úraises)ÚTmpFileManagerc                ón   € \        4       pV ! WV3/ VB  VP                  4       pVP                  4        V# )a  Wrapper for dump_fn. dump_fn writes its results to a stream object and
this wrapper returns the contents of that stream as a string. This
auxiliary function is used by many tests below.

The header and the empty lines are not generator to facilitate the
testing of the output.
)r   ÚgetvalueÚclose)Údump_fnÚroutinesÚprefixÚkwargsÚoutputÚsources   &&&,  ÚY/opt/data/home/.local/lib/python3.14/site-packages/sympy/utilities/tests/test_autowrap.pyÚ
get_stringr      s4   € ô ‹Z€FÙˆH˜fÑ/¨Ò/Ø�_‰_Ó€FØ
‡L�L„NØ€Mó    c                  óÀ   € \        R 4      w  rpW,           V,          p\        RV4      p\        \        4       4      p\	        VP
                  V.4      pRpWg8X  g   Q hR# )úx,y,zÚtestz�cdef extern from 'file.h':
    double test(double x, double y, double z)

def test_c(double x, double y, double z):

    return test(x, y, z)N)r   r   r	   r   r   Údump_pyx)ÚxÚyÚzÚexprÚroutineÚcode_genr   Úexpecteds           r   Ú#test_cython_wrapper_scalar_functionr)   #   s_   € Ü�gÓ�G€Aˆ!Ø�E�1�9€DÜ˜6 4Ó(€GÜ ¤£Ó,€HÜ˜×)Ñ)¨G¨9Ó5€Fð	#ð ð ÔÐÒr   c                  óÈ   € ^ RI Hp  \        R4      w  rp\        \	        4       4      p\        RV ! W1V,           4      4      p\        VP                  V.4      pRpWg8X  g   Q hR# )r   ©ÚEqualityr   r    zŸcdef extern from 'file.h':
    void test(double x, double y, double *z)

def test_c(double x, double y):

    cdef double z = 0
    test(x, y, &z)
    return zN©Úsympy.core.relationalr,   r   r	   r   r   r   r!   ©r,   r"   r#   r$   r'   r&   r   r(   s           r   Útest_cython_wrapper_outargr0   4   s`   € Ý.Ü�gÓ�G€Aˆ!Ü ¤£Ó.€Hä˜6¡8¨A°1­uÓ#5Ó6€GÜ˜×)Ñ)¨G¨9Ó5€Fð	ð ð ÔÐÒr   c                  óÖ   € ^ RI Hp  \        R4      w  rp\        \	        4       4      p\        RV ! W1V,           V,           4      4      p\        VP                  V.4      pRpWg8X  g   Q hR# )r   r+   r   r    z“cdef extern from 'file.h':
    void test(double x, double y, double *z)

def test_c(double x, double y, double z):

    test(x, y, &z)
    return zNr-   r/   s           r   Útest_cython_wrapper_inoutargr2   G   sd   € Ý.Ü�gÓ�G€Aˆ!Ü ¤£Ó.€HÜ˜6¡8¨A°1­u°q­yÓ#9Ó:€GÜ˜×)Ñ)¨G¨9Ó5€Fð	ð ð ÔÐÒr   c                  óh  € ^ RI Hp  \        R4      w  rp\        RV ! W1V,           4      4      p\	        \        4       4      pRR\        P                  /,          p\        P                  ! 4       p\        P                  ! V4       \        P                  P                  VR4      pVP                  WGR7       \!        V4      P#                  4       p	W–8X  g   Q h\	        \        4       RR	.R
.RR.R.RR.RRR//R7      pRR\        P                  /,          pVP                  WGR7       \!        V4      P#                  4       p	W–8X  g   Q hRR\        P                  /,          pRVn        VP                  WGR7       \!        V4      P#                  4       p	W–8X  g   Q h\        P&                  ! 4        R# )r   r+   r   r    a¹  from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
cy_opts = {'compiler_directives': {'language_level': '3'}}

ext_mods = [Extension(
    'wrapper_module_%(num)s', ['wrapper_module_%(num)s.pyx', 'wrapped_code_%(num)s.c'],
    include_dirs=[],
    library_dirs=[],
    libraries=[],
    extra_compile_args=['-std=c99'],
    extra_link_args=[]
)]
setup(ext_modules=cythonize(ext_mods, **cy_opts))
Únumzsetup.py)Ú	build_dirz/usr/local/includez/opt/booger/includez/user/local/libÚthelibÚnilibz
-slow-mathz-lswampz	-ltridentÚcompiler_directivesÚboundscheckF)Úinclude_dirsÚlibrary_dirsÚ	librariesÚextra_compile_argsÚextra_link_argsÚcythonize_optionsa)  from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
cy_opts = {'compiler_directives': {'boundscheck': False}}

ext_mods = [Extension(
    'wrapper_module_%(num)s', ['wrapper_module_%(num)s.pyx', 'wrapped_code_%(num)s.c'],
    include_dirs=['/usr/local/include', '/opt/booger/include'],
    library_dirs=['/user/local/lib'],
    libraries=['thelib', 'nilib'],
    extra_compile_args=['-slow-math', '-std=c99'],
    extra_link_args=['-lswamp', '-ltrident']
)]
setup(ext_modules=cythonize(ext_mods, **cy_opts))
aN  from setuptools import setup
from setuptools import Extension
from Cython.Build import cythonize
cy_opts = {'compiler_directives': {'boundscheck': False}}
import numpy as np

ext_mods = [Extension(
    'wrapper_module_%(num)s', ['wrapper_module_%(num)s.pyx', 'wrapped_code_%(num)s.c'],
    include_dirs=['/usr/local/include', '/opt/booger/include', np.get_include()],
    library_dirs=['/user/local/lib'],
    libraries=['thelib', 'nilib'],
    extra_compile_args=['-slow-math', '-std=c99'],
    extra_link_args=['-lswamp', '-ltrident']
)]
setup(ext_modules=cythonize(ext_mods, **cy_opts))
TN)r.   r,   r   r   r	   r   r   Ú_module_counterÚtempfileÚmkdtempr   Ú
tmp_folderÚosÚpathÚjoinÚ_prepare_filesr   Ú	read_textÚ_need_numpyÚcleanup)
r,   r"   r#   r$   r&   r'   r(   Útemp_dirÚsetup_file_pathÚ
setup_texts
             r   Ú!test_cython_wrapper_compile_flagsrN   X   s¢  € Ý.Ü�gÓ�G€Aˆ!Ü˜6¡8¨A°1­uÓ#5Ó6€Gä ¤£Ó,€Hðð Œk×)Ñ)Ð*õ+€Hô" ×ÒÓ!€HÜ×Ò˜hÔ'Ü—g‘g—l‘l 8¨ZÓ8€Oà×Ñ˜GÐÔ8Ü�oÓ&×0Ñ0Ó2€JØÔ!Ð!Ð!ä ¤£Ø/CÐEZÐ.[Ø/@Ð.AØ,4°gÐ+>Ø5A°NØ2;¸[Ð1IØ4IÈMÐ[`ÐKaÐ3bô#€Hðð Œk×)Ñ)Ð*õ+€Hð" ×Ñ˜GÐÔ8Ü�oÓ&×0Ñ0Ó2€JØÔ!Ð!Ð!ðð  Œk×)Ñ)Ð*õ!+€Hð$  €HÔØ×Ñ˜GÐÔ8Ü�oÓ&×0Ñ0Ó2€JØÔ!Ð!Ð!ä×ÒÖr   c                  ón  € ^ RI Hp  ^ RIHp V! R4      V! R4      V! R4      rCpW#V3 Uu. uF  p\	        VP
                  4      NK  	  upw  rgpV ! WBV,           4      p	\        RV	4      p
\        \        4       4      p\        VP                  V
.4      pRpVP                  WgVR7      pWÎ8X  g   Q hR	# u upi )
r   r+   )ÚDummyr"   r#   r$   r    zåcdef extern from 'file.h':
    void test(double x_{x_id}, double y_{y_id}, double *z_{z_id})

def test_c(double x_{x_id}, double y_{y_id}):

    cdef double z_{z_id} = 0
    test(x_{x_id}, y_{y_id}, &z_{z_id})
    return z_{z_id})Úx_idÚy_idÚz_idN)r.   r,   Úsympy.core.symbolrP   ÚstrÚdummy_indexr   r	   r   r   r!   Úformat)r,   rP   r"   r#   r$   ÚdrQ   rR   rS   r%   r&   r'   r   Úexpected_templater(   s                  r   Ú$test_cython_wrapper_unique_dummyvarsrZ   ®   s±   € Ý.Ý'Ù�C‹j™% ›*¡e¨C£jˆ!€AØ56¸1±IÓ>±I¨qœ˜AŸM™MÖ*±IÑ>Ñ€D�Ù�A˜1•uÓ€DÜ˜6 4Ó(€GÜ ¤£Ó,€HÜ˜×)Ñ)¨G¨9Ó5€Fð	ð ð !×'Ñ'¨TÀ4Ð'ÓH€HØÔÐÒùò ?s   ªB2c                  ój  € \        R 4      w  rp\        W,           RR7      pV! 4       \        W,           4      8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q h\        \        W V,           4      RR7      pV! 4       \        W,           4      8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q h\        \        W V,           V,           4      RR7      pV! 4       \        W,           V,           4      8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q hR# )úx y zÚdummy©Úbackendzx, yÚnamelessr$   zx, y, zN)r   r   rU   ÚargsÚreturnsr   )r"   r#   r$   Úfs       r   Útest_autowrap_dummyrd   Ã   sÿ   € Ü�gÓ�G€Aˆ!ô 	�• Ô(€AÙ‹3”#�a•e“*ÔÐÐØ�6‰6�VÔÐÐØ�9‰9˜
Ô"Ð"Ð"Ü”�A˜1•u“ wÔ/€AÙ‹3”#�a•e“*ÔÐÐØ�6‰6�VÔÐÐØ�9‰9˜ÔÐÐÜ”�A˜1•u˜q•yÓ!¨7Ô3€AÙ‹3”#�a•e˜a•i“.Ô Ð Ð Ø�6‰6�YÔÐÐØ�9‰9˜ÔÐÒr   c                  ó  aaa€ \        R 4      w  ooo\        \        VVV3R l4       \        \	        SSS,           4      RSS.R7      p V ! 4       \        SS,           4      8X  g   Q hV P                  R8X  g   Q hV P                  R8X  g   Q h\        \        VVV3R l4       \        \	        SSS,           S,           4      RSSS.R7      p V ! 4       \        SS,           S,           4      8X  g   Q hV P                  R8X  g   Q hV P                  R8X  g   Q h\        \	        SSS,           S,           4      RSSS3R7      p V ! 4       \        SS,           S,           4      8X  g   Q hV P                  R8X  g   Q hV P                  R8X  g   Q hR# )	r\   c                  óD   <€ \        \        SS S,           4      R S .R7      # ©r]   ©r_   ra   ©r   r   ©r"   r#   r$   s   €€€r   Ú<lambda>Ú$test_autowrap_args.<locals>.<lambda>Ù   s   ø€ ¬X´b¸¸AÀ½E³lØ ! õ.&r   r]   rh   zy, xr$   c                  óT   <€ \        \        SS S,           S,           4      R S S.R7      # rg   ri   rj   s   €€€r   rk   rl   à   s$   ø€ ¬X´b¸¸AÀ½EÀA½IÓ6FØ ! Q õ.)r   zy, x, zN)r   r   r   r   r   rU   ra   rb   )rc   r"   r#   r$   s    @@@r   Útest_autowrap_argsrn   Ö   sQ  ú€ Ü�gÓ�G€A€qˆ!ä
Ô#ö &&ô 'ä”�A�q˜1•u“ w°a¸°VÔ<€AÙ‹3”#�a˜!•e“*ÔÐÐØ�6‰6�VÔÐÐØ�9‰9˜ÔÐÐä
Ô#ö &)ô *ä”�A�q˜1•u˜q•yÓ!¨7¸!¸QÀ¸ÔC€AÙ‹3”#�a˜!•e˜a•i“.Ô Ð Ð Ø�6‰6�YÔÐÐØ�9‰9˜ÔÐÐä”�A�q˜1•u˜q•yÓ!¨7¸!¸QÀ¸ÔC€AÙ‹3”#�a˜!•e˜a•i“.Ô Ð Ð Ø�6‰6�YÔÐÐØ�9‰9˜ÔÐÒr   c                  ó\  € \        R 4      w  r\        P                  ! 4       p\        P                  ! V4       \        W,           RVR7      pV! 4       \        W,           4      8X  g   Q h\        P                  ! V\        P                  4      '       g   Q h\        P                  ! 4        R# )úx yr]   ©r_   ÚtempdirN)r   rA   rB   r   rC   r   rU   rD   ÚaccessÚF_OKrJ   )r"   r#   Útmprc   s       r   Útest_autowrap_store_filesrv   ì   sv   € Ü�5‹>�D€AÜ
×
Ò
Ó
€CÜ×Ò˜cÔ"ä�• °Ô5€AÙ‹3”#�a•e“*ÔÐÐÜ�9Š9�Sœ"Ÿ'™'×"Ò"Ð"Ð"ä×ÒÖr   c                  ó  € \        R 4      w  rRp\        P                  ! 4       p\        P                  ! 4       p \        P
                  ! V4       \        W,           RVR7      pV! 4       \        W,           4      8X  g   Q h\        P                  ! V\        P                  4      '       g   Q h \        P
                  ! V4       \        P                  ! V4       R#   \        P
                  ! T4       \        P                  ! T4       i ; i)rp   z./tmpr]   rq   N)r   rD   ÚgetcwdrA   rB   Úchdirr   rU   rs   rt   ÚshutilÚrmtree)r"   r#   ru   Ú	saved_cwdÚtemp_cwdrc   s         r   Ú'test_autowrap_store_files_issue_gh12939r~   ÷   s±   € Ü�5‹>�D€AØ
€CÜ—	’	“€IÜ×ÒÓ!€Hð Ü
�Š�ÔÜ�Q•U G°SÔ9ˆÙ‹s”c˜!�%“jÔ Ð Ð Ü�yŠy˜œbŸg™g×&Ò&Ð&Ñ&ä
�Š�ÔÜ�Š�hÖøô 	�Š�ÔÜ�Š�hÕús   »A1C Â-C Ã.Dc                  ó”   € \        R 4      w  r\        RW,           RR7      pVP                  4       \        W,           4      8X  g   Q hR# )rp   rc   r]   r^   N)r   r   Ú_imp_rU   )r"   r#   rc   s      r   Útest_binary_functionr�     s7   € Ü�5‹>�D€AÜ˜˜Q�U¨GÔ4€AØ�7‰7‹9œ˜A�E›
Ô"Ð"Ò"r   c                  óì   € \        R 4      w  rp\        \        R4      4      p\        RW,           V,           4      p\	        VP
                  V.4      pRR\        P                  /,          pWV8X  g   Q hR# )r   Úufuncifyr    af	  #include "Python.h"
#include "math.h"
#include "numpy/ndarraytypes.h"
#include "numpy/ufuncobject.h"
#include "numpy/halffloat.h"
#include "file.h"

static PyMethodDef wrapper_module_%(num)sMethods[] = {
        {NULL, NULL, 0, NULL}
};

#ifdef NPY_1_19_API_VERSION
static void test_ufunc(char **args, const npy_intp *dimensions, const npy_intp* steps, void* data)
#else
static void test_ufunc(char **args, npy_intp *dimensions, npy_intp* steps, void* data)
#endif
{
    npy_intp i;
    npy_intp n = dimensions[0];
    char *in0 = args[0];
    char *in1 = args[1];
    char *in2 = args[2];
    char *out0 = args[3];
    npy_intp in0_step = steps[0];
    npy_intp in1_step = steps[1];
    npy_intp in2_step = steps[2];
    npy_intp out0_step = steps[3];
    for (i = 0; i < n; i++) {
        *((double *)out0) = test(*(double *)in0, *(double *)in1, *(double *)in2);
        in0 += in0_step;
        in1 += in1_step;
        in2 += in2_step;
        out0 += out0_step;
    }
}
PyUFuncGenericFunction test_funcs[1] = {&test_ufunc};
static char test_types[4] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE};
static void *test_data[1] = {NULL};

#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef moduledef = {
    PyModuleDef_HEAD_INIT,
    "wrapper_module_%(num)s",
    NULL,
    -1,
    wrapper_module_%(num)sMethods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC PyInit_wrapper_module_%(num)s(void)
{
    PyObject *m, *d;
    PyObject *ufunc0;
    m = PyModule_Create(&moduledef);
    if (!m) {
        return NULL;
    }
    import_array();
    import_umath();
    d = PyModule_GetDict(m);
    ufunc0 = PyUFunc_FromFuncAndData(test_funcs, test_data, test_types, 1, 3, 1,
            PyUFunc_None, "wrapper_module_%(num)s", "Created in SymPy with Ufuncify", 0);
    PyDict_SetItemString(d, "test", ufunc0);
    Py_DECREF(ufunc0);
    return m;
}
#else
PyMODINIT_FUNC initwrapper_module_%(num)s(void)
{
    PyObject *m, *d;
    PyObject *ufunc0;
    m = Py_InitModule("wrapper_module_%(num)s", wrapper_module_%(num)sMethods);
    if (m == NULL) {
        return;
    }
    import_array();
    import_umath();
    d = PyModule_GetDict(m);
    ufunc0 = PyUFunc_FromFuncAndData(test_funcs, test_data, test_types, 1, 3, 1,
            PyUFunc_None, "wrapper_module_%(num)s", "Created in SymPy with Ufuncify", 0);
    PyDict_SetItemString(d, "test", ufunc0);
    Py_DECREF(ufunc0);
}
#endifr4   N)r   r
   r   r   r   Údump_cr   r@   )r"   r#   r$   Úcode_wrapperr&   r   r(   s          r   Útest_ufuncify_sourcer†     st   € Ü�gÓ�G€Aˆ!Ü&¤z°*Ó'=Ó>€LÜ˜6 1¥5¨1¥9Ó-€GÜ˜×+Ñ+¨g¨YÓ7€FðW
ðn ”K×/Ñ/Ð0õoW1€Hðp ÔÐÒr   c            
      óº  € \        R 4      w  rpWV3pW^,          ,           ^
V^,          ,          ,           p\        \        R4      4      p\        \	        V4      4       Uu. uF4  p\        RP                  V4      VP                  W6,          4      V4      NK6  	  pp\        VP                  VRR7      pRR\        P                  /,          p	W‰8X  g   Q hR# u upi )r   rƒ   zfunc{}Ú	multitest)Úfuncnamea  #include "Python.h"
#include "math.h"
#include "numpy/ndarraytypes.h"
#include "numpy/ufuncobject.h"
#include "numpy/halffloat.h"
#include "file.h"

static PyMethodDef wrapper_module_%(num)sMethods[] = {
        {NULL, NULL, 0, NULL}
};

#ifdef NPY_1_19_API_VERSION
static void multitest_ufunc(char **args, const npy_intp *dimensions, const npy_intp* steps, void* data)
#else
static void multitest_ufunc(char **args, npy_intp *dimensions, npy_intp* steps, void* data)
#endif
{
    npy_intp i;
    npy_intp n = dimensions[0];
    char *in0 = args[0];
    char *in1 = args[1];
    char *in2 = args[2];
    char *out0 = args[3];
    char *out1 = args[4];
    char *out2 = args[5];
    npy_intp in0_step = steps[0];
    npy_intp in1_step = steps[1];
    npy_intp in2_step = steps[2];
    npy_intp out0_step = steps[3];
    npy_intp out1_step = steps[4];
    npy_intp out2_step = steps[5];
    for (i = 0; i < n; i++) {
        *((double *)out0) = func0(*(double *)in0, *(double *)in1, *(double *)in2);
        *((double *)out1) = func1(*(double *)in0, *(double *)in1, *(double *)in2);
        *((double *)out2) = func2(*(double *)in0, *(double *)in1, *(double *)in2);
        in0 += in0_step;
        in1 += in1_step;
        in2 += in2_step;
        out0 += out0_step;
        out1 += out1_step;
        out2 += out2_step;
    }
}
PyUFuncGenericFunction multitest_funcs[1] = {&multitest_ufunc};
static char multitest_types[6] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE};
static void *multitest_data[1] = {NULL};

#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef moduledef = {
    PyModuleDef_HEAD_INIT,
    "wrapper_module_%(num)s",
    NULL,
    -1,
    wrapper_module_%(num)sMethods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC PyInit_wrapper_module_%(num)s(void)
{
    PyObject *m, *d;
    PyObject *ufunc0;
    m = PyModule_Create(&moduledef);
    if (!m) {
        return NULL;
    }
    import_array();
    import_umath();
    d = PyModule_GetDict(m);
    ufunc0 = PyUFunc_FromFuncAndData(multitest_funcs, multitest_data, multitest_types, 1, 3, 3,
            PyUFunc_None, "wrapper_module_%(num)s", "Created in SymPy with Ufuncify", 0);
    PyDict_SetItemString(d, "multitest", ufunc0);
    Py_DECREF(ufunc0);
    return m;
}
#else
PyMODINIT_FUNC initwrapper_module_%(num)s(void)
{
    PyObject *m, *d;
    PyObject *ufunc0;
    m = Py_InitModule("wrapper_module_%(num)s", wrapper_module_%(num)sMethods);
    if (m == NULL) {
        return;
    }
    import_array();
    import_umath();
    d = PyModule_GetDict(m);
    ufunc0 = PyUFunc_FromFuncAndData(multitest_funcs, multitest_data, multitest_types, 1, 3, 3,
            PyUFunc_None, "wrapper_module_%(num)s", "Created in SymPy with Ufuncify", 0);
    PyDict_SetItemString(d, "multitest", ufunc0);
    Py_DECREF(ufunc0);
}
#endifr4   N)r   r
   r   ÚrangeÚlenr   rW   Údiffr   r„   r   r@   )
r"   r#   r$   Úvar_symbolsr%   r…   Úir   r   r(   s
             r   Ú test_ufuncify_source_multioutputr�   l  sÊ   € Ü�gÓ�G€Aˆ!Ø˜�)€KØ�!�t�8�b˜˜A�•gÕ€DÜ&¤z°*Ó'=Ó>€LÜbgÔhkÐlwÓhxÔbyÓzÑbyÐ]^”˜XŸ_™_¨QÓ/°·±¸;½>Ó1JÈKÖXÑby€HÐzÜ˜×+Ñ+¨XÀÔL€Fð_
ð~ ”K×/Ñ/Ð0õ_1€Hð@ ÔÐÒùòE {s   Á!:C)Úfile)&rD   rA   rz   Úior   Úpathlibr   Ú
sympy.corer   r   Úsympy.utilities.autowrapr   r   r	   r
   r   Úsympy.utilities.codegenr   r   r   r   Úsympy.testing.pytestr   Úsympy.testing.tmpfilesr   r   r)   r0   r2   rN   rZ   rd   rn   rv   r~   r�   r†   r�   © r   r   Ú<module>r™      s}   ðó 
Û Û Ý Ý ç "÷Aõ A÷ó õ (Ý 1ôòò"ò&ò"Tòlò*ò&ò,	ò ò#ò]ô@gr   