� H�g� ���dd�Zd�ZdS)�printc�n�������sd��n�dkrdg��fd���sd��n�dkrdg��fd�����fd�}|S)az 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��dS�N���vs �`/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/mpmath/usertools.py�<lambda>zmonitor.<locals>.<lambda>*s��$��r�c�n��|\}}td�d�d|�d|�����dxxdz cc<dS)Nzin r � ��r)�value�args�kwargs�incounts �r �inputzmonitor.<locals>.input-sJ��� �L�D�&� �E�G�A�J�J�J����f�f�=� >� >� >� �A�J�J�J�!�O�J�J�J�J�Jr c��dSrrrs r r zmonitor.<locals>.<lambda>2s��4�r c�^��td�d�d|�����dxxdz cc<dS)Nzout r rrr)r�outcounts �r �outputzmonitor.<locals>.output5s<��� �E��!����e�e�4� 5� 5� 5� �Q�K�K�K�1� �K�K�K�K�Kr c�H���||f���|i|��}�|��|Srr)rrr�frrs ���r � f_monitoredzmonitor.<locals>.f_monitored8s=��� ��t�V�n���� �A�t� �v� � ����q� � � ��r r)rrrrrrs``` @@r �monitorrs��������N ������ �'� � ��#�� � � � � � ������ �7� � ��3�� � � � � �������� �r c�P���� ���d��}d�vr�d=�s�r,t���dkr�s�d� � �fd�}n ���fd�}n�}ddlm}|��}|��}|��}||z } | dks|r| St d��D]�} |��}|��|��|��|��|��|��|��|��|��|��|��}t | ||z d z ��} ��| S) 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. �oncerr c�������Srr)�argrs��r r ztiming.<locals>.<lambda>Ms�����#���r c�����i���Srr)rrrs���r r ztiming.<locals>.<lambda>Os�����4�*�6�*�*�r )� default_timerg�������?�� )�get�len�timeitr#�range�min) rrrr�g�clock�t1r�t2�t�ir!s ``` @r �timingr1?s{������ �:�:�f� � �D� ���� �6�N� ��v�� �t�9�9��>�>�&�>��q�'�C������A�A�*�*�*�*�*�*�A�A� ��-�-�-�-�-�-� �u�w�w�B�!�!�#�#��%�%�'�'�r�R��U�1��4�x�x�4�x��� �1�X�X���� �5�7�7�� �����A�A�C�C�C������A�A�C�C�C������A�A�C�C�C������A�A�C�C�C������A�A�C�C�C� �5�7�7�� �a��B��� � � ��� �Hr N)rr)rr1rr r �<module>r2s3��;�;�;�;�z � � � � r
Memory