dmsksqrt.native.js (1820B)
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 'use strict'; 20 21 // MODULES // 22 23 var addon = require( './../src/addon.node' ); 24 25 26 // MAIN // 27 28 /** 29 * Computes the principal square root for each element in a double-precision floating-point strided array `x` according to a strided mask array and assigns the results to elements in a double-precision floating-point strided array `y`. 30 * 31 * @param {NonNegativeInteger} N - number of indexed elements 32 * @param {Float64Array} x - input array 33 * @param {integer} sx - `x` stride length 34 * @param {Uint8Array} m - mask array 35 * @param {integer} sm - `m` stride length 36 * @param {Float64Array} y - destination array 37 * @param {integer} sy - `y` stride length 38 * @returns {Float64Array} `y` 39 * 40 * @example 41 * var Float64Array = require( '@stdlib/array/float64' ); 42 * var Uint8Array = require( '@stdlib/array/uint8' ); 43 * 44 * var x = new Float64Array( [ 0.0, 4.0, 9.0, 12.0, 24.0 ] ); 45 * var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] ); 46 * var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] ); 47 * 48 * dmsksqrt( x.length, x, 1, m, 1, y, 1 ); 49 * // y => <Float64Array>[ 0.0, 2.0, 0.0, ~3.464, 0.0 ] 50 */ 51 function dmsksqrt( N, x, sx, m, sm, y, sy ) { 52 addon( N, x, sx, m, sm, y, sy ); 53 return y; 54 } 55 56 57 // EXPORTS // 58 59 module.exports = dmsksqrt;