diff --git a/blas/ext/base/sdsapxsumpw/coverage.ndjson b/blas/ext/base/sdsapxsumpw/coverage.ndjson new file mode 100644 index 0000000000..627c1f2ecb --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/coverage.ndjson @@ -0,0 +1 @@ +[462,473,97.6744,34,34,100,2,4,50,462,473,97.6744,"079d6397cd66bcc13c4a83ba609796f94fe8f0ff","2024-03-21 21:30:24 -0400"] diff --git a/blas/ext/base/sdsapxsumpw/index.html b/blas/ext/base/sdsapxsumpw/index.html new file mode 100644 index 0000000000..a1bf930cab --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/index.html @@ -0,0 +1,206 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib + + + + + + + + + +
+
+

All files blas/ext/base/sdsapxsumpw/lib

+
+ +
+ 97.67% + Statements + 462/473 +
+ + +
+ 100% + Branches + 34/34 +
+ + +
+ 50% + Functions + 2/4 +
+ + +
+ 97.67% + Lines + 462/473 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
index.js +
+
100%69/69100%3/3100%0/0100%69/69
main.js +
+
100%35/35100%1/1100%0/0100%35/35
native.js +
+
100%35/35100%1/1100%0/0100%35/35
ndarray.js +
+
100%135/135100%14/14100%1/1100%135/135
ndarray.native.js +
+
86.66%52/60100%1/10%0/186.66%52/60
sdsapxsumpw.js +
+
100%86/86100%13/13100%1/1100%86/86
sdsapxsumpw.native.js +
+
94.33%50/53100%1/10%0/194.33%50/53
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/index.js.html b/blas/ext/base/sdsapxsumpw/index.js.html new file mode 100644 index 0000000000..05ed9d94e1 --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/index.js.html @@ -0,0 +1,292 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/index.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib index.js

+
+ +
+ 100% + Statements + 69/69 +
+ + +
+ 100% + Branches + 3/3 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 69/69 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +703x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +2x +3x +1x +1x +3x +3x +3x +3x +3x +3x +3x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+/**
+* Add a constant to each single-precision floating-point strided array element and compute the sum using pairwise summation with extended accumulation.
+*
+* @module @stdlib/blas/ext/base/sdsapxsumpw
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+* var sdsapxsumpw = require( '@stdlib/blas/ext/base/sdsapxsumpw' );
+*
+* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
+*
+* var v = sdsapxsumpw( N, 5.0, x, 1 );
+* // returns 16.0
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+* var sdsapxsumpw = require( '@stdlib/blas/ext/base/sdsapxsumpw' );
+*
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
+*
+* var v = sdsapxsumpw.ndarray( 4, 5.0, x, 2, 1 );
+* // returns 25.0
+*/
+ 
+// MODULES //
+ 
+var join = require( 'path' ).join;
+var tryRequire = require( '@stdlib/utils/try-require' );
+var isError = require( '@stdlib/assert/is-error' );
+var main = require( './main.js' );
+ 
+ 
+// MAIN //
+ 
+var sdsapxsumpw;
+var tmp = tryRequire( join( __dirname, './native.js' ) );
+if ( isError( tmp ) ) {
+	sdsapxsumpw = main;
+} else {
+	sdsapxsumpw = tmp;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+// exports: { "ndarray": "sdsapxsumpw.ndarray" }
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/main.js.html b/blas/ext/base/sdsapxsumpw/main.js.html new file mode 100644 index 0000000000..60dffa0013 --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/main.js.html @@ -0,0 +1,190 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/main.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib main.js

+
+ +
+ 100% + Statements + 35/35 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 35/35 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +361x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var sdsapxsumpw = require( './sdsapxsumpw.js' );
+var ndarray = require( './ndarray.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( sdsapxsumpw, 'ndarray', ndarray );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/native.js.html b/blas/ext/base/sdsapxsumpw/native.js.html new file mode 100644 index 0000000000..e4068aa9cd --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/native.js.html @@ -0,0 +1,190 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/native.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib native.js

+
+ +
+ 100% + Statements + 35/35 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 35/35 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +361x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var sdsapxsumpw = require( './sdsapxsumpw.native.js' );
+var ndarray = require( './ndarray.native.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( sdsapxsumpw, 'ndarray', ndarray );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/ndarray.js.html b/blas/ext/base/sdsapxsumpw/ndarray.js.html new file mode 100644 index 0000000000..2770bec225 --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/ndarray.js.html @@ -0,0 +1,490 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/ndarray.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib ndarray.js

+
+ +
+ 100% + Statements + 135/135 +
+ + +
+ 100% + Branches + 14/14 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 135/135 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +1363x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +73x +2x +2x +73x +2x +2x +69x +73x +7x +7x +7x +26x +26x +26x +7x +7x +73x +34x +34x +34x +34x +34x +34x +34x +34x +34x +34x +34x +34x +34x +468x +468x +468x +468x +468x +468x +468x +468x +468x +468x +34x +34x +34x +34x +34x +2x +2x +2x +34x +34x +28x +28x +28x +28x +73x +3x +3x +3x +3x +3x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
+var floor = require( '@stdlib/math/base/special/floor' );
+ 
+ 
+// VARIABLES //
+ 
+// 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`.):
+var BLOCKSIZE = 128;
+ 
+ 
+// MAIN //
+ 
+/**
+* Adds a constant to each single-precision floating-point strided array element and computes the sum using pairwise summation with extended accumulation.
+*
+* ## 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 {Float32Array} x - input array
+* @param {integer} stride - stride length
+* @param {NonNegativeInteger} offset - starting index
+* @returns {number} sum
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
+*
+* var v = sdsapxsumpw( 4, 5.0, x, 2, 1 );
+* // returns 25.0
+*/
+function sdsapxsumpw( N, alpha, x, stride, offset ) {
+	var ix;
+	var s0;
+	var s1;
+	var s2;
+	var s3;
+	var s4;
+	var s5;
+	var s6;
+	var s7;
+	var M;
+	var s;
+	var n;
+	var i;
+ 
+	if ( N <= 0 ) {
+		return 0.0;
+	}
+	if ( N === 1 || stride === 0 ) {
+		return float64ToFloat32( alpha + x[ offset ] );
+	}
+	ix = offset;
+	if ( N < 8 ) {
+		// Use simple summation...
+		s = 0.0;
+		for ( i = 0; i < N; i++ ) {
+			s += alpha + x[ ix ];
+			ix += stride;
+		}
+		return float64ToFloat32( s );
+	}
+	if ( N <= BLOCKSIZE ) {
+		// Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...
+		s0 = alpha + x[ ix ];
+		s1 = alpha + x[ ix+stride ];
+		s2 = alpha + x[ ix+(2*stride) ];
+		s3 = alpha + x[ ix+(3*stride) ];
+		s4 = alpha + x[ ix+(4*stride) ];
+		s5 = alpha + x[ ix+(5*stride) ];
+		s6 = alpha + x[ ix+(6*stride) ];
+		s7 = alpha + x[ ix+(7*stride) ];
+		ix += 8 * stride;
+ 
+		M = N % 8;
+		for ( i = 8; i < N-M; i += 8 ) {
+			s0 += alpha + x[ ix ];
+			s1 += alpha + x[ ix+stride ];
+			s2 += alpha + x[ ix+(2*stride) ];
+			s3 += alpha + x[ ix+(3*stride) ];
+			s4 += alpha + x[ ix+(4*stride) ];
+			s5 += alpha + x[ ix+(5*stride) ];
+			s6 += alpha + x[ ix+(6*stride) ];
+			s7 += alpha + x[ ix+(7*stride) ];
+			ix += 8 * stride;
+		}
+		// Pairwise sum the accumulators:
+		s = ((s0+s1) + (s2+s3)) + ((s4+s5) + (s6+s7));
+ 
+		// Clean-up loop...
+		for ( i; i < N; i++ ) {
+			s += alpha + x[ ix ];
+			ix += stride;
+		}
+		return float64ToFloat32( s );
+	}
+	// Recurse by dividing by two, but avoiding non-multiples of unroll factor...
+	n = floor( N/2 );
+	n -= n % 8;
+	return float64ToFloat32( sdsapxsumpw( n, alpha, x, stride, ix ) + sdsapxsumpw( N-n, alpha, x, stride, ix+(n*stride) ) ); // eslint-disable-line max-len
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/ndarray.native.js.html b/blas/ext/base/sdsapxsumpw/ndarray.native.js.html new file mode 100644 index 0000000000..a0e9539924 --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/ndarray.native.js.html @@ -0,0 +1,265 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/ndarray.native.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib ndarray.native.js

+
+ +
+ 86.66% + Statements + 52/60 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 0% + Functions + 0/1 +
+ + +
+ 86.66% + Lines + 52/60 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +611x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +  +  +  +  +  +  +  +  +1x +1x +1x +1x +1x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
+var offsetView = require( '@stdlib/strided/base/offset-view' );
+var addon = require( './sdsapxsumpw.native.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Adds a constant to each single-precision floating-point strided array element and computes the sum using pairwise summation with extended accumulation.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @param {number} alpha - constant
+* @param {Float32Array} x - input array
+* @param {integer} stride - stride length
+* @param {NonNegativeInteger} offset - starting index
+* @returns {number} sum
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
+*
+* var v = sdsapxsumpw( 4, 5.0, x, 2, 1 );
+* // returns 25.0
+*/
+function sdsapxsumpw( N, alpha, x, stride, offset ) {
+	var view;
+
+	offset = minViewBufferIndex( N, stride, offset );
+	view = offsetView( x, offset );
+
+	return addon( N, alpha, view, stride );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/sdsapxsumpw.js.html b/blas/ext/base/sdsapxsumpw/sdsapxsumpw.js.html new file mode 100644 index 0000000000..43ece4df2c --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/sdsapxsumpw.js.html @@ -0,0 +1,343 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/sdsapxsumpw.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib sdsapxsumpw.js

+
+ +
+ 100% + Statements + 86/86 +
+ + +
+ 100% + Branches + 13/13 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 86/86 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +872x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +14x +14x +14x +14x +14x +14x +2x +2x +14x +2x +2x +14x +2x +14x +8x +8x +14x +7x +7x +7x +26x +26x +26x +7x +7x +3x +14x +2x +2x +2x +2x +2x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
+var sum = require( './ndarray.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Adds a constant to each single-precision floating-point strided array element and computes the sum using pairwise summation with extended accumulation.
+*
+* ## 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 {Float32Array} x - input array
+* @param {integer} stride - stride length
+* @returns {number} sum
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
+*
+* var v = sdsapxsumpw( N, 5.0, x, 1 );
+* // returns 16.0
+*/
+function sdsapxsumpw( N, alpha, x, stride ) {
+	var ix;
+	var s;
+	var i;
+ 
+	if ( N <= 0 ) {
+		return 0.0;
+	}
+	if ( N === 1 || stride === 0 ) {
+		return float64ToFloat32( alpha + x[ 0 ] );
+	}
+	if ( stride < 0 ) {
+		ix = (1-N) * stride;
+	} else {
+		ix = 0;
+	}
+	if ( N < 8 ) {
+		// Use simple summation...
+		s = 0.0;
+		for ( i = 0; i < N; i++ ) {
+			s += alpha + x[ ix ];
+			ix += stride;
+		}
+		return float64ToFloat32( s );
+	}
+	return sum( N, alpha, x, stride, ix );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/sdsapxsumpw/sdsapxsumpw.native.js.html b/blas/ext/base/sdsapxsumpw/sdsapxsumpw.native.js.html new file mode 100644 index 0000000000..4cd055ff25 --- /dev/null +++ b/blas/ext/base/sdsapxsumpw/sdsapxsumpw.native.js.html @@ -0,0 +1,244 @@ + + + + + + Code coverage report for blas/ext/base/sdsapxsumpw/lib/sdsapxsumpw.native.js + + + + + + + + + +
+
+

All files / blas/ext/base/sdsapxsumpw/lib sdsapxsumpw.native.js

+
+ +
+ 94.33% + Statements + 50/53 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 0% + Functions + 0/1 +
+ + +
+ 94.33% + Lines + 50/53 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +543x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +  +  +  +3x +3x +3x +3x +3x + 
/**
+* @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.
+*/
+ 
+'use strict';
+ 
+// MODULES //
+ 
+var addon = require( './../src/addon.node' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Adds a constant to each single-precision floating-point strided array element and computes the sum using pairwise summation with extended accumulation.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @param {number} alpha - constant
+* @param {Float32Array} x - input array
+* @param {integer} stride - stride length
+* @returns {number} sum
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+*
+* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
+*
+* var v = sdsapxsumpw( N, 5.0, x, 1 );
+* // returns 16.0
+*/
+function sdsapxsumpw( N, alpha, x, stride ) {
+	return addon( N, alpha, x, stride );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = sdsapxsumpw;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file