ó
    ˆ*£hÕ  ã                   ó   • SS jr S rg)Úprintc                 óˆ   ^ ^^^^• T(       d  S mOTS:X  a	  S/mU4S jmT(       d  S mOTS:X  a	  S/mU4S jmU UU4S jnU$ )aú  
Returns a wrapped copy of *f* that monitors evaluation by calling
*input* with every input (*args*, *kwargs*) passed to *f* and
*output* with every value returned from *f*. The default action
(specify using the special string value ``'print'``) is to print
inputs and outputs to stdout, along with the total evaluation
count::

    >>> from mpmath import *
    >>> mp.dps = 5; mp.pretty = False
    >>> diff(monitor(exp), 1)   # diff will eval f(x-h) and f(x+h)
    in  0 (mpf('0.99999999906867742538452148'),) {}
    out 0 mpf('2.7182818259274480055282064')
    in  1 (mpf('1.0000000009313225746154785'),) {}
    out 1 mpf('2.7182818309906424675501024')
    mpf('2.7182808')

To disable either the input or the output handler, you may
pass *None* as argument.

Custom input and output handlers may be used e.g. to store
results for later analysis::

    >>> mp.dps = 15
    >>> input = []
    >>> output = []
    >>> findroot(monitor(sin, input.append, output.append), 3.0)
    mpf('3.1415926535897932')
    >>> len(input)  # Count number of evaluations
    9
    >>> print(input[3]); print(output[3])
    ((mpf('3.1415076583334066'),), {})
    8.49952562843408e-5
    >>> print(input[4]); print(output[4])
    ((mpf('3.1415928201669122'),), {})
    -1.66577118985331e-7

c                 ó   • g ©N© ©Úvs    ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/mpmath/usertools.pyÚ<lambda>Úmonitor.<locals>.<lambda>*   s   € ˜$ó    r   é    c                 ó\   >• U u  p[        STS   < SU< SU< 35        TS==   S-  ss'   g )Nzin  r   Ú é   ©r   )ÚvalueÚargsÚkwargsÚincounts      €r	   ÚinputÚmonitor.<locals>.input-   s*   ø€ Ø ‰LˆDÝ G¨A¤J³²fÐ=Ô>Ø�A‹J˜!‰OŒJr   c                 ó   • g r   r   r   s    r	   r
   r   2   s   € ˜4r   c                 óL   >• [        STS   < SU < 35        TS==   S-  ss'   g )Nzout r   r   r   r   )r   Úoutcounts    €r	   ÚoutputÚmonitor.<locals>.output5   s"   ø€ Ý ¨!¤ªeÐ4Ô5Ø�Q‹K˜1ÑŒKr   c                  ó:   >• T" X45        T" U 0 UD6nT" U5        U$ r   r   )r   r   r   Úfr   r   s      €€€r	   Úf_monitoredÚmonitor.<locals>.f_monitored8   s(   ø€ ÙˆtˆnÔÙˆtÐ�vÑˆÙˆqŒ	Øˆr   r   )r   r   r   r   r   r   s   ``` @@r	   Úmonitorr!      sM   ü€ öN Ù‰Ø	�'Ó	Ø�#ˆõ	ö Ù‰Ø	�7Ó	Ø�3ˆõ	÷ð
 Ðr   c                 ó   ^ ^^^• TR                  S5      nST;   a  TS	 T(       d  T(       a,  [        T5      S:X  a  T(       d  TS   mUU 4S jnOUU U4S jnOT nSSKJn  U" 5       od" 5       ou" 5       oˆU-
  n	U	S:”  d  U(       a  U	$ [	        S5       Hh  n
U" 5       nU" 5         U" 5         U" 5         U" 5         U" 5         U" 5         U" 5         U" 5         U" 5         U" 5         U" 5       n[        X˜U-
  S	-  5      n	Mj     U	$ )
zÞ
Returns time elapsed for evaluating ``f()``. Optionally arguments
may be passed to time the execution of ``f(*args, **kwargs)``.

If the first call is very quick, ``f`` is called
repeatedly and the best time is returned.
Úoncer   r   c                  ó   >• T" T 5      $ r   r   )Úargr   s   €€r	   r
   Útiming.<locals>.<lambda>M   s	   ø€ ™˜#œr   c                  ó   >• T" T 0 TD6$ r   r   )r   r   r   s   €€€r	   r
   r&   O   s   ø€ ™˜4Ð* 6Ò*r   )Údefault_timergš™™™™™©?é   é
   )ÚgetÚlenÚtimeitr(   ÚrangeÚmin)r   r   r   r#   ÚgÚclockÚt1r   Út2ÚtÚir%   s   ```        @r	   Útimingr6   ?   sÖ   û€ ð �:‰:�fÓ€DØ�ÓØ�6ˆNÞŽvÜˆt‹9˜‹>¦&Ø�q‘'ˆCÝ‰Aæ*‰AàˆÝ-Ùƒw€B�!“#�˜%›'�r¨¡U 1Øˆ4ƒx–4ØˆÜ�1ŽXˆÙ‹7ˆñ 	
Œ‰AŒC‘”‘A”C™œ™AœC¡¤¡A¤C©¬©A¬CÙ‹7ˆÜ
ˆa�B‘˜‘
Ó
Šñ ð €Hr   N)r   r   )r!   r6   r   r   r	   Ú<module>r7      s   ðô;ózr   