Skip to main content

fliplr

Function fliplr 

Source
pub fn fliplr<T: Clone>(array: &Array<T>) -> Result<Array<T>>
Expand description

Flip array in the left/right direction (along axis 1)

§Parameters

  • array - Array to flip

§Returns

  • Array with the same shape as input, but with elements flipped along axis 1

§Examples

use numrs2::prelude::*;

// Flip a 2D array in the left/right direction
let a = Array::from_vec(vec![1, 2, 3, 4, 5, 6]).reshape(&[2, 3]);
let flipped = fliplr(&a).expect("operation should succeed");
assert_eq!(flipped.to_vec(), vec![3, 2, 1, 6, 5, 4]);