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