msort#

ivy.msort(a, /, *, out=None)[source]#

Return a copy of an array sorted along the first axis.

Parameters:
  • a (Union[Array, NativeArray, list, tuple]) – array-like input.

  • out (Optional[Array], default: None) – optional output array, for writing the result to.

Return type:

Array

Returns:

ret – sorted array of the same type and shape as a

Examples

>>> a = ivy.asarray([[8, 9, 6],[6, 2, 6]])
>>> ivy.msort(a)
ivy.array(
    [[6, 2, 6],
     [8, 9, 6]]
    )
Array.msort(self, /, *, out=None)[source]#

ivy.Array instance method variant of ivy.msort. This method simply wraps the function, and so the docstring for ivy.msort also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array.

  • out (Optional[Array], default: None) – optional output array, for writing the result to.

Return type:

Array

Returns:

ret – sorted array of the same type and shape as a

Examples

>>> a = ivy.asarray([[8, 9, 6],[6, 2, 6]])
>>> a.msort()
ivy.array(
    [[6, 2, 6],
    [8, 9, 6]]
    )
Container.msort(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.msort. This method simply wraps the function, and so the docstring for ivy.msort also applies to this method with minimal changes.

Parameters:
  • self (Container) – input container with array-like inputs to sort.

  • out (Optional[Container], default: None) – optional output container, for writing the result to.

Return type:

Container

Returns:

ret – a container containing the sorted input arrays.

Examples

>>> a = ivy.Container(x = ivy.asarray([[8, 9, 6],[6, 2, 6]]),
...                   y = ivy.asarray([[7, 2],[3, 4]])
>>> a.msort()
{
    x: ivy.array(
        [[6, 2, 6],
         [8, 9, 6]]
        ),
    y: ivy.array(
        [[3, 4],
         [7, 2]]
        )
}