time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1383B)


      1 
      2 {{alias}}( shape, ...subscript[, options] )
      3     Converts subscripts to a linear index.
      4 
      5     Parameters
      6     ----------
      7     shape: ArrayLike
      8         Array shape.
      9 
     10     subscript: ...integer
     11         Subscripts.
     12 
     13     options: Object (optional)
     14         Options.
     15 
     16     options.order: string (optional)
     17         Specifies whether an array is row-major (C-style) or column-major
     18         (Fortran style). Default: 'row-major'.
     19 
     20     options.mode: string|Array<string> (optional)
     21         Specifies how to handle subscripts which exceed array dimensions. If
     22         equal to 'throw', the function throws an error when a subscript exceeds
     23         array dimensions. If equal to 'wrap', the function wraps around
     24         subscripts exceeding array dimensions using modulo arithmetic. If equal
     25         to 'clamp', the function sets subscripts exceeding array dimensions to
     26         either `0` (minimum index) or the maximum index along a particular
     27         dimension. If provided a mode array, each array element specifies the
     28         mode for a corresponding array dimension. If provided fewer modes than
     29         dimensions, the function recycles modes using modulo arithmetic.
     30         Default: [ 'throw' ].
     31 
     32     Returns
     33     -------
     34     idx: integer
     35         Linear index.
     36 
     37     Examples
     38     --------
     39     > var d = [ 3, 3, 3 ];
     40     > var idx = {{alias}}( d, 1, 2, 2 )
     41     17
     42 
     43     See Also
     44     --------
     45