time-to-botec

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

repl.txt (2482B)


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