asarray
Convert the input to a sparse array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
array_like
|
Object to be converted to an array. |
required |
dtype
|
dtype
|
Output array data type. |
None
|
format
|
str
|
Output array sparse format. |
'coo'
|
device
|
str
|
Device on which to place the created array. |
None
|
copy
|
bool_
|
Boolean indicating whether or not to copy the input. |
False
|
Returns:
Name | Type | Description |
---|---|---|
out |
Union[SparseArray, ndarray]
|
Sparse or 0-D array containing the data from |
Examples:
>>> x = np.eye(8, dtype="i8")
>>> sparse.asarray(x, format="coo")
<COO: shape=(8, 8), dtype=int64, nnz=8, fill_value=0>
Source code in sparse/numba_backend/_common.py
2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 |
|