nlcpy.atleast_1d

nlcpy.atleast_1d(*arys)[source]

Converts inputs to arrays with at least one dimension.

Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.

Parameters
arys1, arys2, …array_like

One or more input arrays.

Returns
retndarrays

An array, or list of arrays, each with ndim >= 1. Copies are made only if necessary.

See also

atleast_2d

Views inputs as arrays with at least two dimensions.

atleast_3d

Views inputs as arrays with at least three dimensions.

Examples

>>> import nlcpy as vp
>>> vp.atleast_1d(1.0)
array([1.])
>>> x = vp.arange(9.0).reshape(3,3)
>>> vp.atleast_1d(x)
array([[0., 1., 2.],
       [3., 4., 5.],
       [6., 7., 8.]])
>>> vp.atleast_1d(x) is x
True
>>> vp.atleast_1d(1, [3, 4])
[array([1]), array([3, 4])]