diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f33a8a1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T00:40:08.996Z diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index 334eb59..91f2b93 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -82,21 +82,6 @@ jobs: id: transform-error-messages uses: stdlib-js/transform-errors-action@main - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - name: 'Update dependencies in package.json' run: | diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..56f3e4d --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import nanvariancewd from '../docs/types/index'; +export = nanvariancewd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..468dbf2 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,9 @@ +"use strict";var l=function(a,e){return function(){return e||a((e={exports:{}}).exports,e),e.exports}};var q=l(function(j,p){ +function M(a,e,N,f){var c,v,i,u,s,n,r,t;if(a<=0)return NaN;if(a===1||f===0)return n=N[0],n===n&&a-e>0?0:NaN;for(f<0?u=(1-a)*f:u=0,i=0,v=0,r=0,t=0;t0?0:NaN;for(s=c,u=0,i=0,t=0,d=0;d 0.0 ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn NaN;\n\t}\n\tif ( stride < 0 ) {\n\t\tix = (1-N) * stride;\n\t} else {\n\t\tix = 0;\n\t}\n\tM2 = 0.0;\n\tmu = 0.0;\n\tn = 0;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tv = x[ ix ];\n\t\tif ( v === v ) {\n\t\t\tdelta = v - mu;\n\t\t\tn += 1;\n\t\t\tmu += delta / n;\n\t\t\tM2 += delta * ( v - mu );\n\t\t}\n\t\tix += stride;\n\t}\n\tnc = n - correction;\n\tif ( nc <= 0.0 ) {\n\t\treturn NaN;\n\t}\n\treturn M2 / nc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nanvariancewd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Computes the variance of a strided array ignoring `NaN` values and using Welford's algorithm.\n*\n* ## References\n*\n* - Welford, B. P. 1962. \"Note on a Method for Calculating Corrected Sums of Squares and Products.\" _Technometrics_ 4 (3). Taylor & Francis: 419\u201320. doi:[10.1080/00401706.1962.10490022](https://doi.org/10.1080/00401706.1962.10490022).\n* - van Reeken, A. J. 1968. \"Letters to the Editor: Dealing with Neely's Algorithms.\" _Communications of the ACM_ 11 (3): 149\u201350. doi:[10.1145/362929.362961](https://doi.org/10.1145/362929.362961).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} correction - degrees of freedom adjustment\n* @param {NumericArray} x - input array\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @returns {number} variance\n*\n* @example\n* var floor = require( '@stdlib/math-base-special-floor' );\n*\n* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ];\n* var N = floor( x.length / 2 );\n*\n* var v = nanvariancewd( N, 1, x, 2, 1 );\n* // returns 6.25\n*/\nfunction nanvariancewd( N, correction, x, stride, offset ) {\n\tvar delta;\n\tvar mu;\n\tvar M2;\n\tvar ix;\n\tvar nc;\n\tvar v;\n\tvar n;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn NaN;\n\t}\n\tif ( N === 1 || stride === 0 ) {\n\t\tv = x[ offset ];\n\t\tif ( v === v && N-correction > 0.0 ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn NaN;\n\t}\n\tix = offset;\n\tM2 = 0.0;\n\tmu = 0.0;\n\tn = 0;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tv = x[ ix ];\n\t\tif ( v === v ) {\n\t\t\tdelta = v - mu;\n\t\t\tn += 1;\n\t\t\tmu += delta / n;\n\t\t\tM2 += delta * ( v - mu );\n\t\t}\n\t\tix += stride;\n\t}\n\tnc = n - correction;\n\tif ( nc <= 0.0 ) {\n\t\treturn NaN;\n\t}\n\treturn M2 / nc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nanvariancewd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar nanvariancewd = require( './nanvariancewd.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( nanvariancewd, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = nanvariancewd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compute the variance of a strided array ignoring `NaN` values and using Welford's algorithm.\n*\n* @module @stdlib/stats-base-nanvariancewd\n*\n* @example\n* var nanvariancewd = require( '@stdlib/stats-base-nanvariancewd' );\n*\n* var x = [ 1.0, -2.0, NaN, 2.0 ];\n*\n* var v = nanvariancewd( x.length, 1, x, 1 );\n* // returns ~4.3333\n*\n* @example\n* var floor = require( '@stdlib/math-base-special-floor' );\n* var nanvariancewd = require( '@stdlib/stats-base-nanvariancewd' );\n*\n* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ];\n* var N = floor( x.length / 2 );\n*\n* var v = nanvariancewd.ndarray( N, 1, x, 2, 1 );\n* // returns 6.25\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n\n// exports: { \"ndarray\": \"main.ndarray\" }\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA0CA,SAASC,EAAeC,EAAGC,EAAYC,EAAGC,EAAS,CAClD,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA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C,EAAe,UAAWC,CAAQ,EAK/CH,EAAO,QAAUE,ICYjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", + "names": ["require_nanvariancewd", "__commonJSMin", "exports", "module", "nanvariancewd", "N", "correction", "x", "stride", "delta", "mu", "M2", "ix", "nc", "v", "n", "i", "require_ndarray", "__commonJSMin", "exports", "module", "nanvariancewd", "N", "correction", "x", "stride", "offset", "delta", "mu", "M2", "ix", "nc", "v", "n", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "nanvariancewd", "ndarray", "main"] +} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 59cba76..facdb54 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -// TypeScript Version: 2.0 +// TypeScript Version: 4.1 ///