time-to-botec

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

smsktrunc.js (1878B)


      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' );
     24 var truncf = require( './../../../../base/special/truncf' );
     25 
     26 
     27 // MAIN //
     28 
     29 /**
     30 * Rounds each element in a single-precision floating-point strided array `x` toward zero 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 {Uint8Array} m - mask array
     36 * @param {integer} sm - `m` stride length
     37 * @param {Float32Array} y - destination array
     38 * @param {integer} sy - `y` stride length
     39 * @returns {Float32Array} `y`
     40 *
     41 * @example
     42 * var Float32Array = require( '@stdlib/array/float32' );
     43 * var Uint8Array = require( '@stdlib/array/uint8' );
     44 *
     45 * var x = new Float32Array( [ 1.1, 2.5, -3.5, 4.0, -5.9 ] );
     46 * var m = new Uint8Array( [ 0, 0, 1, 0, 1 ] );
     47 * var y = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
     48 *
     49 * smsktrunc( x.length, x, 1, m, 1, y, 1 );
     50 * // y => <Float32Array>[ 1.0, 2.0, 0.0, 4.0, 0.0 ]
     51 */
     52 function smsktrunc( N, x, sx, m, sm, y, sy ) {
     53 	return smskmap( N, x, sx, m, sm, y, sy, truncf );
     54 }
     55 
     56 
     57 // EXPORTS //
     58 
     59 module.exports = smsktrunc;