ones_like
Return a SparseArray of ones with the same shape and type as a.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a |
array_like
|
The shape and data-type of the result will match those of |
required |
dtype |
data - type
|
Overrides the data type of the result. |
None
|
format |
str
|
A format string. |
None
|
compressed_axes |
iterable
|
The axes to compress if returning a GCXS array. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
SparseArray
|
Array of ones with the same shape and type as |
Examples:
>>> x = np.ones((2, 3), dtype="i8")
>>> ones_like(x).todense()
array([[1, 1, 1],
[1, 1, 1]])
Source code in sparse/numba_backend/_common.py
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | |