You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[`77867ac`](https://github.com/stdlib-js/stdlib/commit/77867ac1767a186023f633dea30ddf860962aaed) - **docs:** remove trailing whitespace _(by Philipp Burckhardt)_
26
27
-[`ed2d89f`](https://github.com/stdlib-js/stdlib/commit/ed2d89f2c0c0950bfb6fad6375296173a7aee0b9) - **refactor:** use base assertion utility _(by Athan Reines)_
27
28
-[`b9d3f03`](https://github.com/stdlib-js/stdlib/commit/b9d3f03a8fc45fa0f65dc1ded1a5b40125a0a0fb) - **refactor:** use base assertion utility _(by Athan Reines)_
To initialize multidimensional array data, provide a `buffer` argument, which may be a [generic array][@stdlib/array/generic], [typed array][@stdlib/array/typed], [Buffer][@stdlib/buffer/ctor], or [ndarray][@stdlib/ndarray/ctor].
-**buffer**: data source. If provided along with a `buffer` argument, the argument takes precedence.
116
116
117
-
-**dtype**: underlying storage [data type][@stdlib/ndarray/dtypes]. If not specified and a data source is provided, the data type is inferred from the provided data source. If an input data source is not of the same type, this option specifies the data type to which to cast the input data. For non-[`ndarray`][@stdlib/ndarray/ctor] generic array data sources, the function casts generic array data elements to the default data type. In order to prevent this cast, the `dtype` option **must** be explicitly set to `'generic'`. Any time a cast is required, the `copy` option is set to `true`, as memory must be copied from the data source to an output data buffer. Default: `'float64'`.
117
+
-**dtype**: underlying storage [data type][@stdlib/ndarray/dtypes]. If not specified and a data source is provided, the data type is inferred from the provided data source. If an input data source is not of the same type, this option specifies the data type to which to cast the input data. For non-[ndarray][@stdlib/ndarray/ctor] generic array data sources, the function casts generic array data elements to the default data type. In order to prevent this cast, the `dtype` option **must** be explicitly set to `'generic'`. Any time a cast is required, the `copy` option is set to `true`, as memory must be copied from the data source to an output data buffer. Default: `'float64'`.
118
118
119
119
-**order**: specifies the memory layout of the data source as either row-major (C-style) or column-major (Fortran-style). The option may be one of the following values:
120
120
121
-
-`row-major`: the order of the returned array is row-major.
122
-
-`column-major`: the order of the returned array is column-major.
123
-
-`any`: if a data source is column-major and not row-major, the order of the returned array is column-major; otherwise, the order of the returned array is row-major.
124
-
-`same`: the order of the returned array matches the order of an input data source.
121
+
-`'row-major'`: the order of the returned array is row-major.
122
+
-`'column-major'`: the order of the returned array is column-major.
123
+
-`'any'`: if a data source is column-major and not row-major, the order of the returned array is column-major; otherwise, the order of the returned array is row-major.
124
+
-`'same'`: the order of the returned array matches the order of an input data source.
125
125
126
126
Note that specifying an order which differs from the order of a provided data source does **not** entail a conversion from one memory layout to another. In short, this option is descriptive, not prescriptive. Default: `'row-major'`.
127
127
128
128
-**shape**: array shape (dimensions). If a shape is not specified, the function attempts to infer a shape based on a provided data source. For example, if provided a nested array, the function resolves nested array dimensions. If provided a multidimensional array data source, the function uses the array's associated shape. For most use cases, such inference suffices. For the remaining use cases, specifying a shape is necessary. For example, provide a shape to create a multidimensional array view over a linear data buffer, ignoring any existing shape meta data associated with a provided data source.
129
129
130
-
-**flatten**: `boolean` indicating whether to automatically flatten generic array data sources. If an array shape is not specified, the shape is inferred from the dimensions of nested arrays prior to flattening. If a use case requires partial flattening, partially flatten **prior** to invoking this function and set the option value to `false` to prevent further flattening during invocation. Default: `true`.
130
+
-**flatten**: boolean indicating whether to automatically flatten generic array data sources. If an array shape is not specified, the shape is inferred from the dimensions of nested arrays prior to flattening. If a use case requires partial flattening, partially flatten **prior** to invoking this function and set the option value to `false` to prevent further flattening during invocation. Default: `true`.
131
131
132
-
-**copy**: `boolean` indicating whether to (shallow) copy source data to a new data buffer. The function does **not** perform a deep copy. To prevent undesired shared changes in state for generic arrays containing objects, perform a deep copy **prior** to invoking this function. Default: `false`.
132
+
-**copy**: boolean indicating whether to (shallow) copy source data to a new data buffer. The function does **not** perform a deep copy. To prevent undesired shared changes in state for generic arrays containing objects, perform a deep copy **prior** to invoking this function. Default: `false`.
133
133
134
134
-**ndmin**: specifies the minimum number of dimensions. If an array shape has fewer dimensions than required by `ndmin`, the function **prepends** singleton dimensions to the array shape in order to satisfy the dimensions requirement. Default: `0`.
135
135
136
136
-**casting**: specifies the casting rule used to determine acceptable casts. The option may be one of the following values:
137
137
138
-
-`none`: only allow casting between identical types.
139
-
-`equiv`: allow casting between identical and byte swapped types.
140
-
-`safe`: only allow "safe" casts.
141
-
-`mostly-safe`: allow "safe" casts and, for floating-point data types, downcasts.
142
-
-`same-kind`: allow "safe" casts and casts within the same kind (e.g., between signed integers or between floats).
143
-
-`unsafe`: allow casting between all types (including between integers and floats).
138
+
-`'none'`: only allow casting between identical types.
139
+
-`'equiv'`: allow casting between identical and byte swapped types.
140
+
-`'safe'`: only allow "safe" casts.
141
+
-`'mostly-safe'`: allow "safe" casts and, for floating-point data types, downcasts.
142
+
-`'same-kind'`: allow "safe" casts and casts within the same kind (e.g., between signed integers or between floats).
143
+
-`'unsafe'`: allow casting between all types (including between integers and floats).
144
144
145
145
Default: `'safe'`.
146
146
147
147
-**mode**: specifies how to handle indices which exceed array dimensions.
148
148
149
-
-`throw`: specifies that an [`ndarray`][@stdlib/ndarray/ctor] instance should throw an error when an index exceeds array dimensions.
150
-
-`normalize`: specifies that an [`ndarray`][@stdlib/ndarray/ctor] instance should normalize negative indices and throw an error when an index exceeds array dimensions.
151
-
-`wrap`: specifies that an [`ndarray`][@stdlib/ndarray/ctor] instance should wrap around an index exceeding array dimensions using modulo arithmetic.
152
-
-`clamp`: specifies that an [`ndarray`][@stdlib/ndarray/ctor] instance should set an index exceeding array dimensions to either `0` (minimum index) or the maximum index.
149
+
-`'throw'`: specifies that an [ndarray][@stdlib/ndarray/ctor] instance should throw an error when an index exceeds array dimensions.
150
+
-`'normalize'`: specifies that an [ndarray][@stdlib/ndarray/ctor] instance should normalize negative indices and throw an error when an index exceeds array dimensions.
151
+
-`'wrap'`: specifies that an [ndarray][@stdlib/ndarray/ctor] instance should wrap around an index exceeding array dimensions using modulo arithmetic.
152
+
-`'clamp'`: specifies that an [ndarray][@stdlib/ndarray/ctor] instance should set an index exceeding array dimensions to either `0` (minimum index) or the maximum index.
153
153
154
154
Default: `'throw'`.
155
155
156
156
-**submode**: a mode array which specifies for each dimension how to handle subscripts which exceed array dimensions. If provided fewer modes than dimensions, the function recycles modes using modulo arithmetic. Default: `[ options.mode ]`.
157
157
158
-
-**readonly**: `boolean` indicating whether an [`ndarray`][@stdlib/ndarray/ctor] instance should be **read-only**. Default: `false`.
158
+
-**readonly**: boolean indicating whether an [ndarray][@stdlib/ndarray/ctor] instance should be **read-only**. Default: `false`.
159
159
160
-
By default, an [`ndarray`][@stdlib/ndarray/ctor] instance **throws** when provided an index which exceeds array dimensions. To support alternative indexing behavior, set the `mode` option, which will affect all public methods for getting and setting array elements.
160
+
By default, an [ndarray][@stdlib/ndarray/ctor] instance **throws** when provided an index which exceeds array dimensions. To support alternative indexing behavior, set the `mode` option, which will affect all public methods for getting and setting array elements.
161
161
162
162
```javascript
163
163
var opts = {
@@ -222,7 +222,7 @@ var bool = ( v === buf[ 0 ] );
222
222
223
223
## Notes
224
224
225
-
- The number of elements in a data source `buffer`**must** agree with a specified array `shape` (i.e., the function assumes a single-segment contiguous [`ndarray`][@stdlib/ndarray/ctor]). To create arbitrary multidimensional views over linear data buffers, use a [lower-level constructor][@stdlib/ndarray/ctor].
225
+
- The number of elements in a data source `buffer`**must** agree with a specified array shape (i.e., the function assumes a single-segment contiguous [ndarray][@stdlib/ndarray/ctor]). To create arbitrary multidimensional views over linear data buffers, use a [lower-level constructor][@stdlib/ndarray/ctor].
226
226
- The function supports arbitrary casting between data types. Note, however, that casting from a larger data type to a smaller data type (e.g., `int32` to `int8`) and between signed and unsigned types of the same size should be considered **unsafe**.
0 commit comments