Skip to content

Latest commit

 

History

History
123 lines (72 loc) · 3.02 KB

File metadata and controls

123 lines (72 loc) · 3.02 KB

toFlippedlr

Return a new ndarray where the order of elements along the last dimension of an input ndarray is reversed.

Usage

var toFlippedlr = require( '@stdlib/ndarray/to-flippedlr' );

toFlippedlr( x )

Returns a new ndarray where the order of elements along the last dimension of an input ndarray is reversed.

var array = require( '@stdlib/ndarray/array' );

var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], {
    'shape': [ 3, 2 ]
});
// returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]

var y = toFlippedlr( x );
// returns <ndarray>[ [ 2.0, 1.0 ], [ 4.0, 3.0 ], [ 6.0, 5.0 ] ]

Examples

var uniform = require( '@stdlib/random/uniform' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var toFlippedlr = require( '@stdlib/ndarray/to-flippedlr' );

var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
console.log( ndarray2array( x ) );

var y = toFlippedlr( x );
console.log( ndarray2array( y ) );