o
    X۷i	                     @  s8   d dl mZ d dlZd dlZdd Z			d	ddZdS )
    )annotationsNc                 C  s   | dk rt t| S tjS )zlCompute the factorial and return as a float

    Returns infinity when result is too large for a double
       )floatmath	factorialcupyinf)n r
   L/home/ubuntu/vllm_env/lib/python3.10/site-packages/cupyx/scipy/_lib/_util.pyfloat_factorial   s   r   TFc                 C  sJ   |sddl }|jj| rd}t||r#t| tjs#| jtj	d} | S )a  Helper function for SciPy argument validation.

    Many CuPy linear algebra functions do support arbitrary array-like
    input arguments. Examples of commonly unsupported inputs include
    matrices containing inf/nan, sparse matrix representations, and
    matrices with complicated elements.

    Parameters
    ----------
    a : array-like
        The array-like input
    check_finite : bool, optional
        By default True. To check whether the input matrices contain
        only finite numbers. Disabling may give a performance gain,
        but may result in problems (crashes, non-termination) if the
        inputs do contain infinites or NaNs
    sparse_ok : bool, optional
        By default False. True if cupy sparse matrices are allowed
    objects_ok : bool, optional
        By default False. True if arrays with dype('O') are allowed
    mask_ok : bool, optional
        By default False. True if masked arrays are allowed.
    as_inexact : bool, optional
        By default False. True to convert the input array to a
        cupy.inexact dtype

    Returns
    -------
    ret : cupy.ndarray
        The converted validated array

    r   Nz~Sparse matrices are not supported by this function. Perhaps one of the cupyx.scipy.sparse.linalg functions would work instead.)dtype)
cupyx.scipy.sparsescipysparseissparse
ValueErrorr   
issubdtypeinexactastypefloat64)acheck_finite	sparse_ok
objects_okmask_ok
as_inexactcupyxmsgr
   r
   r   _asarray_validated   s   $r   )TFFFF)
__future__r   r   r   r   r   r
   r
   r
   r   <module>   s    