-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathrepl.txt
117 lines (86 loc) · 3.24 KB
/
repl.txt
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{{alias}}( dtype, buffer, shape, strides, offset, order )
Returns an ndarray.
Parameters
----------
dtype: string
Underlying data type.
buffer: ArrayLikeObject|TypedArray|Buffer
Data buffer.
shape: ArrayLikeObject
Array shape.
strides: ArrayLikeObject
Array strides.
offset: integer
Index offset.
order: string
Specifies whether an array is row-major (C-style) or column-major
(Fortran-style).
Returns
-------
ndarray.prototype.byteLength: integer
Size (in bytes) of the array (if known).
ndarray.prototype.BYTES_PER_ELEMENT: integer
Size (in bytes) of each array element (if known).
ndarray.prototype.data: ArrayLikeObject|TypedArray|Buffer
Pointer to the underlying data buffer.
ndarray.prototype.dtype: string
Underlying data type.
ndarray.prototype.flags: Object
Information about the memory layout of the array.
ndarray.prototype.length: integer
Length of the array (i.e., number of elements).
ndarray.prototype.ndims: integer
Number of dimensions.
ndarray.prototype.offset: integer
Index offset which specifies the buffer index at which to start
iterating over array elements.
ndarray.prototype.order: string
Array order. The array order is either row-major (C-style) or column-
major (Fortran-style).
ndarray.prototype.shape: Array
Array shape.
ndarray.prototype.strides: Array
Index strides which specify how to access data along corresponding array
dimensions.
ndarray.prototype.get: Function
Returns an array element specified according to provided subscripts. The
number of provided subscripts should equal the number of dimensions.
ndarray.prototype.iget: Function
Returns an array element located at a specified linear index.
ndarray.prototype.set: Function
Sets an array element specified according to provided subscripts. The
number of provided subscripts should equal the number of dimensions.
ndarray.prototype.iset: Function
Sets an array element located at a specified linear index.
ndarray.prototype.toString: Function
Serializes an ndarray as a string. This method does **not** serialize
data outside of the buffer region defined by the array configuration.
ndarray.prototype.toJSON: Function
Serializes an ndarray as a JSON object. This method does **not**
serialize data outside of the buffer region defined by the array
configuration.
Examples
--------
// Create a new instance...
> var b = [ 1, 2, 3, 4 ]; // underlying data buffer
> var d = [ 2, 2 ]; // shape
> var s = [ 2, 1 ]; // strides
> var o = 0; // index offset
> var arr = {{alias}}( 'generic', b, d, s, o, 'row-major' )
<ndarray>
// Get an element using subscripts:
> var v = arr.get( 1, 1 )
4
// Get an element using a linear index:
> v = arr.iget( 3 )
4
// Set an element using subscripts:
> arr.set( 1, 1, 40 );
> arr.get( 1, 1 )
40
// Set an element using a linear index:
> arr.iset( 3, 99 );
> arr.get( 1, 1 )
99
See Also
--------