From d47c057f29ecd6c5e9d5030758e31020fee960c5 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 27 Dec 2024 08:02:42 +0000 Subject: [PATCH] Update artifacts --- stats/base/dvarianceyc/coverage.ndjson | 1 + stats/base/dvarianceyc/dvarianceyc.js.html | 343 ++++++++++++++++++ .../dvarianceyc/dvarianceyc.native.js.html | 244 +++++++++++++ stats/base/dvarianceyc/index.html | 206 +++++++++++ stats/base/dvarianceyc/index.js.html | 298 +++++++++++++++ stats/base/dvarianceyc/main.js.html | 190 ++++++++++ stats/base/dvarianceyc/native.js.html | 190 ++++++++++ stats/base/dvarianceyc/ndarray.js.html | 334 +++++++++++++++++ stats/base/dvarianceyc/ndarray.native.js.html | 268 ++++++++++++++ 9 files changed, 2074 insertions(+) create mode 100644 stats/base/dvarianceyc/coverage.ndjson create mode 100644 stats/base/dvarianceyc/dvarianceyc.js.html create mode 100644 stats/base/dvarianceyc/dvarianceyc.native.js.html create mode 100644 stats/base/dvarianceyc/index.html create mode 100644 stats/base/dvarianceyc/index.js.html create mode 100644 stats/base/dvarianceyc/main.js.html create mode 100644 stats/base/dvarianceyc/native.js.html create mode 100644 stats/base/dvarianceyc/ndarray.js.html create mode 100644 stats/base/dvarianceyc/ndarray.native.js.html diff --git a/stats/base/dvarianceyc/coverage.ndjson b/stats/base/dvarianceyc/coverage.ndjson new file mode 100644 index 000000000..c57d1f271 --- /dev/null +++ b/stats/base/dvarianceyc/coverage.ndjson @@ -0,0 +1 @@ +[424,424,100,33,33,100,4,4,100,424,424,100,"3377bfa5fe3d3fb575382d46c0239b607146ab00","2024-12-27 00:00:17 -0800"] diff --git a/stats/base/dvarianceyc/dvarianceyc.js.html b/stats/base/dvarianceyc/dvarianceyc.js.html new file mode 100644 index 000000000..8620511e3 --- /dev/null +++ b/stats/base/dvarianceyc/dvarianceyc.js.html @@ -0,0 +1,343 @@ + + + + +
++ 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 | 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 +15x +15x +15x +15x +15x +15x +15x +15x +15x +15x +15x +4x +4x +15x +2x +2x +15x +1x +15x +8x +8x +9x +9x +9x +15x +23x +23x +23x +23x +23x +23x +9x +15x +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'; + +// MAIN // + +/** +* Computes the variance of a double-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer. +* +* ## Method +* +* - This implementation uses a one-pass algorithm, as proposed by Youngs and Cramer (1971). +* +* ## References +* +* - Youngs, Edward A., and Elliot M. Cramer. 1971. "Some Results Relevant to Choice of Sum and Sum-of-Product Algorithms." _Technometrics_ 13 (3): 657–65. doi:[10.1080/00401706.1971.10488826](https://doi.org/10.1080/00401706.1971.10488826). +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} correction - degrees of freedom adjustment +* @param {Float64Array} x - input array +* @param {integer} stride - stride length +* @returns {number} variance +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); +* var N = x.length; +* +* var v = dvarianceyc( N, 1, x, 1 ); +* // returns ~4.3333 +*/ +function dvarianceyc( N, correction, x, stride ) { + var sum; + var ix; + var S; + var v; + var d; + var n; + var i; + + n = N - correction; + if ( N <= 0 || n <= 0.0 ) { + return NaN; + } + if ( N === 1 || stride === 0 ) { + return 0.0; + } + if ( stride < 0 ) { + ix = (1-N) * stride; + } else { + ix = 0; + } + sum = x[ ix ]; + ix += stride; + S = 0.0; + for ( i = 2; i <= N; i++ ) { + v = x[ ix ]; + sum += v; + d = (i*v) - sum; + S += (1.0/(i*(i-1))) * d * d; + ix += stride; + } + return S / n; +} + + +// EXPORTS // + +module.exports = dvarianceyc; + |
+ 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 | 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 +30x +30x +30x +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 variance of a double-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} correction - degrees of freedom adjustment +* @param {Float64Array} x - input array +* @param {integer} stride - stride length +* @returns {number} variance +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); +* var N = x.length; +* +* var v = dvarianceyc( N, 1, x, 1 ); +* // returns ~4.3333 +*/ +function dvarianceyc( N, correction, x, stride ) { + return addon( N, correction, x, stride ); +} + + +// EXPORTS // + +module.exports = dvarianceyc; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
dvarianceyc.js | +
+
+ |
+ 100% | +86/86 | +100% | +13/13 | +100% | +1/1 | +100% | +86/86 | +
dvarianceyc.native.js | +
+
+ |
+ 100% | +53/53 | +100% | +2/2 | +100% | +1/1 | +100% | +53/53 | +
index.js | +
+
+ |
+ 100% | +71/71 | +100% | +3/3 | +100% | +0/0 | +100% | +71/71 | +
main.js | +
+
+ |
+ 100% | +35/35 | +100% | +1/1 | +100% | +0/0 | +100% | +35/35 | +
native.js | +
+
+ |
+ 100% | +35/35 | +100% | +1/1 | +100% | +0/0 | +100% | +35/35 | +
ndarray.js | +
+
+ |
+ 100% | +83/83 | +100% | +10/10 | +100% | +1/1 | +100% | +83/83 | +
ndarray.native.js | +
+
+ |
+ 100% | +61/61 | +100% | +3/3 | +100% | +1/1 | +100% | +61/61 | +
+ 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 | 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 +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 variance of a double-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer. +* +* @module @stdlib/stats/base/dvarianceyc +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dvarianceyc = require( '@stdlib/stats/base/dvarianceyc' ); +* +* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); +* var N = x.length; +* +* var v = dvarianceyc( N, 1, x, 1 ); +* // returns ~4.3333 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var floor = require( '@stdlib/math/base/special/floor' ); +* var dvarianceyc = require( '@stdlib/stats/base/dvarianceyc' ); +* +* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); +* var N = floor( x.length / 2 ); +* +* var v = dvarianceyc.ndarray( N, 1, x, 2, 1 ); +* // returns 6.25 +*/ + +// 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 dvarianceyc; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dvarianceyc = main; +} else { + dvarianceyc = tmp; +} + + +// EXPORTS // + +module.exports = dvarianceyc; + +// exports: { "ndarray": "dvarianceyc.ndarray" } + |
+ 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 | 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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dvarianceyc = require( './dvarianceyc.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dvarianceyc, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dvarianceyc; + |
+ 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 | 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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dvarianceyc = require( './dvarianceyc.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( dvarianceyc, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dvarianceyc; + |
+ 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 | 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 +15x +15x +15x +15x +15x +15x +15x +15x +15x +15x +15x +4x +4x +15x +2x +2x +9x +9x +9x +15x +23x +23x +23x +23x +23x +23x +9x +15x +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'; + +// MAIN // + +/** +* Computes the variance of a double-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer. +* +* ## Method +* +* - This implementation uses a one-pass algorithm, as proposed by Youngs and Cramer (1971). +* +* ## References +* +* - Youngs, Edward A., and Elliot M. Cramer. 1971. "Some Results Relevant to Choice of Sum and Sum-of-Product Algorithms." _Technometrics_ 13 (3): 657–65. doi:[10.1080/00401706.1971.10488826](https://doi.org/10.1080/00401706.1971.10488826). +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} correction - degrees of freedom adjustment +* @param {Float64Array} x - input array +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - starting index +* @returns {number} variance +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var floor = require( '@stdlib/math/base/special/floor' ); +* +* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); +* var N = floor( x.length / 2 ); +* +* var v = dvarianceyc( N, 1, x, 2, 1 ); +* // returns 6.25 +*/ +function dvarianceyc( N, correction, x, stride, offset ) { + var sum; + var ix; + var S; + var v; + var d; + var n; + var i; + + n = N - correction; + if ( N <= 0 || n <= 0.0 ) { + return NaN; + } + if ( N === 1 || stride === 0 ) { + return 0.0; + } + sum = x[ offset ]; + ix = offset + stride; + S = 0.0; + for ( i = 2; i <= N; i++ ) { + v = x[ ix ]; + sum += v; + d = (i*v) - sum; + S += (1.0/(i*(i-1))) * d * d; + ix += stride; + } + return S / n; +} + + +// EXPORTS // + +module.exports = dvarianceyc; + |
+ 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 | 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 +15x +15x +15x +1x +1x +15x +15x +15x +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 Float64Array = require( '@stdlib/array/float64' ); +var addon = require( './dvarianceyc.native.js' ); + + +// MAIN // + +/** +* Computes the variance of a double-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} correction - degrees of freedom adjustment +* @param {Float64Array} x - input array +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - starting index +* @returns {number} variance +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var floor = require( '@stdlib/math/base/special/floor' ); +* +* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); +* var N = floor( x.length / 2 ); +* +* var v = dvarianceyc( N, 1, x, 2, 1 ); +* // returns 6.25 +*/ +function dvarianceyc( N, correction, x, stride, offset ) { + var view; + if ( stride < 0 ) { + offset += (N-1) * stride; + } + view = new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len + return addon( N, correction, view, stride ); +} + + +// EXPORTS // + +module.exports = dvarianceyc; + |