Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ascontiguousarray

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

Return a contiguous array in memory (C order).

Parameters:

a : array_like

Input array.

dtype : str or dtype object, optional

Data-type of returned array.

Returns:

out : ndarray

Contiguous array of same shape and content asa, with typedtypeif specified.

See also

asfortranarray
Convert input to an ndarray with 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)>>>np.ascontiguousarray(x,dtype=np.float32)array([[ 0.,  1.,  2.],       [ 3.,  4.,  5.]], dtype=float32)>>>x.flags['C_CONTIGUOUS']True

Previous topic

numpy.asanyarray

Next topic

numpy.copy

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

[8]ページ先頭

©2009-2025 Movatter.jp