Ñò
 pXJc           @   s‚   d  d k  Z  e  i i d d ƒ d  d k Z d  d k Td „  Z d „  Z d „  Z d „  Z e	 d	 j o e ƒ  e d
 d ƒ n d S(   iÿÿÿÿNi    s   ..(   t   *c         C   s   d } t  i | d d g ƒ S(   sn    Uses CXX C code to implement a simple map-like function.
        It does not provide any error checking.
    s5  
           #line 22 "functional.py"
           py::tuple args(1);
           int N = seq.len();
           py::list result(N);
           for(int i = 0; i < N;i++)
           {
              args[0] = seq[i];
              result[i] = func.call(args);
           }
           return_val = result;
           t   funct   seq(   t   inline_toolst   inline(   R   R   t   code(    (    sO   C:\graphics\Tools\Python26\Lib\site-packages\scipy\weave\examples\functional.pyt
   c_list_map   s    c         C   s   d } t  i | d d g ƒ S(   s|    Uses Python API more than CXX to implement a simple map-like function.
        It does not provide any error checking.
    s–  
           #line 40 "functional.py"
           py::tuple args(1);
           PyObject* py_args = (PyObject*)args;
           py::list result(seq.len());
           PyObject* py_result = (PyObject*)result;
           PyObject* item = NULL;
           PyObject* this_result = NULL;
           int N = seq.len();
           for(int i = 0; i < N;i++)
           {
              item = PyList_GET_ITEM(py_seq,i);
              Py_INCREF(item);
              PyTuple_SetItem(py_args,0,item);
              this_result = PyEval_CallObject(py_func,py_args);
              PyList_SetItem(py_result,i,this_result);
           }
           return_val = result;
           R   R   (   R   R   (   R   R   R   (    (    sO   C:\graphics\Tools\Python26\Lib\site-packages\scipy\weave\examples\functional.pyt   c_list_map2"   s    c          C   sI   d d d g }  d Gt  t |  ƒ GHd Gt t |  ƒ GHd Gt t |  ƒ GHd  S(   Nt   aat   bbbt   ccccs   desired:s   actual:s   actual2:(   t   mapt   lenR   R   (   R   (    (    sO   C:\graphics\Tools\Python26\Lib\site-packages\scipy\weave\examples\functional.pyt   main<   s    c   
   	   C   sH  d d  k  } d g | } | i  ƒ  } x# t |  ƒ D] } t t | ƒ } q2 W| i  ƒ  } | | } d G| GHt t | ƒ } | i  ƒ  } x# t |  ƒ D] } t t | ƒ } q’ W| i  ƒ  } | | }	 d G|	 GHd G| |	 GHt t | ƒ } | i  ƒ  } x# t |  ƒ D] } t t | ƒ } qÿ W| i  ƒ  } | | }	 d G|	 GHd G| |	 GHd  S(   Niÿÿÿÿt   aadasdfs   python speed:s   SCXX speed:s	   speed up:s   c speed:(   t   timet   rangeR   R   R   R   (
   t   mt   nR   R   t   t1t   it   resultt   t2t   pyt   c(    (    sO   C:\graphics\Tools\Python26\Lib\site-packages\scipy\weave\examples\functional.pyt   time_itB   s6     
	 
	 
	t   __main__id   iè  (
   t   syst   patht   insertR   t   typesR   R   R   R   t   __name__(    (    (    sO   C:\graphics\Tools\Python26\Lib\site-packages\scipy\weave\examples\functional.pyt   <module>   s   
				