# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/60_isnp.ipynb.

# %% auto 0
__all__ = ['isnpnan', 'isnpmatrix', 'isnparrary', 'isnpmtx', 'isnparr', 'ismtx', 'isarr']

# %% ../nbs/60_isnp.ipynb 4
from typing import TypeGuard
from typing import Union

# %% ../nbs/60_isnp.ipynb 5
from .atyp import (npnan, npNaN, npNAN, npmatrix, npndarray)
from .atyp import (nan, NaN, NAN, matrix, ndarray)

# %% ../nbs/60_isnp.ipynb 7
def isnpnan(x) -> TypeGuard[Union[npnan, npNaN, npNAN]]:
    "Check if `x` is any of  `np.nan`, `np.NaN`, or `np.NAN`."
    return x is nan or x is NaN or x is NAN

# %% ../nbs/60_isnp.ipynb 8
def isnpmatrix(x) -> TypeGuard[npmatrix]:
    '''Check if `x` is an `np.matrix`.
    
    See Also
    --------
    isnpmtx : Alias for `isnpmatrix`.
    '''
    return isinstance(x, matrix)

def isnparrary(x) -> TypeGuard[npndarray]:
    '''Check if `x` is an `np.ndarray` (and not an `np.matrix`).
    
    Notes
    -----
    `np.matrix` is a subclass of `np.ndarray`, so `isinstance(x, np.ndarray)` 
    will return `True` for `np.matrix` objects.

    See Also
    --------
    isnparr : Alias for `isnparrary`.
    '''
    return isinstance(x, ndarray) and not isnpmatrix(x)


def isnpmtx(x) -> TypeGuard[npmatrix]:
    '''Check if `x` is an `np.matrix`.

    See Also
    --------
    isnpmatrix : Alias for `isnpmtx`.
    '''
    return isnpmatrix(x)

def isnparr(x) -> TypeGuard[npndarray]:
    '''Check if `x` is an `np.ndarray` (and not an `np.matrix`).
    
    Notes
    -----
    `np.matrix` is a subclass of `np.ndarray`, so `isinstance(x, np.ndarray)` 
    will return `True` for `np.matrix` objects.
    
    See Also
    --------
    isnparrary : Alias for `isnparr`.
    '''
    return isnparrary(x)


def ismtx(x) -> TypeGuard[npmatrix]:
    '''Check if `x` is an `np.matrix`.
    
    See Also
    --------
    isnpmatrix : Check if `x` is an `np.matrix`.
    isnpmtx : Alias for `isnpmatrix`.
    '''    
    return isnpmatrix(x)

def isarr(x) -> TypeGuard[npndarray]:
    '''Check if `x` is an `np.ndarray` (and not an `np.matrix`).
    
    Notes
    -----
    `np.matrix` is a subclass of `np.ndarray`, so `isinstance(x, np.ndarray)` 
    will return `True` for `np.matrix` objects.
    
    See Also
    --------
    isnparrary : Check if `x` is an `np.ndarray`.
    isnparr : Alias for `isnparrary`.
    '''
    return isnparrary(x)
