Returns the average of the matrix elements along the given axis. Refer to `numpy.mean` for full documentation. See Also -------- numpy.mean Notes ----- Same as `ndarray.mean` except that, where that returns an `ndarray`, thi
(self, axis=None, dtype=None, out=None)
| 415 | return N.ndarray.flatten(self, order=order) |
| 416 | |
| 417 | def mean(self, axis=None, dtype=None, out=None): |
| 418 | """ |
| 419 | Returns the average of the matrix elements along the given axis. |
| 420 | |
| 421 | Refer to `numpy.mean` for full documentation. |
| 422 | |
| 423 | See Also |
| 424 | -------- |
| 425 | numpy.mean |
| 426 | |
| 427 | Notes |
| 428 | ----- |
| 429 | Same as `ndarray.mean` except that, where that returns an `ndarray`, |
| 430 | this returns a `matrix` object. |
| 431 | |
| 432 | Examples |
| 433 | -------- |
| 434 | >>> x = np.matrix(np.arange(12).reshape((3, 4))) |
| 435 | >>> x |
| 436 | matrix([[ 0, 1, 2, 3], |
| 437 | [ 4, 5, 6, 7], |
| 438 | [ 8, 9, 10, 11]]) |
| 439 | >>> x.mean() |
| 440 | 5.5 |
| 441 | >>> x.mean(0) |
| 442 | matrix([[4., 5., 6., 7.]]) |
| 443 | >>> x.mean(1) |
| 444 | matrix([[ 1.5], |
| 445 | [ 5.5], |
| 446 | [ 9.5]]) |
| 447 | |
| 448 | """ |
| 449 | return N.ndarray.mean(self, axis, dtype, out, keepdims=True)._collapse(axis) |
| 450 | |
| 451 | def std(self, axis=None, dtype=None, out=None, ddof=0): |
| 452 | """ |