time-to-botec

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

repl.txt (2636B)


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