time-to-botec

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

index.js (1894B)


      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 nullary callback and assign results to elements in a strided output array.
     23 *
     24 * @module @stdlib/strided/base/nullary
     25 *
     26 * @example
     27 * var Float64Array = require( '@stdlib/array/float64' );
     28 * var nullary = require( '@stdlib/strided/base/nullary' );
     29 *
     30 * function fill() {
     31 *     return 3.0;
     32 * }
     33 *
     34 * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
     35 *
     36 * var shape = [ x.length ];
     37 * var strides = [ 1 ];
     38 *
     39 * nullary( [ x ], shape, strides, fill );
     40 *
     41 * console.log( x );
     42 * // => <Float64Array>[ 3.0, 3.0, 3.0, 3.0, 3.0 ]
     43 *
     44 * @example
     45 * var Float64Array = require( '@stdlib/array/float64' );
     46 * var nullary = require( '@stdlib/strided/base/nullary' );
     47 *
     48 * function fill() {
     49 *     return 3.0;
     50 * }
     51 *
     52 * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
     53 *
     54 * var shape = [ x.length ];
     55 * var strides = [ 1 ];
     56 * var offsets = [ 0 ];
     57 *
     58 * nullary.ndarray( [ x ], shape, strides, offsets, fill );
     59 *
     60 * console.log( x );
     61 * // => <Float64Array>[ 3.0, 3.0, 3.0, 3.0, 3.0 ]
     62 */
     63 
     64 // MODULES //
     65 
     66 var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
     67 var nullary = require( './main.js' );
     68 var ndarray = require( './ndarray.js' );
     69 
     70 
     71 // MAIN //
     72 
     73 setReadOnly( nullary, 'ndarray', ndarray );
     74 
     75 
     76 // EXPORTS //
     77 
     78 module.exports = nullary;