allocate

randomfield.transform.allocate(shape, dtype, use_pyfftw=True)[source] [edit on github]

Allocate a contiguous block of un-initialized typed memory.

If the pyfftw module is importable, allocates 16-byte aligned memory using for improved SIMD instruction performance. Otherwise, uses the numpy.empty() function. When shape is multi-dimensional, the returned memory is initialized for C (row-major) storage order.

Parameters:

shape : int or tuple of ints

Shape of the empty array to allocate.

dtype : numpy data-type

Data type to assign to the empty array.

use_pyfftw: bool

Use the pyFFTW package if it is available.

Returns:

out : numpy array

Array of un-initialized data with the requested shape and data type. The storage order of multi-dimensional arrays is always C-type (row-major).