expand_dims

Contents

expand_dims#

class saiunit.math.expand_dims(a, axis, **kwargs)#

Expand the shape of a quantity or an array.

Parameters:
  • a (Array | saiunit.Quantity) – Input array.

  • axis (int) – Position in the expanded axes where the new axis is placed.

Returns:

res – View of a with the number of dimensions increased by one.

Return type:

Array | saiunit.Quantity

Examples

>>> import saiunit as u
>>> a = [1, 2, 3] * u.meter
>>> u.math.expand_dims(a, axis=0).shape
(1, 3)