prod
Calculates the product of input array x
elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
input array of a numeric data type. |
required | |
axis
|
axis or axes along which products is computed.
By default, the product are computed over the entire array.
If a tuple of integers, products are computed over multiple axes. Default: |
None
|
|
dtype
|
data type of the returned array.
If
If the data type (either specified or resolved) differs from the data type of |
None
|
|
keepdims
|
if |
False
|
Returns:
Name | Type | Description |
---|---|---|
out |
array
|
if the product was computed over the entire array, a zero-dimensional array containing the product.
Otherwise, a non-zero-dimensional array containing the products.
The returned array has a data type as described by the |
Notes
Special Cases
Let N
equal the number of elements over which to compute the product.
- If
N
is0
, the product is1
(i.e., the empty product).
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0, 2], [-1, 1]]))
>>> o = sparse.prod(a, axis=1)
>>> o.todense()
array([ 0, -1])
Source code in sparse/numba_backend/_common.py
2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 |
|