Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.matrix.flatten

matrix.flatten(order='C')[source]

Return a flattened copy of the matrix.

AllN 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 toflatten in column-major (Fortran-style) order. ‘A’ means toflatten in column-major order ifm is Fortrancontiguous inmemory, row-major order otherwise. ‘K’ means to flattenm inthe order the elements occur in memory. The default is ‘C’.

Returns:

y : matrix

A copy of the matrix, flattened to a(1, N) matrix whereNis the number of elements in the original matrix.

See also

ravel
Return a flattened array.
flat
A 1-D flat iterator over the matrix.

Examples

>>>m=np.matrix([[1,2],[3,4]])>>>m.flatten()matrix([[1, 2, 3, 4]])>>>m.flatten('F')matrix([[1, 3, 2, 4]])

Previous topic

numpy.matrix.fill

Next topic

numpy.matrix.getA

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp