From 67d1aa389eaaf4bb7c97cc35168d1357c5612c57 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Fri, 27 Dec 2024 07:41:26 +0000 Subject: [PATCH] Update artifacts --- stats/base/dvariancetk/coverage.ndjson | 1 + stats/base/dvariancetk/dvariancetk.js.html | 310 ++++++++++++++++++ .../dvariancetk/dvariancetk.native.js.html | 244 ++++++++++++++ stats/base/dvariancetk/index.html | 206 ++++++++++++ stats/base/dvariancetk/index.js.html | 298 +++++++++++++++++ stats/base/dvariancetk/main.js.html | 190 +++++++++++ stats/base/dvariancetk/native.js.html | 190 +++++++++++ stats/base/dvariancetk/ndarray.js.html | 304 +++++++++++++++++ stats/base/dvariancetk/ndarray.native.js.html | 268 +++++++++++++++ 9 files changed, 2011 insertions(+) create mode 100644 stats/base/dvariancetk/coverage.ndjson create mode 100644 stats/base/dvariancetk/dvariancetk.js.html create mode 100644 stats/base/dvariancetk/dvariancetk.native.js.html create mode 100644 stats/base/dvariancetk/index.html create mode 100644 stats/base/dvariancetk/index.js.html create mode 100644 stats/base/dvariancetk/main.js.html create mode 100644 stats/base/dvariancetk/native.js.html create mode 100644 stats/base/dvariancetk/ndarray.js.html create mode 100644 stats/base/dvariancetk/ndarray.native.js.html diff --git a/stats/base/dvariancetk/coverage.ndjson b/stats/base/dvariancetk/coverage.ndjson new file mode 100644 index 000000000..e2a1fd71b --- /dev/null +++ b/stats/base/dvariancetk/coverage.ndjson @@ -0,0 +1 @@ +[403,403,100,33,33,100,4,4,100,403,403,100,"95a9d94ec41e1bdb3d3e4e2f5df99faff8a655e3","2024-12-26 23:38:58 -0800"] diff --git a/stats/base/dvariancetk/dvariancetk.js.html b/stats/base/dvariancetk/dvariancetk.js.html new file mode 100644 index 000000000..ae9ad158d --- /dev/null +++ b/stats/base/dvariancetk/dvariancetk.js.html @@ -0,0 +1,310 @@ + + + + +
++ 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 | 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 +4x +4x +15x +2x +2x +15x +1x +15x +8x +8x +9x +9x +15x +32x +32x +32x +32x +32x +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 textbook algorithm. +* +* @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 = dvariancetk( N, 1, x, 1 ); +* // returns ~4.3333 +*/ +function dvariancetk( N, correction, x, stride ) { + var S2; + var ix; + var S; + var v; + 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; + } + S2 = 0.0; + S = 0.0; + for ( i = 0; i < N; i++ ) { + v = x[ ix ]; + S2 += v * v; + S += v; + ix += stride; + } + return (S2 - ((S/N)*S)) / n; +} + + +// EXPORTS // + +module.exports = dvariancetk; + |
+ 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 textbook algorithm. +* +* @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 = dvariancetk( N, 1, x, 1 ); +* // returns ~4.3333 +*/ +function dvariancetk( N, correction, x, stride ) { + return addon( N, correction, x, stride ); +} + + +// EXPORTS // + +module.exports = dvariancetk; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
dvariancetk.js | +
+
+ |
+ 100% | +75/75 | +100% | +13/13 | +100% | +1/1 | +100% | +75/75 | +
dvariancetk.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% | +73/73 | +100% | +10/10 | +100% | +1/1 | +100% | +73/73 | +
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 textbook algorithm. +* +* @module @stdlib/stats/base/dvariancetk +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dvariancetk = require( '@stdlib/stats/base/dvariancetk' ); +* +* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); +* var N = x.length; +* +* var v = dvariancetk( N, 1, x, 1 ); +* // returns ~4.3333 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var floor = require( '@stdlib/math/base/special/floor' ); +* var dvariancetk = require( '@stdlib/stats/base/dvariancetk' ); +* +* 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 = dvariancetk.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 dvariancetk; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dvariancetk = main; +} else { + dvariancetk = tmp; +} + + +// EXPORTS // + +module.exports = dvariancetk; + +// exports: { "ndarray": "dvariancetk.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 dvariancetk = require( './dvariancetk.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dvariancetk, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dvariancetk; + |
+ 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 dvariancetk = require( './dvariancetk.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( dvariancetk, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dvariancetk; + |
+ 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 | 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 +4x +4x +15x +2x +2x +9x +9x +9x +15x +32x +32x +32x +32x +32x +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 textbook algorithm. +* +* @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 = dvariancetk( N, 1, x, 2, 1 ); +* // returns 6.25 +*/ +function dvariancetk( N, correction, x, stride, offset ) { + var S2; + var ix; + var S; + var v; + var n; + var i; + + n = N - correction; + if ( N <= 0 || n <= 0.0 ) { + return NaN; + } + if ( N === 1 || stride === 0 ) { + return 0.0; + } + ix = offset; + S2 = 0.0; + S = 0.0; + for ( i = 0; i < N; i++ ) { + v = x[ ix ]; + S2 += v * v; + S += v; + ix += stride; + } + return (S2 - ((S/N)*S)) / n; +} + + +// EXPORTS // + +module.exports = dvariancetk; + |
+ 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( './dvariancetk.native.js' ); + + +// MAIN // + +/** +* Computes the variance of a double-precision floating-point strided array using a one-pass textbook algorithm. +* +* @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 = dvariancetk( N, 1, x, 2, 1 ); +* // returns 6.25 +*/ +function dvariancetk( 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 = dvariancetk; + |