repl.txt (3432B)
1 2 {{alias}}( N, x, strideX, y, strideY ) 3 Copies values from `x` into `y`. 4 5 The `N` and `stride` parameters determine how values from `x` are copied 6 into `y`. 7 8 Indexing is relative to the first index. To introduce an offset, use typed 9 array views. 10 11 If `N` is less than or equal to `0`, the function returns `y` unchanged. 12 13 Parameters 14 ---------- 15 N: integer 16 Number of values to copy. 17 18 x: Float64Array 19 Input array. 20 21 strideX: integer 22 Index increment for `x`. 23 24 y: Float64Array 25 Destination array. 26 27 strideY: integer 28 Index increment for `y`. 29 30 Returns 31 ------- 32 y: Float64Array 33 Input array `y`. 34 35 Examples 36 -------- 37 // Standard usage: 38 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); 39 > var y = new {{alias:@stdlib/array/float64}}( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); 40 > {{alias}}( x.length, x, 1, y, 1 ) 41 <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ] 42 43 // Advanced indexing: 44 > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); 45 > y = new {{alias:@stdlib/array/float64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); 46 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 47 > {{alias}}( N, x, -2, y, 1 ) 48 <Float64Array>[ 5.0, 3.0, 1.0, 10.0, 11.0, 12.0 ] 49 50 // Using typed array views: 51 > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); 52 > var y0 = new {{alias:@stdlib/array/float64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); 53 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 54 > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); 55 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 56 > {{alias}}( N, x1, -2, y1, 1 ) 57 <Float64Array>[ 6.0, 4.0, 2.0 ] 58 > y0 59 <Float64Array>[ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] 60 61 62 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) 63 Copies values from `x` into `y` using alternative indexing semantics. 64 65 While typed array views mandate a view offset based on the underlying 66 buffer, the `offset` parameters support indexing semantics based on starting 67 indices. 68 69 Parameters 70 ---------- 71 N: integer 72 Number of values to copy. 73 74 x: Float64Array 75 Input array. 76 77 strideX: integer 78 Index increment for `x`. 79 80 offsetX: integer 81 Starting index for `x`. 82 83 y: Float64Array 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: Float64Array 95 Input array `y`. 96 97 Examples 98 -------- 99 // Standard usage: 100 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); 101 > var y = new {{alias:@stdlib/array/float64}}( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); 102 > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) 103 <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ] 104 105 // Advanced indexing: 106 > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); 107 > y = new {{alias:@stdlib/array/float64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.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>[ 7.0, 8.0, 9.0, 6.0, 4.0, 2.0 ] 111 112 See Also 113 -------- 114