nlcpy.atleast_2d

nlcpy.atleast_2d(*arys)[source]

Views inputs as arrays with at least two dimensions.

Parameters
arys1, arys2, …array_like

One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.

Returns
res1, res2, …ndarray

An array, or list of arrays, each with ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.

See also

atleast_1d

Converts inputs to arrays with at least one dimension.

atleast_3d

Views inputs as arrays with at least three dimensions.

Examples

>>> import nlcpy as vp
>>> vp.atleast_2d(3.0)
array([[3.]])
>>> x = vp.arange(3.0)
>>> vp.atleast_2d(x)
array([[0., 1., 2.]])
>>> vp.atleast_2d(x).base is x
True
>>> vp.atleast_2d(1, [1, 2], [[1, 2]])
[array([[1]]), array([[1, 2]]), array([[1, 2]])]