Return the product of the array elements over the given axis. Refer to `prod` for full documentation. See Also -------- prod, ndarray.prod Notes ----- Same as `ndarray.prod`, except, where that returns an `ndarray`, this ret
(self, axis=None, dtype=None, out=None)
| 519 | keepdims=True)._collapse(axis) |
| 520 | |
| 521 | def prod(self, axis=None, dtype=None, out=None): |
| 522 | """ |
| 523 | Return the product of the array elements over the given axis. |
| 524 | |
| 525 | Refer to `prod` for full documentation. |
| 526 | |
| 527 | See Also |
| 528 | -------- |
| 529 | prod, ndarray.prod |
| 530 | |
| 531 | Notes |
| 532 | ----- |
| 533 | Same as `ndarray.prod`, except, where that returns an `ndarray`, this |
| 534 | returns a `matrix` object instead. |
| 535 | |
| 536 | Examples |
| 537 | -------- |
| 538 | >>> x = np.matrix(np.arange(12).reshape((3,4))); x |
| 539 | matrix([[ 0, 1, 2, 3], |
| 540 | [ 4, 5, 6, 7], |
| 541 | [ 8, 9, 10, 11]]) |
| 542 | >>> x.prod() |
| 543 | 0 |
| 544 | >>> x.prod(0) |
| 545 | matrix([[ 0, 45, 120, 231]]) |
| 546 | >>> x.prod(1) |
| 547 | matrix([[ 0], |
| 548 | [ 840], |
| 549 | [7920]]) |
| 550 | |
| 551 | """ |
| 552 | return N.ndarray.prod(self, axis, dtype, out, keepdims=True)._collapse(axis) |
| 553 | |
| 554 | def any(self, axis=None, out=None): |
| 555 | """ |