repl.txt (1345B)
1 2 {{alias}}( shape, strides, offset, order, idx, mode ) 3 Converts a linear index in an array view to a linear index in an underlying 4 data buffer. 5 6 Parameters 7 ---------- 8 shape: ArrayLike 9 Array shape. 10 11 strides: ArrayLike 12 Stride array. 13 14 offset: integer 15 Location of the first indexed value based on the stride array. 16 17 order: string 18 Specifies whether an array is row-major (C-style) or column-major 19 (Fortran-style). 20 21 idx: integer 22 Linear index in an array view. 23 24 mode: string 25 Specifies how to handle a linear index which exceeds array dimensions. 26 If equal to 'throw', the function throws an error when a linear index 27 exceeds array dimensions. If equal to 'wrap', the function wraps around 28 a linear index exceeding array dimensions using modulo arithmetic. If 29 equal to 'clamp', the function sets a linear index exceeding array 30 dimensions to either `0` (minimum linear index) or the maximum linear 31 index. Default: 'throw'. 32 33 Returns 34 ------- 35 idx: integer 36 Linear index in an underlying data buffer. 37 38 Examples 39 -------- 40 > var d = [ 3, 3, 3 ]; 41 > var s = [ 9, -3, 1 ]; 42 > var o = 6; 43 > var idx = {{alias}}( d, s, o, 'row-major', 1, 'throw' ) 44 7 45 46 See Also 47 -------- 48