numpy.asfortranarray()

numpy.asfortranarray

numpy.asfortranarray(a, dtype=None) [source]

Return an array 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.

Returns:

out : ndarray

The input a in Fortran, or column-major, order.

See also

ascontiguousarray
Convert input to a contiguous (C order) array.
asanyarray
Convert input to an ndarray with either row or column-major memory order.
require
Return an ndarray that satisfies requirements.
ndarray.flags
Information 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

© 2008–2016 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.asfortranarray.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部