time-to-botec

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

repl.txt (3225B)


      1 
      2 {{alias}}( N, x, strideX, mask, strideMask )
      3     Computes the maximum value of a strided array according to a mask.
      4 
      5     The `N` and `stride` parameters determine which elements are accessed at
      6     runtime.
      7 
      8     Indexing is relative to the first index. To introduce offsets, use a typed
      9     array views.
     10 
     11     If a `mask` array element is `0`, the corresponding element in `x` is
     12     considered valid and included in computation.
     13 
     14     If a `mask` array element is `1`, the corresponding element in `x` is
     15     considered invalid/missing and excluded from computation.
     16 
     17     If `N <= 0`, the function returns `NaN`.
     18 
     19     Parameters
     20     ----------
     21     N: integer
     22         Number of indexed elements.
     23 
     24     x: Array<number>|TypedArray
     25         Input array.
     26 
     27     strideX: integer
     28         Index increment for `x`.
     29 
     30     mask: Array<number>|TypedArray
     31         Mask array.
     32 
     33     strideMask: integer
     34         Index increment for `mask`.
     35 
     36     Returns
     37     -------
     38     out: number
     39         Maximum value.
     40 
     41     Examples
     42     --------
     43     // Standard Usage:
     44     > var x = [ 1.0, -2.0, 4.0, 2.0 ];
     45     > var mask = [ 0, 0, 1, 0 ];
     46     > {{alias}}( x.length, x, 1, mask, 1 )
     47     2.0
     48 
     49     // Using `N` and `stride` parameters:
     50     > x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, 4.0 ];
     51     > mask = [ 0, 0, 0, 0, 0, 0, 1 ];
     52     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     53     > {{alias}}( N, x, 2, mask, 2 )
     54     2.0
     55 
     56     // Using view offsets:
     57     > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, 4.0 ] );
     58     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     59     > var mask0 = new {{alias:@stdlib/array/uint8}}( [ 0, 0, 0, 0, 0, 0, 1 ] );
     60     > var mask1 = new {{alias:@stdlib/array/uint8}}( mask0.buffer, mask0.BYTES_PER_ELEMENT*1 );
     61     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     62     > {{alias}}( N, x1, 2, mask1, 2 )
     63     2.0
     64 
     65 {{alias}}.ndarray( N, x, strideX, offsetX, mask, strideMask, offsetMask )
     66     Computes the maximum value of a strided array according to a mask and using
     67     alternative indexing semantics.
     68 
     69     While typed array views mandate a view offset based on the underlying
     70     buffer, the `offset` parameter supports indexing semantics based on a
     71     starting index.
     72 
     73     Parameters
     74     ----------
     75     N: integer
     76         Number of indexed elements.
     77 
     78     x: Array<number>|TypedArray
     79         Input array.
     80 
     81     strideX: integer
     82         Index increment for `x`.
     83 
     84     offsetX: integer
     85         Starting index for `x`.
     86 
     87     mask: Array<number>|TypedArray
     88         Mask array.
     89 
     90     strideMask: integer
     91         Index increment for `mask`.
     92 
     93     offsetMask: integer
     94         Starting index for `mask`.
     95 
     96     Returns
     97     -------
     98     out: number
     99         Maximum value.
    100 
    101     Examples
    102     --------
    103     // Standard Usage:
    104     > var x = [ 1.0, -2.0, 2.0, 4.0 ];
    105     > var mask = [ 0, 0, 0, 1 ];
    106     > {{alias}}.ndarray( x.length, x, 1, 0, mask, 1, 0 )
    107     2.0
    108 
    109     // Using offset parameter:
    110     > x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, 4.0 ];
    111     > mask = [ 0, 0, 0, 0, 0, 0, 1 ];
    112     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    113     > {{alias}}.ndarray( N, x, 2, 1, mask, 2, 1 )
    114     2.0
    115 
    116     See Also
    117     --------
    118