repl.txt (3423B)
1 2 {{alias}}( N, x, strideX, y, strideY ) 3 Rounds each element in a strided array `x` toward negative infinity and 4 assigns the results to elements in a strided array `y`. 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 typed 10 array views. 11 12 Parameters 13 ---------- 14 N: integer 15 Number of indexed elements. 16 17 x: ArrayLikeObject 18 Input array. 19 20 strideX: integer 21 Index increment for `x`. 22 23 y: ArrayLikeObject 24 Destination array. 25 26 strideY: integer 27 Index increment for `y`. 28 29 Returns 30 ------- 31 y: ArrayLikeObject 32 Input array `y`. 33 34 Examples 35 -------- 36 // Standard usage: 37 > var x = new {{alias:@stdlib/array/float64}}( [ -1.5, 2.3, -3.9, 4.2 ] ); 38 > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 39 > {{alias}}( x.length, x, 1, y, 1 ) 40 <Float64Array>[ -2.0, 2.0, -4.0, 4.0 ] 41 42 // Using `N` and `stride` parameters: 43 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 44 > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 45 > {{alias}}( N, x, 2, y, -1 ) 46 <Float64Array>[ -4.0, -2.0, 0.0, 0.0 ] 47 48 // Using view offsets: 49 > var x0 = new {{alias:@stdlib/array/float64}}( [ -1.5, 2.3, -3.9, 4.2 ] ); 50 > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 51 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 52 > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); 53 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 54 > {{alias}}( N, x1, -2, y1, 1 ) 55 <Float64Array>[ 4.0, 2.0 ] 56 > y0 57 <Float64Array>[ 0.0, 0.0, 4.0, 2.0 ] 58 59 60 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) 61 Rounds each element in a strided array `x` toward negative infinity and 62 assigns the results to elements in a strided array `y` using alternative 63 indexing semantics. 64 65 While typed array views mandate a view offset based on the underlying 66 buffer, the `offsetX` and `offsetY` parameters support indexing semantics 67 based on starting indices. 68 69 Parameters 70 ---------- 71 N: integer 72 Number of indexed elements. 73 74 x: ArrayLikeObject 75 Input array. 76 77 strideX: integer 78 Index increment for `x`. 79 80 offsetX: integer 81 Starting index for `x`. 82 83 y: ArrayLikeObject 84 Destination array. 85 86 strideY: integer 87 Index increment for `y`. 88 89 offsetY: integer 90 Starting index for `y`. 91 92 Returns 93 ------- 94 y: ArrayLikeObject 95 Input array `y`. 96 97 Examples 98 -------- 99 // Standard usage: 100 > var x = new {{alias:@stdlib/array/float64}}( [ -1.5, 2.3, -3.9, 4.2 ] ); 101 > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 102 > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) 103 <Float64Array>[ -2.0, 2.0, -4.0, 4.0 ] 104 105 // Advanced indexing: 106 > x = new {{alias:@stdlib/array/float64}}( [ -1.5, 2.3, -3.9, 4.2 ] ); 107 > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 108 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 109 > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) 110 <Float64Array>[ 0.0, 0.0, 4.0, 2.0 ] 111 112 See Also 113 -------- 114