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
51 lines (41 loc) · 1.21 KB
/
repl.txt
File metadata and controls
51 lines (41 loc) · 1.21 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, axis, writable )
Expands the shape of an array by inserting a new dimension of size one at a
specified axis.
A provided axis must reside on the interval `[-N-1, N]`, where `N` is the
rank (i.e., number of dimensions) of the provided input array.
If provided a negative axis value, the axis position at which to insert a
singleton dimension is computed as `N + axis + 1`. Hence, if provided `-1`,
the resolved axis position is `N` (i.e., a singleton dimension is appended
to the input array).
Parameters
----------
x: ndarray
Input array.
axis: integer
Axis at which to insert a singleton dimension.
writable: boolean
Boolean indicating whether a returned ndarray should be writable.
Returns
-------
out: ndarray
Output array.
Examples
--------
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] )
<ndarray>
> var sh = x.shape
[ 2, 2 ]
> var y = {{alias}}( x, 1, false )
<ndarray>
> sh = y.shape
[ 2, 1, 2 ]
> var v = y.get( 0, 0, 0 )
1
> v = y.get( 0, 0, 1 )
2
> v = y.get( 1, 0, 0 )
3
> v = y.get( 1, 0, 1 )
4
See Also
--------