
    g                         d dl Z d dlmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZmZmZ d dlmZmZ d d	lmZ  ed
          Z ed          Zd Zd Ze	d             ZdS )    N)import_module)ccode)compile_link_import_stringshas_c)	may_xfail)skip)	FunctionDefinitionFunctionPrototypeVariablePointerreal
Assignmentinteger	CodeBlockWhile)voidPreIncrement)render_as_source_filecythonnumpyc                     t          dt                    t          dt                    t          dt                    fx} \  }}}t          dt                    }t	          ||k     t          ||         ||                   t          |          g          }t          |                    d          |          }t          t          d| |          S )Nninpoutir   )valueour_test_function)r   r   r   r   r   r   r   r   as_Declarationr	   r   )declarsr   r   r   r   whlbodys          a/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/codegen/tests/test_applications.py	_mk_func1r#      s    $S'22GE44H4H'RWY]J^J^^^GkacgA
!jQQ00,q//B
C
CCQ%%A%..44Dd$7$GGG    c           	          t          | ddi          }t          t          j        |                     }t	          d|fdd                    d          dz                       || j        d	
          fg|          S )NcontractF)settingszour_test_func.cz_our_test_func.pyxz#cython: language_level={}
3zfcdef extern {declar}
def _{fname}({typ}[:] inp, {typ}[:] out):
    {fname}(inp.size, &inp[0], &out[0])double)declarfnametyp	build_dir)r   r   r
   from_FunctionDefinitionr   formatname)funcdefr.   code_strr*   s       r"   _render_compile_importr4      s    $W
E7JKKKH$<WEEFFF&	H%	 > E Ec J J!J!J LR6+18 LR L" L"	#(    r$   c                     t           st          d           t                      st          d           t          st          d           d } t	          j                    5 }t          t                      |          \  }} t                               d          }t           	                    |          }|
                    ||           t                               ||          sJ 	 d d d            d S # 1 swxY w Y   d S )Nznumpy not installed.zNo C compiler found.zCython not found.r-   g      $@)npr   r   r   tempfileTemporaryDirectoryr4   r#   arange
empty_like_our_test_functionallclose)infofoldermodr   r   s        r"   test_copying_functionr@   *   s-    %#$$$77 %#$$$ " !!!D		$	&	& %&*9;;&III	TiioommC  sC((({{3$$$$$$% % % % % % % % % % % % % % % % % %s   BC55C9<C9) r7   sympy.externalr   sympy.printing.codeprinterr   sympy.utilities._compilationr   r   !sympy.utilities._compilation.utilr   sympy.testing.pytestr   sympy.codegen.astr	   r
   r   r   r   r   r   r   r   sympy.codegen.cnodesr   r   sympy.codegen.cutilsr   r   r6   r#   r4   r@    r$   r"   <module>rJ      sn    ( ( ( ( ( ( , , , , , , K K K K K K K K 7 7 7 7 7 7 % % % % % %                      4 3 3 3 3 3 3 3 6 6 6 6 6 6	x	 	 ]7H H H   % % % % %r$   