fliplr#

ivy.fliplr(m, /, *, copy=None, out=None)[source]#

Flip array in the left/right direction. Flip the entries in each column in the left/right direction. Columns are preserved, but appear in a different order than before.

Parameters:
  • m (Union[Array, NativeArray]) – The array to be flipped. Must be at least 2-D.

  • copy (Optional[bool], default: None) – boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy. In case copy is False we avoid copying by returning a view of the input array.

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

Return type:

Union[Array, NativeArray]

Returns:

ret – Array corresponding to input array with elements order reversed along axis 1.

Examples

>>> m = ivy.diag([1, 2, 3])
>>> ivy.fliplr(m)
ivy.array([[0, 0, 1],
       [0, 2, 0],
       [3, 0, 0]])
Array.fliplr(self, /, *, copy=None, out=None)[source]#

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

Parameters:
  • self (Array) – The array to be flipped. Must be at least 2-D.

  • copy (Optional[bool], default: None) –

    boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy. In case copy is False we avoid copying by returning a

    view of the input array.

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

Return type:

Array

Returns:

ret – Array corresponding to input array with elements order reversed along axis 1.

Examples

>>> m = ivy.diag([1, 2, 3])
>>> m.fliplr()
ivy.array([[0, 0, 1],
       [0, 2, 0],
       [3, 0, 0]])
Container.fliplr(self, /, *, copy=None, out=None)[source]#

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

Parameters:
  • self (Container) – the container with arrays to be flipped. Arrays must be at least 2-D.

  • copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy and must raise a ValueError in case a copy would be necessary. If None, the function must reuse existing memory buffer if possible and copy otherwise. Default: None.

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

Return type:

Container

Returns:

ret – container including arrays corresponding to the input container’s array with elements order reversed along axis 1.

Examples

With one ivy.Container input:

>>> m = ivy.Container(a=ivy.diag([1, 2, 3]),        ...                    b=ivy.array([[1, 2, 3],[4, 5, 6]]))
>>> m.fliplr()
{
    a: ivy.array([[0, 0, 1],
                  [0, 2, 0],
                  [3, 0, 0]]),
    b: ivy.array([[3, 2, 1],
                  [6, 5, 4]])
}