time-to-botec

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

repl.txt (4197B)


      1 
      2 {{alias}}( N, x, sx, y, sy, clbk[, thisArg] )
      3     Computes the arctangent of each element retrieved from an input strided
      4     array `x` via a callback function and assigns each result to an element in
      5     an output strided array `y`.
      6 
      7     The `N` and stride parameters determine which elements in `x` and `y` are
      8     accessed at runtime.
      9 
     10     Indexing is relative to the first index. To introduce an offset, use typed
     11     array views.
     12 
     13     The callback function is provided six arguments:
     14 
     15     - value: array element
     16     - idx: iteration index
     17     - xi: strided index (offsetX + idx*sx)
     18     - yi: strided index (offsetY + idx*sy)
     19     - x: the input array
     20     - y: the destination array
     21 
     22     If the callback function does not return any value (or equivalently,
     23     explicitly returns `undefined`), the value is ignored.
     24 
     25     Parameters
     26     ----------
     27     N: integer
     28         Number of indexed elements.
     29 
     30     x: Array|TypedArray|Object
     31         Input array/collection. If provided an object, the object must be array-
     32         like (excluding strings and functions).
     33 
     34     sx: integer
     35         Index increment for `x`.
     36 
     37     y: Array|TypedArray|Object
     38         Destination array/collection. If provided an object, the object must be
     39         array-like (excluding strings and functions).
     40 
     41     sy: integer
     42         Index increment for `y`.
     43 
     44     clbk: Function
     45         Callback function.
     46 
     47     thisArg: any (optional)
     48         Callback execution context.
     49 
     50     Returns
     51     -------
     52     y: Array|TypedArray|Object
     53         Destination array/collection.
     54 
     55     Examples
     56     --------
     57     // Standard usage:
     58     > var x = [ 0.0, -0.5, 1.0, -1.25 ];
     59     > var y = [ 0.0, 0.0, 0.0, 0.0 ];
     60     > function clbk( v ) { return v; };
     61     > {{alias}}( x.length, x, 1, y, 1, clbk )
     62     [ 0.0, ~-0.464, ~0.785, ~-0.896 ]
     63 
     64     // Using `N` and stride parameters:
     65     > y = [ 0.0, 0.0, 0.0, 0.0 ];
     66     > {{alias}}( 2, x, 2, y, -1, clbk )
     67     [ ~0.785, 0.0, 0.0, 0.0 ]
     68 
     69     // Using view offsets:
     70     > var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, -0.5, 1.0, -1.25 ] );
     71     > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
     72     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     73     > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
     74     > {{alias}}( 2, x1, -2, y1, 1, clbk )
     75     <Float64Array>[ ~-0.896, ~-0.464 ]
     76     > y0
     77     <Float64Array>[ 0.0, 0.0, ~-0.896, ~-0.464 ]
     78 
     79 
     80 {{alias}}.ndarray( N, x, sx, ox, y, sy, oy, clbk[, thisArg] )
     81     Computes the arctangent of each element retrieved from an input strided
     82     array `x` via a callback function and assigns each result to an element in
     83     an output strided array `y` using alternative indexing semantics.
     84 
     85     While typed array views mandate a view offset based on the underlying
     86     buffer, the offset parameters support indexing semantics based on starting
     87     indices.
     88 
     89     Parameters
     90     ----------
     91     N: integer
     92         Number of indexed elements.
     93 
     94     x: Array|TypedArray|Object
     95         Input array/collection. If provided an object, the object must be array-
     96         like (excluding strings and functions).
     97 
     98     sx: integer
     99         Index increment for `x`.
    100 
    101     ox: integer
    102         Starting index for `x`.
    103 
    104     y: Array|TypedArray|Object
    105         Destination array/collection. If provided an object, the object must be
    106         array-like (excluding strings and functions).
    107 
    108     sy: integer
    109         Index increment for `y`.
    110 
    111     oy: integer
    112         Starting index for `y`.
    113 
    114     clbk: Function
    115         Callback function.
    116 
    117     thisArg: any (optional)
    118         Callback execution context.
    119 
    120     Returns
    121     -------
    122     y: Array|TypedArray|Object
    123         Destination array/collection.
    124 
    125     Examples
    126     --------
    127     // Standard usage:
    128     > var x = [ 0.0, -0.5, 1.0, -1.25 ];
    129     > var y = [ 0.0, 0.0, 0.0, 0.0 ];
    130     > function clbk( v ) { return v; };
    131     > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, clbk )
    132     [ 0.0, ~-0.464, ~0.785, ~-0.896 ]
    133 
    134     // Advanced indexing:
    135     > x = [ 0.0, -0.5, 1.0, -1.25 ];
    136     > y = [ 0.0, 0.0, 0.0, 0.0 ];
    137     > {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, clbk )
    138     [ 0.0, 0.0, ~-0.896, ~-0.464 ]
    139 
    140     See Also
    141     --------
    142