MCPcopy Create free account
hub / github.com/numpy/numpy / ravel

Method ravel

numpy/matrixlib/defmatrix.py:898–934  ·  view source on GitHub ↗

Return a flattened matrix. Refer to `numpy.ravel` for more documentation. Parameters ---------- order : {'C', 'F', 'A', 'K'}, optional The elements of `m` are read using this index order. 'C' means to index the elements in C-like ord

(self, order='C')

Source from the content-addressed store, hash-verified

896
897
898 def ravel(self, order='C'):
899 """
900 Return a flattened matrix.
901
902 Refer to `numpy.ravel` for more documentation.
903
904 Parameters
905 ----------
906 order : {'C', 'F', 'A', 'K'}, optional
907 The elements of `m` are read using this index order. 'C' means to
908 index the elements in C-like order, with the last axis index
909 changing fastest, back to the first axis index changing slowest.
910 'F' means to index the elements in Fortran-like index order, with
911 the first index changing fastest, and the last index changing
912 slowest. Note that the 'C' and 'F' options take no account of the
913 memory layout of the underlying array, and only refer to the order
914 of axis indexing. 'A' means to read the elements in Fortran-like
915 index order if `m` is Fortran *contiguous* in memory, C-like order
916 otherwise. 'K' means to read the elements in the order they occur
917 in memory, except for reversing the data when strides are negative.
918 By default, 'C' index order is used.
919
920 Returns
921 -------
922 ret : matrix
923 Return the matrix flattened to shape `(1, N)` where `N`
924 is the number of elements in the original matrix.
925 A copy is made only if necessary.
926
927 See Also
928 --------
929 matrix.flatten : returns a similar output matrix but always a copy
930 matrix.flat : a flat iterator on the array.
931 numpy.ravel : related function which returns an ndarray
932
933 """
934 return N.ndarray.ravel(self, order=order)
935
936 @property
937 def T(self):

Callers 8

A1Method · 0.45
test_ravelMethod · 0.45
test_numpy_ravelMethod · 0.45
test_member_ravelMethod · 0.45

Calls

no outgoing calls

Tested by 7

test_ravelMethod · 0.36
test_numpy_ravelMethod · 0.36
test_member_ravelMethod · 0.36