repl.txt (4217B)
1 2 {{alias}}( N, x, sx, y, sy, clbk[, thisArg] ) 3 Computes the inverse versed cosine of each element retrieved from an input 4 strided array `x` via a callback function and assigns each result to an 5 element in an output strided array `y`. 6 7 The `N` and stride parameters determine which elements in `x` and `y` are 8 accessed at runtime. 9 10 Indexing is relative to the first index. To introduce an offset, use typed 11 array views. 12 13 The callback function is provided six arguments: 14 15 - value: array element 16 - idx: iteration index 17 - xi: strided index (offsetX + idx*sx) 18 - yi: strided index (offsetY + idx*sy) 19 - x: the input array 20 - y: the destination array 21 22 If the callback function does not return any value (or equivalently, 23 explicitly returns `undefined`), the value is ignored. 24 25 Parameters 26 ---------- 27 N: integer 28 Number of indexed elements. 29 30 x: Array|TypedArray|Object 31 Input array/collection. If provided an object, the object must be array- 32 like (excluding strings and functions). 33 34 sx: integer 35 Index increment for `x`. 36 37 y: Array|TypedArray|Object 38 Destination array/collection. If provided an object, the object must be 39 array-like (excluding strings and functions). 40 41 sy: integer 42 Index increment for `y`. 43 44 clbk: Function 45 Callback function. 46 47 thisArg: any (optional) 48 Callback execution context. 49 50 Returns 51 ------- 52 y: Array|TypedArray|Object 53 Destination array/collection. 54 55 Examples 56 -------- 57 // Standard usage: 58 > var x = [ 0.0, -1.57, -0.5, -1.0 ]; 59 > var y = [ 0.0, 0.0, 0.0, 0.0 ]; 60 > function clbk( v ) { return v; }; 61 > {{alias}}( x.length, x, 1, y, 1, clbk ) 62 [ 0.0, ~2.177, ~1.047, ~1.571 ] 63 64 // Using `N` and stride parameters: 65 > y = [ 0.0, 0.0, 0.0, 0.0 ]; 66 > {{alias}}( 2, x, 2, y, -1, clbk ) 67 [ ~1.047, 0.0, 0.0, 0.0 ] 68 69 // Using view offsets: 70 > var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, -1.57, -0.5, -1.0 ] ); 71 > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 72 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 73 > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); 74 > {{alias}}( 2, x1, -2, y1, 1, clbk ) 75 <Float64Array>[ ~1.571, ~2.177 ] 76 > y0 77 <Float64Array>[ 0.0, 0.0, ~1.571, ~2.177 ] 78 79 80 {{alias}}.ndarray( N, x, sx, ox, y, sy, oy, clbk[, thisArg] ) 81 Computes the inverse versed cosine of each element retrieved from an input 82 strided array `x` via a callback function and assigns each result to an 83 element in an output strided array `y` using alternative indexing 84 semantics. 85 86 While typed array views mandate a view offset based on the underlying 87 buffer, the offset parameters support indexing semantics based on starting 88 indices. 89 90 Parameters 91 ---------- 92 N: integer 93 Number of indexed elements. 94 95 x: Array|TypedArray|Object 96 Input array/collection. If provided an object, the object must be array- 97 like (excluding strings and functions). 98 99 sx: integer 100 Index increment for `x`. 101 102 ox: integer 103 Starting index for `x`. 104 105 y: Array|TypedArray|Object 106 Destination array/collection. If provided an object, the object must be 107 array-like (excluding strings and functions). 108 109 sy: integer 110 Index increment for `y`. 111 112 oy: integer 113 Starting index for `y`. 114 115 clbk: Function 116 Callback function. 117 118 thisArg: any (optional) 119 Callback execution context. 120 121 Returns 122 ------- 123 y: Array|TypedArray|Object 124 Destination array/collection. 125 126 Examples 127 -------- 128 // Standard usage: 129 > var x = [ 0.0, -1.57, -0.5, -1.0 ]; 130 > var y = [ 0.0, 0.0, 0.0, 0.0 ]; 131 > function clbk( v ) { return v; }; 132 > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, clbk ) 133 [ 0.0, ~2.177, ~1.047, ~1.571 ] 134 135 // Advanced indexing: 136 > x = [ 0.0, -1.57, -0.5, -1.0 ]; 137 > y = [ 0.0, 0.0, 0.0, 0.0 ]; 138 > {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, clbk ) 139 [ 0.0, 0.0, ~1.571, ~2.177 ] 140 141 See Also 142 -------- 143