time-to-botec/js/node_modules/@stdlib/ndarray/base/ind/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

45 lines
973 B
Plaintext

{{alias}}( idx, max, mode )
Returns an index given an index mode.
Parameters
----------
idx: integer
Index.
max: integer
Maximum index value.
mode: string
Specifies how to handle an index outside the interval [0,max]. If equal
to 'throw', the function throws an error. If equal to 'wrap', the
function wraps around an index using modulo arithmetic. If equal to
'clamp', the function sets an index to either `0` (minimum index) or the
maximum index.
Returns
-------
out: integer
Index.
Examples
--------
> var idx = {{alias}}( 2, 10, 'throw' )
2
> idx = {{alias}}( 2, 10, 'wrap' )
2
> idx = {{alias}}( -4, 10, 'wrap' )
7
> idx = {{alias}}( 13, 10, 'wrap' )
2
> idx = {{alias}}( 2, 10, 'clamp' )
2
> idx = {{alias}}( -4, 10, 'clamp' )
0
> idx = {{alias}}( 13, 10, 'clamp' )
10
See Also
--------