time-to-botec

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

repl.txt (3624B)


      1 
      2 {{alias}}( N, sum, x, strideX, y, strideY )
      3     Computes the cumulative sum of single-precision floating-point strided array
      4     elements using a second-order iterative Kahan–Babuška algorithm.
      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 a typed
     10     array view.
     11 
     12     If `N <= 0`, the function returns `y` unchanged.
     13 
     14     Parameters
     15     ----------
     16     N: integer
     17         Number of indexed elements.
     18 
     19     sum: number
     20         Initial sum.
     21 
     22     x: Float32Array
     23         Input array.
     24 
     25     strideX: integer
     26         Index increment for `x`.
     27 
     28     y: Float32Array
     29         Output array.
     30 
     31     strideY: integer
     32         Index increment for `y`.
     33 
     34     Returns
     35     -------
     36     out: Float32Array
     37         Output array.
     38 
     39     Examples
     40     --------
     41     // Standard Usage:
     42     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     43     > var y = new {{alias:@stdlib/array/float32}}( x.length );
     44     > {{alias}}( x.length, 0.0, x, 1, y, 1 )
     45     <Float32Array>[ 1.0, -1.0, 1.0 ]
     46 
     47     // Using `N` and `stride` parameters:
     48     > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
     49     > y = new {{alias:@stdlib/array/float32}}( x.length );
     50     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     51     > {{alias}}( N, 0.0, x, 2, y, 2 )
     52     <Float32Array>[ -2.0, 0.0, -1.0, 0.0, 1.0, 0.0 ]
     53 
     54     // Using view offsets:
     55     > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     56     > var y0 = new {{alias:@stdlib/array/float32}}( x0.length );
     57     > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     58     > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 );
     59     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     60     > {{alias}}( N, 0.0, x1, 2, y1, 1 )
     61     <Float32Array>[ -2.0, 0.0, -1.0 ]
     62     > y0
     63     <Float32Array>[ 0.0, 0.0, 0.0, -2.0, 0.0, -1.0 ]
     64 
     65 {{alias}}.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY )
     66     Computes the cumulative sum of single-precision floating-point strided array
     67     elements using a second-order iterative Kahan–Babuška algorithm and
     68     alternative indexing semantics.
     69 
     70     While typed array views mandate a view offset based on the underlying
     71     buffer, the `offset` parameter supports indexing semantics based on a
     72     starting index.
     73 
     74     Parameters
     75     ----------
     76     N: integer
     77         Number of indexed elements.
     78 
     79     sum: number
     80         Initial sum.
     81 
     82     x: Float32Array
     83         Input array.
     84 
     85     strideX: integer
     86         Index increment for `x`.
     87 
     88     offsetX: integer
     89         Starting index for `x`.
     90 
     91     y: Float32Array
     92         Output array.
     93 
     94     strideY: integer
     95         Index increment for `y`.
     96 
     97     offsetY: integer
     98         Starting index for `y`.
     99 
    100     Returns
    101     -------
    102     out: Float32Array
    103         Output array.
    104 
    105     Examples
    106     --------
    107     // Standard Usage:
    108     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
    109     > var y = new {{alias:@stdlib/array/float32}}( x.length );
    110     > {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
    111     <Float32Array>[ 1.0, -1.0, 1.0 ]
    112 
    113     // Advanced indexing:
    114     > x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
    115     > y = new {{alias:@stdlib/array/float32}}( x.length );
    116     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    117     > {{alias}}.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 )
    118     <Float32Array>[ 0.0, 0.0, 0.0, -1.0, 0.0, -2.0 ]
    119 
    120     See Also
    121     --------
    122