time-to-botec

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

repl.txt (3354B)


      1 
      2 {{alias}}( N, x, strideX, y, strideY )
      3     Computes the absolute value for each element in `x` and assigns the results
      4     to elements in `y`.
      5 
      6     The `N` and `stride` parameters determine which elements in `x` and `y` are
      7     accessed at runtime.
      8 
      9     Indexing is relative to the first index. To introduce an offset, use typed
     10     array views.
     11 
     12     Parameters
     13     ----------
     14     N: integer
     15         Number of indexed elements.
     16 
     17     x: ArrayLikeObject
     18         Input array.
     19 
     20     strideX: integer
     21         Index increment for `x`.
     22 
     23     y: ArrayLikeObject
     24         Destination array.
     25 
     26     strideY: integer
     27         Index increment for `y`.
     28 
     29     Returns
     30     -------
     31     y: ArrayLikeObject
     32         Input array `y`.
     33 
     34     Examples
     35     --------
     36     // Standard usage:
     37     > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] );
     38     > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
     39     > {{alias}}( x.length, x, 1, y, 1 )
     40     <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ]
     41 
     42     // Using `N` and `stride` parameters:
     43     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     44     > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
     45     > {{alias}}( N, x, 2, y, -1 )
     46     <Float64Array>[ 3.0, 1.0, 0.0, 0.0 ]
     47 
     48     // Using view offsets:
     49     > var x0 = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] );
     50     > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
     51     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     52     > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
     53     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     54     > {{alias}}( N, x1, -2, y1, 1 )
     55     <Float64Array>[ 4.0, 2.0 ]
     56     > y0
     57     <Float64Array>[ 0.0, 0.0, 4.0, 2.0 ]
     58 
     59 
     60 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )
     61     Computes the absolute value for each element in `x` and assigns the results
     62     to elements in `y` using alternative indexing semantics.
     63 
     64     While typed array views mandate a view offset based on the underlying
     65     buffer, the `offsetX` and `offsetY` parameters support indexing semantics
     66     based on starting indices.
     67 
     68     Parameters
     69     ----------
     70     N: integer
     71         Number of indexed elements.
     72 
     73     x: ArrayLikeObject
     74         Input array.
     75 
     76     strideX: integer
     77         Index increment for `x`.
     78 
     79     offsetX: integer
     80         Starting index for `x`.
     81 
     82     y: ArrayLikeObject
     83         Destination array.
     84 
     85     strideY: integer
     86         Index increment for `y`.
     87 
     88     offsetY: integer
     89         Starting index for `y`.
     90 
     91     Returns
     92     -------
     93     y: ArrayLikeObject
     94         Input array `y`.
     95 
     96     Examples
     97     --------
     98     // Standard usage:
     99     > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] );
    100     > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
    101     > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 )
    102     <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ]
    103 
    104     // Advanced indexing:
    105     > x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] );
    106     > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
    107     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    108     > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 )
    109     <Float64Array>[ 0.0, 0.0, 4.0, 2.0 ]
    110 
    111     See Also
    112     --------
    113