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 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib/dvarianceyc.js + + + + + + + + + +
+
+

All files / stats/base/dvarianceyc/lib dvarianceyc.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 +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;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dvarianceyc/dvarianceyc.native.js.html b/stats/base/dvarianceyc/dvarianceyc.native.js.html new file mode 100644 index 000000000..cc8f7b560 --- /dev/null +++ b/stats/base/dvarianceyc/dvarianceyc.native.js.html @@ -0,0 +1,244 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib/dvarianceyc.native.js + + + + + + + + + +
+
+

All files / stats/base/dvarianceyc/lib dvarianceyc.native.js

+
+ +
+ 100% + Statements + 53/53 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 53/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 +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;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dvarianceyc/index.html b/stats/base/dvarianceyc/index.html new file mode 100644 index 000000000..3d3453c25 --- /dev/null +++ b/stats/base/dvarianceyc/index.html @@ -0,0 +1,206 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib + + + + + + + + + +
+
+

All files stats/base/dvarianceyc/lib

+
+ +
+ 100% + Statements + 424/424 +
+ + +
+ 100% + Branches + 33/33 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 424/424 +
+ + +
+

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

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
dvarianceyc.js +
+
100%86/86100%13/13100%1/1100%86/86
dvarianceyc.native.js +
+
100%53/53100%2/2100%1/1100%53/53
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%83/83100%10/10100%1/1100%83/83
ndarray.native.js +
+
100%61/61100%3/3100%1/1100%61/61
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dvarianceyc/index.js.html b/stats/base/dvarianceyc/index.js.html new file mode 100644 index 000000000..a80ef8bfb --- /dev/null +++ b/stats/base/dvarianceyc/index.js.html @@ -0,0 +1,298 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib/index.js + + + + + + + + + +
+
+

All files / stats/base/dvarianceyc/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 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" }
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dvarianceyc/main.js.html b/stats/base/dvarianceyc/main.js.html new file mode 100644 index 000000000..624cc5790 --- /dev/null +++ b/stats/base/dvarianceyc/main.js.html @@ -0,0 +1,190 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib/main.js + + + + + + + + + +
+
+

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

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

All files / stats/base/dvarianceyc/lib ndarray.js

+
+ +
+ 100% + Statements + 83/83 +
+ + +
+ 100% + Branches + 10/10 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 83/83 +
+ + +
+

+ 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 +842x +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;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dvarianceyc/ndarray.native.js.html b/stats/base/dvarianceyc/ndarray.native.js.html new file mode 100644 index 000000000..4936800b7 --- /dev/null +++ b/stats/base/dvarianceyc/ndarray.native.js.html @@ -0,0 +1,268 @@ + + + + + + Code coverage report for stats/base/dvarianceyc/lib/ndarray.native.js + + + + + + + + + +
+
+

All files / stats/base/dvarianceyc/lib ndarray.native.js

+
+ +
+ 100% + Statements + 61/61 +
+ + +
+ 100% + Branches + 3/3 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 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 +622x +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;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file