time-to-botec

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

repl.txt (2754B)


      1 
      2 {{alias}}( N, alpha, x, stride )
      3     Adds a constant to each single-precision floating-point strided array
      4     element and computes the sum using pairwise summation with extended
      5     accumulation and returning an extended precision result.
      6 
      7     The `N` and `stride` parameters determine which elements in `x` are accessed
      8     at runtime.
      9 
     10     Indexing is relative to the first index. To introduce an offset, use a typed
     11     array view.
     12 
     13     If `N <= 0`, the function returns `0.0`.
     14 
     15     Parameters
     16     ----------
     17     N: integer
     18         Number of indexed elements.
     19 
     20     alpha: number
     21         Constant.
     22 
     23     x: Float32Array
     24         Input array.
     25 
     26     stride: integer
     27         Index increment.
     28 
     29     Returns
     30     -------
     31     out: number
     32         Sum.
     33 
     34     Examples
     35     --------
     36     // Standard Usage:
     37     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     38     > {{alias}}( x.length, 5.0, x, 1 )
     39     16.0
     40 
     41     // Using `N` and `stride` parameters:
     42     > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
     43     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     44     > var stride = 2;
     45     > {{alias}}( N, 5.0, x, stride )
     46     16.0
     47 
     48     // Using view offsets:
     49     > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     50     > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     51     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     52     > stride = 2;
     53     > {{alias}}( N, 5.0, x1, stride )
     54     14.0
     55 
     56 {{alias}}.ndarray( N, alpha, x, stride, offset )
     57     Adds a constant to each single-precision floating-point strided array
     58     element and computes the sum using pairwise summation with extended
     59     accumulation and alternative indexing semantics and returning an extended
     60     precision result.
     61 
     62     While typed array views mandate a view offset based on the underlying
     63     buffer, the `offset` parameter supports indexing semantics based on a
     64     starting index.
     65 
     66     Parameters
     67     ----------
     68     N: integer
     69         Number of indexed elements.
     70 
     71     alpha: number
     72         Constant.
     73 
     74     x: Float32Array
     75         Input array.
     76 
     77     stride: integer
     78         Index increment.
     79 
     80     offset: integer
     81         Starting index.
     82 
     83     Returns
     84     -------
     85     out: number
     86         Sum.
     87 
     88     Examples
     89     --------
     90     // Standard Usage:
     91     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     92     > {{alias}}.ndarray( x.length, 5.0, x, 1, 0 )
     93     16.0
     94 
     95     // Using offset parameter:
     96     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     97     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     98     > {{alias}}.ndarray( N, 5.0, x, 2, 1 )
     99     14.0
    100 
    101     See Also
    102     --------
    103