forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.txt
More file actions
50 lines (40 loc) · 1.78 KB
/
repl.txt
File metadata and controls
50 lines (40 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{{alias}}( x, k[, options] )
Circularly shifts the elements of an input ndarray by a specified number
of positions along one or more ndarray dimensions.
When shifting elements along a single dimension, a positive `k` shifts
elements to the right (toward higher indices), and a negative `k` shifts
elements to the left (toward lower indices). If `k` is zero, the input
ndarray is left unchanged.
The function circularly shifts an input ndarray in-place and thus mutates
an input ndarray.
Parameters
----------
x: ndarray
Input array.
k: ndarray|number
Number of positions to shift. May be either a scalar value or an ndarray
having a real-valued or "generic" data type. If provided an ndarray, the
value must have a shape which is broadcast compatible with the
complement of the shape defined by `options.dims`. For example, given
the input shape `[2, 3, 4]` and `options.dims=[0]`, an ndarray for `k`
must have a shape which is broadcast compatible with the shape `[3, 4]`.
Similarly, when performing the operation over all elements in a provided
input ndarray, an ndarray for `k` must be a zero-dimensional ndarray.
options: Object (optional)
Function options.
options.dims: Array<integer> (optional)
List of dimensions over which to perform operation. If not provided, the
function performs the operation over all elements in a provided input
ndarray.
Returns
-------
out: ndarray
Input array.
Examples
--------
> var x = {{alias:@stdlib/ndarray/array}}( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
> var y = {{alias}}( x, 2 );
> {{alias:@stdlib/ndarray/to-array}}( y )
[ 4.0, 5.0, 1.0, 2.0, 3.0 ]
See Also
--------