ó
Ħĵ\c           @   s  d  d l  m Z d  d l m Z d  d l m Z 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 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(   i˙˙˙˙(   t   import_module(   t   ccode(   t   compile_link_import_stringst   has_c(   t   TemporaryDirectoryt	   may_xfail(   t   skip(   t   Range(
   t   FunctionDefinitiont   FunctionPrototypet   Variablet   Pointert   realt
   Assignmentt   integerR
   t	   CodeBlockt   While(   t   voidt   PreIncrement(   t   render_as_source_filet   cythont   numpyc          C   sĤ   t  d t  t d t  t d t  f }  \ } } } t  d t  } t | | k  t | | | |  t |  g  } t | j d d  |  } t	 t
 d |  |  S(   Nt   nt   inpt   outt   it   valuei    t   our_test_function(   R
   R   R   R   R   R   R   R   t   as_DeclarationR   R   (   t   declarsR   R   R   R   t   whlt   body(    (    sD   lib/python2.7/site-packages/sympy/codegen/tests/test_applications.pyt	   _mk_func1   s
    72c      
   C   sm   t  |  d t d t  } t t j |    } t d | f d d j d | d |  j d d	  f g d
 | S(   Nt   settingst   contracts   our_test_func.cs   _our_test_func.pyxsf   cdef extern {declar}
def _{fname}({typ}[:] inp, {typ}[:] out):
    {fname}(inp.size, &inp[0], &out[0])t   declart   fnamet   typt   doublet	   build_dir(	   R   t   dictt   FalseR   R	   t   from_FunctionDefinitionR   t   formatt   name(   t   funcdefR'   t   code_strR#   (    (    sD   lib/python2.7/site-packages/sympy/codegen/tests/test_applications.pyt   _render_compile_import   s    	c          C   sı   t  s t d  n  t   s) t d  n  t s< t d  n  d  }  t   h } t t   d | \ } }  t  j d  } t  j	 |  } | j
 | |  t  j | |  sŻ t  Wd  QXd  S(   Ns   numpy not installed.s   No C compiler found.s   Cython not found.R'   g      $@(   t   npR   R   R   t   NoneR   R/   R    t   aranget
   empty_liket   _our_test_functiont   allcloset   AssertionError(   t   infot   foldert   modR   R   (    (    sD   lib/python2.7/site-packages/sympy/codegen/tests/test_applications.pyt   test_copying_function(   s    	N("   t   sympy.externalR    t   sympy.printing.ccodeR   t   sympy.utilities._compilationR   R   t!   sympy.utilities._compilation.utilR   R   t   sympy.utilities.pytestR   t
   sympy.setsR   t   sympy.codegen.astR   R	   R
   R   R   R   R   R   R   t   sympy.codegen.cnodesR   R   t   sympy.codegen.cutilsR   R   R0   R    R/   R:   (    (    (    sD   lib/python2.7/site-packages/sympy/codegen/tests/test_applications.pyt   <module>   s   F		