xorbits.numpy.asfortranarray#
- xorbits.numpy.asfortranarray(a, dtype=None, *, like=None)[source]#
Return an array (ndim >= 1) laid out in Fortran order in memory.
- Parameters
a (array_like) – Input array.
dtype (str or dtype object, optional) – By default, the data-type is inferred from the input data.
like (array_like, optional) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as
likesupports the__array_function__protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.New in version 1.20.0.
- Returns
out – The input a in Fortran, or column-major, order.
- Return type
ndarray
See also
ascontiguousarrayConvert input to a contiguous (C order) array.
asanyarrayConvert input to an ndarray with either row or column-major memory order.
requireReturn an ndarray that satisfies requirements.
ndarray.flagsInformation about the memory layout of the array.
Examples
>>> x = np.arange(6).reshape(2,3) >>> y = np.asfortranarray(x) >>> x.flags['F_CONTIGUOUS'] False >>> y.flags['F_CONTIGUOUS'] True
Note: This function returns an array with at least one-dimension (1-d) so it will not preserve 0-d arrays.
This docstring was copied from numpy.