/* WEBPACK VAR INJECTION */

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2020 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Add a constant to each strided array element and compute the sum using pairwise summation.
*
* @module @stdlib/blas/ext/base/gapxsumpw
*
* @example
* var gapxsumpw = require( '@stdlib/blas/ext/base/gapxsumpw' );
*
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = gapxsumpw( N, 5.0, x, 1 );
* // returns 16.0
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
* var gapxsumpw = require( '@stdlib/blas/ext/base/gapxsumpw' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = gapxsumpw.ndarray( N, 5.0, x, 2, 1 );
* // returns 25.0
*/

/**
* Adds a constant to each strided array element and computes the sum using pairwise summation.
*
* ## Method
*
* -   This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
*
* ## References
*
* -   Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {number} alpha - constant
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @param {NonNegativeInteger} offset - starting index
* @returns {number} sum
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = gapxsumpw( N, 5.0, x, 2, 1 );
* // returns 25.0
*/

/**
* Adds a constant to each strided array element and computes the sum using pairwise summation.
*
* ## Method
*
* -   This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
*
* ## References
*
* -   Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {number} alpha - constant
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @returns {number} sum
*
* @example
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = gapxsumpw( N, 5.0, x, 1 );
* // returns 16.0
*/

/**
* Compute the arithmetic mean of a strided array using a two-pass error correction algorithm.
*
* @module @stdlib/stats/base/meanpn
*
* @example
* var meanpn = require( '@stdlib/stats/base/meanpn' );
*
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = meanpn( N, x, 1 );
* // returns ~0.3333
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
* var meanpn = require( '@stdlib/stats/base/meanpn' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = meanpn.ndarray( N, x, 2, 1 );
* // returns 1.25
*/

/**
* Compute the arithmetic mean of a strided array.
*
* @module @stdlib/stats/base/mean
*
* @example
* var mean = require( '@stdlib/stats/base/mean' );
*
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = mean( N, x, 1 );
* // returns ~0.3333
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
* var mean = require( '@stdlib/stats/base/mean' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = mean.ndarray( N, x, 2, 1 );
* // returns 1.25
*/

/**
* Compute the sum of strided array elements using pairwise summation.
*
* @module @stdlib/blas/ext/base/gsumpw
*
* @example
* var gsumpw = require( '@stdlib/blas/ext/base/gsumpw' );
*
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = gsumpw( N, x, 1 );
* // returns 1.0
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
* var gsumpw = require( '@stdlib/blas/ext/base/gsumpw' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = gsumpw.ndarray( N, x, 2, 1 );
* // returns 5.0
*/

/**
* Computes the arithmetic mean of a strided array using a two-pass error correction algorithm.
*
* ## Method
*
* -   This implementation uses a two-pass approach, as suggested by Neely (1966).
*
* ## References
*
* -   Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958).
* -   Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @param {NonNegativeInteger} offset - starting index
* @returns {number} arithmetic mean
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = meanpn( N, x, 2, 1 );
* // returns 1.25
*/

/**
* Computes the arithmetic mean of a strided array using a two-pass error correction algorithm.
*
* ## Method
*
* -   This implementation uses a two-pass approach, as suggested by Neely (1966).
*
* ## References
*
* -   Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958).
* -   Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @returns {number} arithmetic mean
*
* @example
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = meanpn( N, x, 1 );
* // returns ~0.3333
*/

/**
* Computes the arithmetic mean of a strided array.
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @param {NonNegativeInteger} offset - starting index
* @returns {number} arithmetic mean
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = mean( N, x, 2, 1 );
* // returns 1.25
*/

/**
* Computes the arithmetic mean of a strided array.
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @returns {number} arithmetic mean
*
* @example
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = mean( N, x, 1 );
* // returns ~0.3333
*/

/**
* Computes the sum of strided array elements using pairwise summation.
*
* ## Method
*
* -   This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
*
* ## References
*
* -   Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @param {NonNegativeInteger} offset - starting index
* @returns {number} sum
*
* @example
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
* var N = floor( x.length / 2 );
*
* var v = gsumpw( N, x, 2, 1 );
* // returns 5.0
*/

/**
* Computes the sum of strided array elements using pairwise summation.
*
* ## Method
*
* -   This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
*
* ## References
*
* -   Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
*
* @param {PositiveInteger} N - number of indexed elements
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @returns {number} sum
*
* @example
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = gsumpw( N, x, 1 );
* // returns 1.0
*/

/**
* Wrap `require` in a try/catch block.
*
* @module @stdlib/utils/try-require
*
* @example
* var tryRequire = require( '@stdlib/utils/try-require' );
*
* var out = tryRequire( 'beepboop' );
*
* if ( out instanceof Error ) {
*     console.log( out.message );
* }
*/

/**
* Wraps `require` in a try/catch block.
*
* @param {string} id - module id
* @returns {*|Error} `module.exports` of the resolved module or an error
*
* @example
* var out = tryRequire( 'beepboop' );
*
* if ( out instanceof Error ) {
*     console.error( out.message );
* }
*/

/***/

/*.*/

/*/*/

//

// "Software"), to deal in the Software without restriction, including

// (so also no leading and trailing slashes - it does not distinguish

// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,

// At this point the path should be resolved to a full absolute path, but

// Blocksize for pairwise summation (NOTE: decreasing the blocksize decreases rounding error as more pairs are summed, but also decreases performance. Because the inner loop is unrolled eight times, the blocksize is effectively `16`.):

// Clean-up loop...

// Compute an estimate for the meanpn:

// Copyright Joyent, Inc. and other Node contributors.

// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR

// EXPORTS //

// Handle case where a literal is thrown...

// If this is our first dot, mark it as the start of our extension

// If we reached a path separator that was not part of a set of path

// MAIN //

// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN

// MODULES //

// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

// Normalize the path

// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE

// Pairwise sum the accumulators:

// Permission is hereby granted, free of charge, to any person obtaining a

// Recurse by dividing by two, but avoiding non-multiples of unroll factor...

// Skip empty and invalid entries

// String.prototype.substr - negative index don't work in IE8

// Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS

// The (right-most) trimmed path component is exactly '..'

// The above copyright notice and this permission notice shall be included

// USE OR OTHER DEALINGS IN THE SOFTWARE.

// Use simple summation...

// Uses a mixed approach for backwards-compatibility, as ext behavior changed

// VARIABLES //

// We saw a non-dot and non-path separator before our dot, so we should

// We saw a non-dot character immediately before the dot

// We saw the first non-path separator

// We saw the first non-path separator, mark this as the end of our

// backported and transplited with Babel, with backwards-compat fixes

// copy of this software and associated documentation files (the

// distribute, sublicense, and/or sell copies of the Software, and to permit

// eslint-disable-line max-len

// eslint-disable-line stdlib/no-dynamic-require

// extension

// following conditions:

// handle relative paths to be safe (might happen when process.cwd() fails)

// have a good chance at having a non-empty extension

// if the path is allowed to go above the root, restore leading ..s

// if the path tries to go above the root, `up` ends up > 0

// in all copies or substantial portions of the Software.

// in new Node.js versions, so only basename() above is backported here

// must be no slashes, empty elements, or device names (c:\) in the array

// path component

// path.normalize(path)

// path.relative(from, to)

// path.resolve([from ...], to)

// persons to whom the Software is furnished to do so, subject to the

// posix version

// relative and absolute paths)

// resolves . and .. elements in a path array with directory names there

// separators at the end of the string, stop now

// without limitation the rights to use, copy, modify, merge, publish,
