-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathrepl.txt
127 lines (93 loc) · 3.51 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
117
118
119
120
121
122
123
124
125
126
{{alias}}( dtype, ndims[, options] )
Returns an ndarray constructor.
Parameters
----------
dtype: string
Underlying data type.
ndims: integer
Number of dimensions.
options: Object (optional)
Options.
options.codegen: boolean (optional)
Boolean indicating whether to use code generation. Code generation can
boost performance, but may be problematic in browser contexts enforcing
a strict content security policy (CSP). Default: true.
Returns
-------
ctor: Function
ndarray constructor.
ctor.BYTES_PER_ELEMENT: integer
Size (in bytes) of each array element (if known).
ctor.dtype: string
Underlying data type.
ctor.ndims: integer
Number of dimensions.
ctor.prototype.byteLength: integer
Size (in bytes) of the array (if known).
ctor.prototype.BYTES_PER_ELEMENT: integer
Size (in bytes) of each array element (if known).
ctor.prototype.data: ArrayLikeObject|TypedArray|Buffer
Pointer to the underlying data buffer.
ctor.prototype.dtype: string
Underlying data type.
ctor.prototype.flags: Object
Information about the memory layout of the array.
ctor.prototype.length: integer
Length of the array (i.e., number of elements).
ctor.prototype.ndims: integer
Number of dimensions.
ctor.prototype.offset: integer
Index offset which specifies the buffer index at which to start
iterating over array elements.
ctor.prototype.order: string
Array order. The array order is either row-major (C-style) or column-
major (Fortran-style).
ctor.prototype.shape: Array
Array shape.
ctor.prototype.strides: Array
Index strides which specify how to access data along corresponding array
dimensions.
ctor.prototype.get: Function
Returns an array element specified according to provided subscripts. The
number of provided subscripts should equal the number of dimensions.
ctor.prototype.iget: Function
Returns an array element located at a specified linear index.
ctor.prototype.set: Function
Sets an array element specified according to provided subscripts. The
number of provided subscripts should equal the number of dimensions.
ctor.prototype.iset: Function
Sets an array element located at a specified linear index.
ctor.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.
ctor.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
--------
> var ctor = {{alias}}( 'float64', 3 )
<Function>
// To 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 = ctor( 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
--------