Return a read-only view of a matrix (or a stack of matrices) rotated
90degrees counterclockwise.
var rotl90 = require( '@stdlib/ndarray/rotl90' );Returns a read-only view of a matrix (or a stack of matrices) rotated 90 degrees counterclockwise.
var array = require( '@stdlib/ndarray/array' );
var x = array( [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ] );
// returns <ndarray>[ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]
var y = rotl90( x, 1 );
// returns <ndarray>[ [ 3.0, 6.0 ], [ 2.0, 5.0 ], [ 1.0, 4.0 ] ]The function accepts the following arguments:
- x: input
ndarray. - k: number of times to rotate by
90degrees. Positive values rotate counterclockwise. Negative values rotate clockwise.
var uniform = require( '@stdlib/random/uniform' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var rotl90 = require( '@stdlib/ndarray/rotl90' );
var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
console.log( ndarray2array( x ) );
var y = rotl90( x, 1 );
console.log( ndarray2array( y ) );