# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/62_issp.ipynb.

# %% auto 0
__all__ = ['issparray', 'isspmatrix', 'issparr', 'isspmtx', 'issparse', 'isspr']

# %% ../nbs/62_issp.ipynb 4
from typing import TypeGuard
from typing import Union

# %% ../nbs/62_issp.ipynb 5
from .atyp import sparray, spmatrix, sparr, spmtx

# %% ../nbs/62_issp.ipynb 7
def issparray(x) -> TypeGuard[sparr]:
    '''Check if `x` is an `sp.sparse.sparray`.
    
    See Also
    --------
    issparr : Alias for `issparray`.'''
    return isinstance(x, sparray)

def isspmatrix(x) -> TypeGuard[spmtx]:
    '''Check if `x` is an `sp.sparse.spmatrix`.
    
    See Also
    --------
    isspmtx : Alias for `isspmatrix`.
    '''
    return isinstance(x, spmatrix)

def issparr(x) -> TypeGuard[sparr]:
    '''Check if `x` is an `sp.sparse.sparray`.
    
    See Also
    --------
    issparray : Alias for `issparr`.
    '''
    return issparray(x)

def isspmtx(x) -> TypeGuard[spmtx]:
    '''Check if `x` is an `sp.sparse.spmatrix`.
    
    See Also
    --------
    isspmatrix : Alias for `isspmtx`.
    '''
    return isspmatrix(x)

def issparse(x) -> TypeGuard[Union[sparr, spmtx]]:
    '''Check if `x` is an `sp.sparse.sparray` or `sp.sparse.spmatrix`.
    
    See Also
    --------
    issparray : Alias for `issparr`.
    isspmatrix : Alias for `isspmtx`.
    '''
    return issparray(x) or isspmatrix(x)

def isspr(x) -> TypeGuard[Union[sparr, spmtx]]:
    '''Check if `x` is an `sp.sparse.sparray` or `sp.sparse.spmatrix`.
    
    See Also
    --------
    issparray : Alias for `issparr`.
    isspmatrix : Alias for `isspmtx`.
    issparse : Alias for `issparse`.
    '''
    return issparray(x) or isspmatrix(x)
