index.js (2308B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2020 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 /** 22 * Apply a unary function accepting and returning double-precision floating-point numbers to each element in a double-precision floating-point strided input array according to a corresponding element in a strided mask array and assign each result to an element in a double-precision floating-point strided output array. 23 * 24 * @module @stdlib/strided/base/dmskmap 25 * 26 * @example 27 * var Float64Array = require( '@stdlib/array/float64' ); 28 * var Uint8Array = require( '@stdlib/array/uint8' ); 29 * var dmskmap = require( '@stdlib/strided/base/dmskmap' ); 30 * 31 * function scale( x ) { 32 * return x * 10.0; 33 * } 34 * 35 * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); 36 * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] ); 37 * var y = new Float64Array( x.length ); 38 * 39 * dmskmap( x.length, x, 1, m, 1, y, 1, scale ); 40 * 41 * console.log( y ); 42 * // => <Float64Array>[ 10.0, 20.0, 0.0, 40.0, 50.0 ] 43 * 44 * @example 45 * var Float64Array = require( '@stdlib/array/float64' ); 46 * var Uint8Array = require( '@stdlib/array/uint8' ); 47 * var dmskmap = require( '@stdlib/strided/base/dmskmap' ); 48 * 49 * function scale( x ) { 50 * return x * 10.0; 51 * } 52 * 53 * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); 54 * var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] ); 55 * var y = new Float64Array( x.length ); 56 * 57 * dmskmap.ndarray( x.length, x, 1, 0, m, 1, 0, y, 1, 0, scale ); 58 * 59 * console.log( y ); 60 * // => <Float64Array>[ 10.0, 20.0, 0.0, 40.0, 50.0 ] 61 */ 62 63 // MODULES // 64 65 var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); 66 var main = require( './main.js' ); 67 var ndarray = require( './ndarray.js' ); 68 69 70 // MAIN // 71 72 setReadOnly( main, 'ndarray', ndarray ); 73 74 75 // EXPORTS // 76 77 module.exports = main;