time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

ndarray.js (2088B)


      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 smskmap = require( '@stdlib/strided/base/smskmap' ).ndarray;
     24 var rampf = require( './../../../../base/special/rampf' );
     25 
     26 
     27 // MAIN //
     28 
     29 /**
     30 * Evaluates the ramp function for each element in a single-precision floating-point strided array `x` according to a strided mask array and assigns the results to elements in a single-precision floating-point strided array `y`.
     31 *
     32 * @param {NonNegativeInteger} N - number of indexed elements
     33 * @param {Float32Array} x - input array
     34 * @param {integer} sx - `x` stride length
     35 * @param {NonNegativeInteger} ox - starting `x` index
     36 * @param {Uint8Array} m - mask array
     37 * @param {integer} sm - `m` stride length
     38 * @param {NonNegativeInteger} om - starting `m` index
     39 * @param {Float32Array} y - destination array
     40 * @param {integer} sy - `y` stride length
     41 * @param {NonNegativeInteger} oy - starting `y` index
     42 * @returns {Float32Array} `y`
     43 *
     44 * @example
     45 * var Float32Array = require( '@stdlib/array/float32' );
     46 * var Uint8Array = require( '@stdlib/array/uint8' );
     47 *
     48 * var x = new Float32Array( [ 1.0, 2.0, -3.0, 4.0, -5.0 ] );
     49 * var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] );
     50 * var y = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
     51 *
     52 * smskramp( x.length, x, 1, 0, m, 1, 0, y, 1, 0 );
     53 * // y => <Float32Array>[ 1.0, 2.0, 0.0, 4.0, 0.0 ]
     54 */
     55 function smskramp( N, x, sx, ox, m, sm, om, y, sy, oy ) {
     56 	return smskmap( N, x, sx, ox, m, sm, om, y, sy, oy, rampf );
     57 }
     58 
     59 
     60 // EXPORTS //
     61 
     62 module.exports = smskramp;