Return a flattened copy of the matrix. All `N` elements of the matrix are placed into a single row. Parameters ---------- order : {'C', 'F', 'A', 'K'}, optional 'C' means to flatten in row-major (C-style) order. 'F' means to flatten
(self, order='C')
| 378 | |
| 379 | # To update docstring from array to matrix... |
| 380 | def flatten(self, order='C'): |
| 381 | """ |
| 382 | Return a flattened copy of the matrix. |
| 383 | |
| 384 | All `N` elements of the matrix are placed into a single row. |
| 385 | |
| 386 | Parameters |
| 387 | ---------- |
| 388 | order : {'C', 'F', 'A', 'K'}, optional |
| 389 | 'C' means to flatten in row-major (C-style) order. 'F' means to |
| 390 | flatten in column-major (Fortran-style) order. 'A' means to |
| 391 | flatten in column-major order if `m` is Fortran *contiguous* in |
| 392 | memory, row-major order otherwise. 'K' means to flatten `m` in |
| 393 | the order the elements occur in memory. The default is 'C'. |
| 394 | |
| 395 | Returns |
| 396 | ------- |
| 397 | y : matrix |
| 398 | A copy of the matrix, flattened to a `(1, N)` matrix where `N` |
| 399 | is the number of elements in the original matrix. |
| 400 | |
| 401 | See Also |
| 402 | -------- |
| 403 | ravel : Return a flattened array. |
| 404 | flat : A 1-D flat iterator over the matrix. |
| 405 | |
| 406 | Examples |
| 407 | -------- |
| 408 | >>> m = np.matrix([[1,2], [3,4]]) |
| 409 | >>> m.flatten() |
| 410 | matrix([[1, 2, 3, 4]]) |
| 411 | >>> m.flatten('F') |
| 412 | matrix([[1, 3, 2, 4]]) |
| 413 | |
| 414 | """ |
| 415 | return N.ndarray.flatten(self, order=order) |
| 416 | |
| 417 | def mean(self, axis=None, dtype=None, out=None): |
| 418 | """ |
no outgoing calls