
    Џkh                     &    d Z ddlmZmZ ddlZd Zy)a  
This module calculates the reduction ratio for trust-region methods.

Translated from Zaikun Zhang's modern-Fortran reference implementation in PRIMA.

Dedicated to late Professor M. J. D. Powell FRS (1936--2015).

Python translation by Nickolai Belakovski.
   )	DEBUGGINGREALMAX    Nc                    t         r|dk\  sJ t        j                  |       rt         }nt        j                  |      s|dk  r| dkD  r|dz  }nlt         }ndt        j                  |      rt        j                  |       rd}n7t        j                  |      rt        j
                  |       rt         }n| |z  }t         rt        j                  |      rJ |S )zh
    This function evaluates the reduction ratio of a trust-region step, handling inf/nan properly.
    r      r   )r   npisnanr   isposinfisneginf)aredpredrshrinkratios       [/var/www/teggl/fontify/venv/lib/python3.12/site-packages/scipy/_lib/pyprima/common/ratio.pyredratr      s     !|| 
xx~	$419 !8AIE HE	T	r{{40	T	r{{40T	 88E?""L    )__doc__constsr   r   numpyr   r    r   r   <module>r      s    ' (r   