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