time-to-botec

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

evalrational.js (2287B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 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 /*
     20 * This script compiles modules for evaluating polynomial functions. If any polynomial coefficients change, this script should be rerun to update the compiled files.
     21 */
     22 'use strict';
     23 
     24 // MODULES //
     25 
     26 var resolve = require( 'path' ).resolve;
     27 var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
     28 var licenseHeader = require( '@stdlib/_tools/licenses/header' );
     29 var compile = require( './../../../../base/tools/evalrational-compile' );
     30 
     31 
     32 // VARIABLES //
     33 
     34 // Polynomial coefficients ordered in ascending degree...
     35 var P = [
     36 	709811.662581657956893540610814842699825,
     37 	679979.847415722640161734319823103390728,
     38 	293136.785721159725251629480984140341656,
     39 	74887.5403291467179935942448101441897121,
     40 	12555.29058241386295096255111537516768137,
     41 	1443.42992444170669746078056942194198252,
     42 	115.2419459613734722083208906727972935065,
     43 	6.30923920573262762719523981992008976989,
     44 	0.2266840463022436475495508977579735223818,
     45 	0.004826466289237661857584712046231435101741,
     46 	0.4624429436045378766270459638520555557321e-4
     47 ];
     48 var Q = [
     49 	0.0,
     50 	362880.0,
     51 	1026576.0,
     52 	1172700.0,
     53 	723680.0,
     54 	269325.0,
     55 	63273.0,
     56 	9450.0,
     57 	870.0,
     58 	45.0,
     59 	1.0
     60 ];
     61 
     62 // Header to add to output files:
     63 var header = licenseHeader( 'Apache-2.0', 'js', {
     64 	'year': ( new Date() ).getFullYear(),
     65 	'copyright': 'The Stdlib Authors'
     66 });
     67 header += '\n/* This is a generated file. Do not edit directly. */\n';
     68 
     69 
     70 // MAIN //
     71 
     72 /**
     73 * Main execution sequence.
     74 *
     75 * @private
     76 */
     77 function main() {
     78 	var fpath;
     79 	var opts;
     80 	var str;
     81 
     82 	opts = {
     83 		'encoding': 'utf8'
     84 	};
     85 
     86 	fpath = resolve( __dirname, '..', 'lib', 'lanczos_sum_expg_scaled.js' );
     87 	str = header + compile( P, Q );
     88 	writeFileSync( fpath, str, opts );
     89 }
     90 
     91 main();