From b01acf6f7efb01fc24509ed0395a3a8282ff5bb7 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:07:33 +0000 Subject: [PATCH] Update artifacts --- blas/ext/base/ssumkbn2/coverage.ndjson | 1 + blas/ext/base/ssumkbn2/index.html | 206 +++++++++ blas/ext/base/ssumkbn2/index.js.html | 298 +++++++++++++ blas/ext/base/ssumkbn2/main.js.html | 190 +++++++++ blas/ext/base/ssumkbn2/native.js.html | 190 +++++++++ blas/ext/base/ssumkbn2/ndarray.js.html | 391 +++++++++++++++++ blas/ext/base/ssumkbn2/ndarray.native.js.html | 256 +++++++++++ blas/ext/base/ssumkbn2/ssumkbn2.js.html | 397 ++++++++++++++++++ .../ext/base/ssumkbn2/ssumkbn2.native.js.html | 241 +++++++++++ 9 files changed, 2170 insertions(+) create mode 100644 blas/ext/base/ssumkbn2/coverage.ndjson create mode 100644 blas/ext/base/ssumkbn2/index.html create mode 100644 blas/ext/base/ssumkbn2/index.js.html create mode 100644 blas/ext/base/ssumkbn2/main.js.html create mode 100644 blas/ext/base/ssumkbn2/native.js.html create mode 100644 blas/ext/base/ssumkbn2/ndarray.js.html create mode 100644 blas/ext/base/ssumkbn2/ndarray.native.js.html create mode 100644 blas/ext/base/ssumkbn2/ssumkbn2.js.html create mode 100644 blas/ext/base/ssumkbn2/ssumkbn2.native.js.html diff --git a/blas/ext/base/ssumkbn2/coverage.ndjson b/blas/ext/base/ssumkbn2/coverage.ndjson new file mode 100644 index 0000000000..8329ff1efc --- /dev/null +++ b/blas/ext/base/ssumkbn2/coverage.ndjson @@ -0,0 +1 @@ +[456,456,100,38,38,100,4,4,100,456,456,100,"2fafc7432d42b9935ddf0e7c110af10ba7b5e4bd","2024-03-22 01:05:23 -0700"] diff --git a/blas/ext/base/ssumkbn2/index.html b/blas/ext/base/ssumkbn2/index.html new file mode 100644 index 0000000000..7757e0722b --- /dev/null +++ b/blas/ext/base/ssumkbn2/index.html @@ -0,0 +1,206 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib + + + + + + + + + +
+
+

All files blas/ext/base/ssumkbn2/lib

+
+ +
+ 100% + Statements + 456/456 +
+ + +
+ 100% + Branches + 38/38 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 456/456 +
+ + +
+

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

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
index.js +
+
100%71/71100%3/3100%0/0100%71/71
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%102/102100%13/13100%1/1100%102/102
ndarray.native.js +
+
100%57/57100%2/2100%1/1100%57/57
ssumkbn2.js +
+
100%104/104100%16/16100%1/1100%104/104
ssumkbn2.native.js +
+
100%52/52100%2/2100%1/1100%52/52
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/index.js.html b/blas/ext/base/ssumkbn2/index.js.html new file mode 100644 index 0000000000..7201043cff --- /dev/null +++ b/blas/ext/base/ssumkbn2/index.js.html @@ -0,0 +1,298 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/index.js + + + + + + + + + +
+
+

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

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

+ 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 +723x +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 +1x +3x +2x +2x +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';
+ 
+/**
+* Compute the sum of single-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
+*
+* @module @stdlib/blas/ext/base/ssumkbn2
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+* var ssumkbn2 = require( '@stdlib/blas/ext/base/ssumkbn2' );
+*
+* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
+*
+* var v = ssumkbn2( N, x, 1 );
+* // returns 1.0
+*
+* @example
+* var Float32Array = require( '@stdlib/array/float32' );
+* var floor = require( '@stdlib/math/base/special/floor' );
+* var ssumkbn2 = require( '@stdlib/blas/ext/base/ssumkbn2' );
+*
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
+* var N = floor( x.length / 2 );
+*
+* var v = ssumkbn2.ndarray( N, x, 2, 1 );
+* // returns 5.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 ssumkbn2;
+var tmp = tryRequire( join( __dirname, './native.js' ) );
+if ( isError( tmp ) ) {
+	ssumkbn2 = main;
+} else {
+	ssumkbn2 = tmp;
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+// exports: { "ndarray": "ssumkbn2.ndarray" }
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/main.js.html b/blas/ext/base/ssumkbn2/main.js.html new file mode 100644 index 0000000000..1a55b91760 --- /dev/null +++ b/blas/ext/base/ssumkbn2/main.js.html @@ -0,0 +1,190 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/main.js + + + + + + + + + +
+
+

All files / blas/ext/base/ssumkbn2/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 ssumkbn2 = require( './ssumkbn2.js' );
+var ndarray = require( './ndarray.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( ssumkbn2, 'ndarray', ndarray );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/native.js.html b/blas/ext/base/ssumkbn2/native.js.html new file mode 100644 index 0000000000..5267fbf3b3 --- /dev/null +++ b/blas/ext/base/ssumkbn2/native.js.html @@ -0,0 +1,190 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/native.js + + + + + + + + + +
+
+

All files / blas/ext/base/ssumkbn2/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 ssumkbn2 = require( './ssumkbn2.native.js' );
+var ndarray = require( './ndarray.native.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( ssumkbn2, 'ndarray', ndarray );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/ndarray.js.html b/blas/ext/base/ssumkbn2/ndarray.js.html new file mode 100644 index 0000000000..2c1a70afdd --- /dev/null +++ b/blas/ext/base/ssumkbn2/ndarray.js.html @@ -0,0 +1,391 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/ndarray.js + + + + + + + + + +
+
+

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

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

+ 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 +1032x +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 +2x +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +2x +2x +12x +2x +2x +8x +8x +8x +8x +12x +35x +35x +35x +13x +35x +22x +22x +35x +35x +35x +32x +35x +3x +3x +35x +35x +35x +35x +8x +12x +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 abs = require( '@stdlib/math/base/special/abs' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Computes the sum of single-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
+*
+* ## Method
+*
+* -   This implementation uses a second-order iterative Kahan–Babuška algorithm, as described by Klein (2005).
+*
+* ## References
+*
+* -   Klein, Andreas. 2005. "A Generalized Kahan-Babuška-Summation-Algorithm." _Computing_ 76 (3): 279–93. doi:[10.1007/s00607-005-0139-x](https://doi.org/10.1007/s00607-005-0139-x).
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @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 floor = require( '@stdlib/math/base/special/floor' );
+*
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
+* var N = floor( x.length / 2 );
+*
+* var v = ssumkbn2( N, x, 2, 1 );
+* // returns 5.0
+*/
+function ssumkbn2( N, x, stride, offset ) {
+	var sum;
+	var ccs;
+	var ix;
+	var cs;
+	var cc;
+	var v;
+	var t;
+	var c;
+	var i;
+ 
+	if ( N <= 0 ) {
+		return 0.0;
+	}
+	if ( N === 1 || stride === 0 ) {
+		return x[ offset ];
+	}
+	ix = offset;
+	sum = 0.0;
+	ccs = 0.0; // second order correction term for lost low order bits
+	cs = 0.0; // first order correction term for lost low order bits
+	for ( i = 0; i < N; i++ ) {
+		v = x[ ix ];
+		t = float64ToFloat32( sum+v );
+		if ( abs( sum ) >= abs( v ) ) {
+			c = float64ToFloat32( float64ToFloat32( sum-t ) + v );
+		} else {
+			c = float64ToFloat32( float64ToFloat32( v-t ) + sum );
+		}
+		sum = t;
+		t = float64ToFloat32( cs+c );
+		if ( abs( cs ) >= abs( c ) ) {
+			cc = float64ToFloat32( float64ToFloat32( cs-t ) + c );
+		} else {
+			cc = float64ToFloat32( float64ToFloat32( c-t ) + cs );
+		}
+		cs = t;
+		ccs = float64ToFloat32( ccs+cc );
+		ix += stride;
+	}
+	return float64ToFloat32( sum + float64ToFloat32( cs+ccs ) );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/ndarray.native.js.html b/blas/ext/base/ssumkbn2/ndarray.native.js.html new file mode 100644 index 0000000000..48a09d7649 --- /dev/null +++ b/blas/ext/base/ssumkbn2/ndarray.native.js.html @@ -0,0 +1,256 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/ndarray.native.js + + + + + + + + + +
+
+

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

+
+ +
+ 100% + Statements + 57/57 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 57/57 +
+ + +
+

+ 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 +582x +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 +12x +12x +12x +12x +12x +12x +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 minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
+var offsetView = require( '@stdlib/strided/base/offset-view' );
+var addon = require( './ssumkbn2.native.js' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Computes the sum of single-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @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 = ssumkbn( 4, x, 2, 1 );
+* // returns 5.0
+*/
+function ssumkbn2( N, x, stride, offset ) {
+	var view;
+	offset = minViewBufferIndex( N, stride, offset );
+	view = offsetView( x, offset );
+	return addon( N, view, stride );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/ssumkbn2.js.html b/blas/ext/base/ssumkbn2/ssumkbn2.js.html new file mode 100644 index 0000000000..ccbeaa28e3 --- /dev/null +++ b/blas/ext/base/ssumkbn2/ssumkbn2.js.html @@ -0,0 +1,397 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/ssumkbn2.js + + + + + + + + + +
+
+

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

+
+ +
+ 100% + Statements + 104/104 +
+ + +
+ 100% + Branches + 16/16 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 104/104 +
+ + +
+

+ 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 +1052x +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 +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +12x +2x +2x +12x +2x +2x +12x +1x +12x +7x +7x +8x +8x +8x +12x +35x +35x +35x +13x +35x +22x +22x +35x +35x +35x +32x +35x +3x +3x +35x +35x +35x +35x +8x +12x +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 abs = require( '@stdlib/math/base/special/abs' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Computes the sum of single-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
+*
+* ## Method
+*
+* -   This implementation uses a second-order iterative Kahan–Babuška algorithm, as described by Klein (2005).
+*
+* ## References
+*
+* -   Klein, Andreas. 2005. "A Generalized Kahan-Babuška-Summation-Algorithm." _Computing_ 76 (3): 279–93. doi:[10.1007/s00607-005-0139-x](https://doi.org/10.1007/s00607-005-0139-x).
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @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 = ssumkbn2( N, x, 1 );
+* // returns 1.0
+*/
+function ssumkbn2( N, x, stride ) {
+	var sum;
+	var ccs;
+	var ix;
+	var cs;
+	var cc;
+	var v;
+	var t;
+	var c;
+	var i;
+ 
+	if ( N <= 0 ) {
+		return 0.0;
+	}
+	if ( N === 1 || stride === 0 ) {
+		return x[ 0 ];
+	}
+	if ( stride < 0 ) {
+		ix = (1-N) * stride;
+	} else {
+		ix = 0;
+	}
+	sum = 0.0;
+	ccs = 0.0; // second order correction term for lost low order bits
+	cs = 0.0; // first order correction term for lost low order bits
+	for ( i = 0; i < N; i++ ) {
+		v = x[ ix ];
+		t = float64ToFloat32( sum+v );
+		if ( abs( sum ) >= abs( v ) ) {
+			c = float64ToFloat32( float64ToFloat32( sum-t ) + v );
+		} else {
+			c = float64ToFloat32( float64ToFloat32( v-t ) + sum );
+		}
+		sum = t;
+		t = float64ToFloat32( cs+c );
+		if ( abs( cs ) >= abs( c ) ) {
+			cc = float64ToFloat32( float64ToFloat32( cs-t ) + c );
+		} else {
+			cc = float64ToFloat32( float64ToFloat32( c-t ) + cs );
+		}
+		cs = t;
+		ccs = float64ToFloat32( ccs+cc );
+		ix += stride;
+	}
+	return float64ToFloat32( sum + float64ToFloat32( cs+ccs ) );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/blas/ext/base/ssumkbn2/ssumkbn2.native.js.html b/blas/ext/base/ssumkbn2/ssumkbn2.native.js.html new file mode 100644 index 0000000000..a4ae163112 --- /dev/null +++ b/blas/ext/base/ssumkbn2/ssumkbn2.native.js.html @@ -0,0 +1,241 @@ + + + + + + Code coverage report for blas/ext/base/ssumkbn2/lib/ssumkbn2.native.js + + + + + + + + + +
+
+

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

+
+ +
+ 100% + Statements + 52/52 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 52/52 +
+ + +
+

+ 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 +533x +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 +49x +49x +49x +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 //
+ 
+/**
+* Computes the sum of single-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @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 = ssumkbn2( N, x, 1 );
+* // returns 1.0
+*/
+function ssumkbn2( N, x, stride ) {
+	return addon( N, x, stride );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = ssumkbn2;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file