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