numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
flatten(self, order='C')

All :None:None:`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 in column-major (Fortran-style) order. 'A' means to flatten in column-major order if :None:None:`m` is Fortran contiguous in memory, row-major order otherwise. 'K' means to flatten :None:None:`m` in the order the elements occur in memory. The default is 'C'.

Returns

y : matrix

A copy of the matrix, flattened to a :None:None:`(1, N)` matrix where :None:None:`N` is the number of elements in the original matrix.

Return a flattened copy of the matrix.

See Also

flat

A 1-D flat iterator over the matrix.

ravel

Return a flattened array.

Examples

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

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.matrixlib.defmatrix.matrix.ravel

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/matrixlib/defmatrix.py#376
type: <class 'function'>
Commit: