ndarray.js (2020B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2021 The Stdlib Authors. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 /* eslint-disable max-len */ 20 21 'use strict'; 22 23 // MODULES // 24 25 var mapBy = require( '@stdlib/strided/base/map-by' ).ndarray; 26 var besselj1 = require( './../../../../base/special/besselj1' ); 27 28 29 // MAIN // 30 31 /** 32 * Computes the Bessel function of the first kind of order one for each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y`. 33 * 34 * @param {NonNegativeInteger} N - number of indexed elements 35 * @param {Collection} x - input array/collection 36 * @param {integer} strideX - `x` stride length 37 * @param {NonNegativeInteger} offsetX - starting `x` index 38 * @param {Collection} y - destination array/collection 39 * @param {integer} strideY - `y` stride length 40 * @param {NonNegativeInteger} offsetY - starting `y` index 41 * @param {Callback} clbk - callback 42 * @param {*} [thisArg] - callback execution context 43 * @returns {Collection} `y` 44 * 45 * @example 46 * function accessor( v ) { 47 * return v; 48 * } 49 * 50 * var x = [ 0.0, 1.0, 0.1, 0.25, 0.5 ]; 51 * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; 52 * 53 * besselj1By( x.length, x, 1, 0, y, 1, 0, accessor ); 54 * 55 * console.log( y ); 56 * // => [ 0.0, ~0.44, ~0.05, ~0.124, ~0.242 ] 57 */ 58 function besselj1By( N, x, strideX, offsetX, y, strideY, offsetY, clbk, thisArg ) { 59 return mapBy( N, x, strideX, offsetX, y, strideY, offsetY, besselj1, clbk, thisArg ); 60 } 61 62 63 // EXPORTS // 64 65 module.exports = besselj1By;