# Path: arrayfire/interop.py
# def to_array(in_array, copy = True):
#     """
#     Helper function to convert input from a different module to af.Array
# 
#     Parameters
#     -------------
# 
#     in_array : array like object
#              Can be one of the following:
#              - numpy.ndarray
#              - pycuda.GPUArray
#              - pyopencl.Array
#              - numba.cuda.cudadrv.devicearray.DeviceNDArray
#              - array.array
#              - list
#     copy : Bool specifying if array is to be copied.
#           Default is true.
#           Can only be False if array is fortran contiguous.
# 
#     Returns
#     --------------
#     af.Array of same dimensions as input after copying the data from the input
# 
#     """
#     if AF_NUMPY_FOUND and isinstance(in_array, NumpyArray):
#         return np_to_af_array(in_array, copy)
#     if AF_PYCUDA_FOUND and isinstance(in_array, CudaArray):
#         return pycuda_to_af_array(in_array, copy)
#     if AF_PYOPENCL_FOUND and isinstance(in_array, OpenclArray):
#         return pyopencl_to_af_array(in_array, copy)
#     if AF_NUMBA_FOUND and isinstance(in_array, NumbaCudaArray):
#         return numba_to_af_array(in_array, copy)
#     return Array(src=in_array)


from .library import *
from .array import *
from .interop import to_array
import numbers
    """
    Create a sparse matrix from it's constituent parts.

    Parameters
    ----------

    values : Any datatype that can be converted to array.
          - Contains the non zero elements of the sparse array.

    row_idx : Any datatype that can be converted to array.
          - Contains row indices of the sparse array.

    col_idx : Any datatype that can be converted to array.
          - Contains column indices of the sparse array.

    nrows   : int.
          - specifies the number of rows in sparse matrix.

    ncols   : int.
          - specifies the number of columns in sparse matrix.

    storage : optional: arrayfire.STORAGE. default: arrayfire.STORAGE.CSR.
          - Can be one of arrayfire.STORAGE.CSR, arrayfire.STORAGE.COO.

    Returns
    -------

    A sparse matrix.
    """
    return create_sparse(to_array(values),

# Path: arrayfire/interop.py
# def to_array(in_array, copy = True):
#     """
#     Helper function to convert input from a different module to af.Array
# 
#     Parameters
#     -------------
# 
#     in_array : array like object
#              Can be one of the following:
#              - numpy.ndarray
#              - pycuda.GPUArray
#              - pyopencl.Array
#              - numba.cuda.cudadrv.devicearray.DeviceNDArray
#              - array.array
#              - list
#     copy : Bool specifying if array is to be copied.
#           Default is true.
#           Can only be False if array is fortran contiguous.
# 
#     Returns
#     --------------
#     af.Array of same dimensions as input after copying the data from the input
# 
#     """
#     if AF_NUMPY_FOUND and isinstance(in_array, NumpyArray):
#         return np_to_af_array(in_array, copy)
#     if AF_PYCUDA_FOUND and isinstance(in_array, CudaArray):
#         return pycuda_to_af_array(in_array, copy)
#     if AF_PYOPENCL_FOUND and isinstance(in_array, OpenclArray):
#         return pyopencl_to_af_array(in_array, copy)
#     if AF_NUMBA_FOUND and isinstance(in_array, NumbaCudaArray):
#         return numba_to_af_array(in_array, copy)
#     return Array(src=in_array)


# Path: arrayfire/sparse.py
from .library import *
from .array import *
from .interop import to_array
import numbers

    """
    Create a sparse matrix from it's constituent parts.

    Parameters
    ----------

    values : Any datatype that can be converted to array.
          - Contains the non zero elements of the sparse array.

    row_idx : Any datatype that can be converted to array.
          - Contains row indices of the sparse array.

    col_idx : Any datatype that can be converted to array.
          - Contains column indices of the sparse array.

    nrows   : int.
          - specifies the number of rows in sparse matrix.

    ncols   : int.
          - specifies the number of columns in sparse matrix.

    storage : optional: arrayfire.STORAGE. default: arrayfire.STORAGE.CSR.
          - Can be one of arrayfire.STORAGE.CSR, arrayfire.STORAGE.COO.

    Returns
    -------

    A sparse matrix.
    """
    return create_sparse(to_array(values),

                         to_array(row_idx).as_type(Dtype.s32),