time-to-botec

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

index.js (1778B)


      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 * Compute the absolute value.
     23 *
     24 * @module @stdlib/math/special/abs
     25 *
     26 * @example
     27 * var abs = require( '@stdlib/math/special/abs' );
     28 *
     29 * var y = abs( -1.0 );
     30 * // returns 1.0
     31 *
     32 * @example
     33 * var Float64Array = require( '@stdlib/array/float64' );
     34 * var abs = require( '@stdlib/math/special/abs' );
     35 *
     36 * var x = new Float64Array( [ 1.0, -1.0, 0.0 ] );
     37 *
     38 * var y = abs( x );
     39 * // returns <Float64Array>[ 1.0, 1.0, 0.0 ]
     40 *
     41 * @example
     42 * var abs = require( '@stdlib/math/special/abs' );
     43 *
     44 * var x = [ 1.0, -1.0, 0.0 ];
     45 *
     46 * var y = abs( x );
     47 * // returns [ 1.0, 1.0, 0.0 ]
     48 *
     49 * @example
     50 * var array = require( '@stdlib/ndarray/array' );
     51 * var abs = require( '@stdlib/math/special/abs' );
     52 *
     53 * var x = array( [ [ 1.0, -2.0 ], [ -3.0, 4.0 ] ] );
     54 * // returns <ndarray>
     55 *
     56 * var y = abs( x );
     57 * // returns <ndarray>
     58 *
     59 * var v = y.get( 0, 1 );
     60 * // 2.0
     61 */
     62 
     63 // MODULES //
     64 
     65 var join = require( 'path' ).join;
     66 var tryRequire = require( '@stdlib/utils/try-require' );
     67 var main = require( './main.js' );
     68 
     69 
     70 // MAIN //
     71 
     72 var tmp = tryRequire( join( __dirname, './native.js' ) );
     73 if ( !(tmp instanceof Error) ) {
     74 	main = tmp;
     75 }
     76 
     77 
     78 // EXPORTS //
     79 
     80 module.exports = main;