elemwise
Apply a function to any number of arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable
|
The function to apply. Must support broadcasting. |
required |
*args
|
tuple
|
The arguments to the function. Can be |
()
|
**kwargs
|
dict
|
Any additional arguments to pass to the function. |
{}
|
Returns:
Type | Description |
---|---|
SparseArray
|
The result of applying the function. |
Raises:
Type | Description |
---|---|
ValueError
|
If the operation would result in a dense matrix, or if the operands don't have broadcastable shapes. |
See Also
numpy.ufunc
:
A similar Numpy construct. Note that any ufunc
can be used
as the func
input to this function.
Notes
Previously, operations with Numpy arrays were sometimes supported. Now,
it is necessary to convert Numpy arrays to sparse.COO
objects.
Source code in sparse/numba_backend/_umath.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|