nlcpy.sca.create_optimized_array

nlcpy.sca.create_optimized_array(shape, dtype='float64') ndarray

Creates an optimized ndarray, whose strides are adjusted to improve perfomance, filled with zeros.

Parameters
shapeint or tuple of ints

The shape to be used by stencil calculations.

dtypestr or dtype, optional

The type of the output array. If dtype is not given, the dtype of optimized_array is set to float64.

Returns
optimized_arrayndarray

The optimized ndarray.

Examples

>>> import nlcpy as vp
>>> vp.sca.create_optimized_array(4, dtype='f4')
array([0., 0., 0., 0.], dtype=float32)
>>> shape = (1000, 1000)
>>> x_opt = vp.sca.create_optimized_array(shape)
>>> x_opt.strides
(8008, 8)