|
27 | 27 |
|
28 | 28 | options.order: string (optional) |
29 | 29 | Specifies the memory layout of the data source as either row-major (C- |
30 | | - style) or column-major (Fortran-style). If set to 'any', if a data |
31 | | - source is column-major and not row-major, the order of the returned |
32 | | - array is column-major; otherwise, the order of the returned array is |
33 | | - always row-major. If set to 'same', the order of the returned array |
34 | | - matches the order of an input data source. If set to either 'row-major' |
35 | | - or 'column-major', the order of the returned array is set to the option |
36 | | - value. Note that specifying an order which differs from the order of a |
| 30 | + style) or column-major (Fortran-style). The option may be one of the |
| 31 | + following values: |
| 32 | + |
| 33 | + - 'row-major': the order of the returned array is row-major. |
| 34 | + - 'column-major': the order of the returned array is column-major. |
| 35 | + - 'any': if a data source is column-major and not row-major, the order |
| 36 | + of the returned array is column-major; otherwise, the order of the |
| 37 | + returned array is row-major. |
| 38 | + - 'same': the order of the returned array matches the order of an input |
| 39 | + data source. |
| 40 | + |
| 41 | + Note that specifying an order which differs from the order of a |
37 | 42 | provided data source does *not* entail a conversion from one memory |
38 | 43 | layout to another. In short, this option is descriptive, not |
39 | 44 | prescriptive. Default: 'row-major'. |
|
44 | 49 | if provided a nested array, the function resolves nested array |
45 | 50 | dimensions. If provided a multidimensional array data source, the |
46 | 51 | function uses the array's associated shape. For most use cases, such |
47 | | - inference suffices. In the remaining use cases, specifying a shape is |
| 52 | + inference suffices. For the remaining use cases, specifying a shape is |
48 | 53 | necessary. For example, provide a shape to create a multidimensional |
49 | 54 | array view over a linear data buffer, ignoring any existing shape meta |
50 | 55 | data associated with a provided data source. |
|
69 | 74 | dimensions to the array shape in order to satisfy the dimensions |
70 | 75 | requirement. Default: 0. |
71 | 76 |
|
| 77 | + options.casting: string ( optional) |
| 78 | + Specifies the casting rule used to determine acceptable casts. The |
| 79 | + option may be one of the following values: |
| 80 | + |
| 81 | + - 'none': only allow casting between identical types. |
| 82 | + - 'equiv': allow casting between identical and byte swapped types. |
| 83 | + - 'safe': only allow "safe" casts. |
| 84 | + - 'same-kind': allow "safe" casts and casts within the same kind (e.g., |
| 85 | + between signed integers or between floats). |
| 86 | + - 'unsafe': allow casting between all types (including between integers |
| 87 | + and floats). |
| 88 | + |
| 89 | + Default: 'safe'. |
| 90 | + |
72 | 91 | options.codegen: boolean (optional) |
73 | 92 | Boolean indicating whether to use code generation. Code generation can |
74 | 93 | boost performance, but may be problematic in browser contexts enforcing |
75 | 94 | a strict content security policy (CSP). Default: true. |
76 | 95 |
|
77 | 96 | options.mode: string (optional) |
78 | | - Specifies how to handle indices which exceed array dimensions. If equal |
79 | | - to 'throw', an ndarray instance throws an error when an index exceeds |
80 | | - array dimensions. If equal to 'wrap', an ndarray instance wraps around |
81 | | - indices exceeding array dimensions using modulo arithmetic. If equal to |
82 | | - 'clamp', an ndarray instance sets an index exceeding array dimensions to |
83 | | - either `0` (minimum index) or the maximum index. Default: 'throw'. |
| 97 | + Specifies how to handle indices which exceed array dimensions. The |
| 98 | + option may be one of the following values: |
| 99 | + |
| 100 | + - 'throw': an ndarray instance throws an error when an index exceeds |
| 101 | + array dimensions. |
| 102 | + - 'wrap': an ndarray instance wraps around indices exceeding array |
| 103 | + dimensions using modulo arithmetic. |
| 104 | + - 'clamp', an ndarray instance sets an index exceeding array dimensions |
| 105 | + to either `0` (minimum index) or the maximum index. |
| 106 | + |
| 107 | + Default: 'throw'. |
84 | 108 |
|
85 | 109 | options.submode: Array<string> (optional) |
86 | 110 | Specifies how to handle subscripts which exceed array dimensions. If a |
87 | | - mode for a corresponding dimension is equal to 'throw', an ndarray |
88 | | - instance throws an error when a subscript exceeds array dimensions. If |
89 | | - equal to 'wrap', an ndarray instance wraps around subscripts exceeding |
90 | | - array dimensions using modulo arithmetic. If equal to 'clamp', an |
91 | | - ndarray instance sets a subscript exceeding array dimensions to either |
92 | | - `0` (minimum index) or the maximum index. If the number of modes is |
93 | | - fewer than the number of dimensions, the function recycles modes using |
94 | | - modulo arithmetic. Default: [ options.mode ]. |
| 111 | + mode for a corresponding dimension is equal to |
| 112 | + |
| 113 | + - 'throw': an ndarray instance throws an error when a subscript exceeds |
| 114 | + array dimensions. |
| 115 | + - 'wrap': an ndarray instance wraps around subscripts exceeding array |
| 116 | + dimensions using modulo arithmetic. |
| 117 | + - 'clamp': an ndarray instance sets a subscript exceeding array |
| 118 | + dimensions to either `0` (minimum index) or the maximum index. |
| 119 | + |
| 120 | + If the number of modes is fewer than the number of dimensions, the |
| 121 | + function recycles modes using modulo arithmetic. |
| 122 | + |
| 123 | + Default: [ options.mode ]. |
95 | 124 |
|
96 | 125 | Returns |
97 | 126 | ------- |
|
0 commit comments