dmskramp.js (1882B)
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 dmskmap = require( '@stdlib/strided/base/dmskmap' ); 24 var ramp = require( './../../../../base/special/ramp' ); 25 26 27 // MAIN // 28 29 /** 30 * Evaluates the ramp function 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`. 31 * 32 * @param {NonNegativeInteger} N - number of indexed elements 33 * @param {Float64Array} x - input array 34 * @param {integer} sx - `x` stride length 35 * @param {Uint8Array} m - mask array 36 * @param {integer} sm - `m` stride length 37 * @param {Float64Array} y - destination array 38 * @param {integer} sy - `y` stride length 39 * @returns {Float64Array} `y` 40 * 41 * @example 42 * var Float64Array = require( '@stdlib/array/float64' ); 43 * var Uint8Array = require( '@stdlib/array/uint8' ); 44 * 45 * var x = new Float64Array( [ 1.1, 2.5, -3.5, 4.0, -5.9 ] ); 46 * var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] ); 47 * var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] ); 48 * 49 * dmskramp( x.length, x, 1, m, 1, y, 1 ); 50 * // y => <Float64Array>[ 1.1, 2.5, 0.0, 4.0, 0.0 ] 51 */ 52 function dmskramp( N, x, sx, m, sm, y, sy ) { 53 return dmskmap( N, x, sx, m, sm, y, sy, ramp ); 54 } 55 56 57 // EXPORTS // 58 59 module.exports = dmskramp;