From 5d8c9427b58e2f12efd18e2af099adad213eb7de Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 29 Dec 2024 04:36:53 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 1 + README.md | 2 +- dist/index.js.map | 2 +- docs/types/index.d.ts | 2 +- include/stdlib/stats/base/dists/weibull/cdf.h | 2 +- lib/main.js | 2 +- lib/native.js | 2 +- src/main.c | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c16da36..de6cdd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@
+- [`d88905f`](https://github.com/stdlib-js/stdlib/commit/d88905fbd9006bf223db7ce4959b46f02cf7d73e) - **docs:** fix parameter descriptions in Weibull distribution packages _(by Philipp Burckhardt)_ - [`b87254d`](https://github.com/stdlib-js/stdlib/commit/b87254d4535a3b90bf3d0068750ed6e9ca5dbc85) - **docs:** fix parameter descriptions in Weibull distribution packages _(by Philipp Burckhardt)_ - [`f9f468e`](https://github.com/stdlib-js/stdlib/commit/f9f468e240d7e5b5d155279e4386b8b606cd8227) - **feat:** add C implementation of `stats/base/dists/weibull/cdf` _(by Vinit Pandit, Philipp Burckhardt)_ diff --git a/README.md b/README.md index be72582..22c0243 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ F(x;\lambda, k) =\begin{cases}1- e^{-(x/\lambda)^k} & x \geq 0 \\ 0 & x<0\end{ca -where `lambda > 0` is the [shape parameter][shape] and `k > 0` is the [scale parameter][scale]. +where `lambda > 0` is the [scale parameter][scale] and `k > 0` is the [shape parameter][shape]. diff --git a/dist/index.js.map b/dist/index.js.map index c68680a..4de91c3 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/main.js", "../lib/factory.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar expm1 = require( '@stdlib/math-base-special-expm1' );\nvar pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`.\n*\n* @param {number} x - input value\n* @param {PositiveNumber} k - shape parameter\n* @param {PositiveNumber} lambda - scale parameter\n* @returns {Probability} evaluated CDF\n*\n* @example\n* var y = cdf( 2.0, 1.0, 1.0 );\n* // returns ~0.865\n*\n* @example\n* var y = cdf( -1.0, 2.0, 2.0 );\n* // returns 0.0\n*\n* @example\n* var y = cdf( +Infinity, 4.0, 2.0 );\n* // returns 1.0\n*\n* @example\n* var y = cdf( -Infinity, 4.0, 2.0 );\n* // returns 0.0\n*\n* @example\n* var y = cdf( NaN, 0.0, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = cdf( 0.0, NaN, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = cdf( 0.0, 0.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = cdf( 2.0, 0.0, -1.0 );\n* // returns NaN\n*/\nfunction cdf( x, k, lambda ) {\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( k ) ||\n\t\tisnan( lambda ) ||\n\t\tk <= 0.0 ||\n\t\tlambda <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x < 0.0 ) {\n\t\treturn 0.0;\n\t}\n\treturn -expm1( -pow( x / lambda, k ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cdf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 constantFunction = require( '@stdlib/utils-constant-function' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar expm1 = require( '@stdlib/math-base-special-expm1' );\nvar pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the cumulative distribution function (CDF) for a Weibull distribution.\n*\n* @param {PositiveNumber} k - shape parameter\n* @param {PositiveNumber} lambda - scale parameter\n* @returns {Function} CDF\n*\n* @example\n* var cdf = factory( 2.0, 10.0 );\n* var y = cdf( 12.0 );\n* // returns ~0.763\n*\n* y = cdf( 8.0 );\n* // returns ~0.473\n*/\nfunction factory( k, lambda ) {\n\tif (\n\t\tisnan( k ) ||\n\t\tisnan( lambda ) ||\n\t\tk <= 0.0 ||\n\t\tlambda <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\treturn cdf;\n\n\t/**\n\t* Evaluates the cumulative distribution function (CDF) for a Weibull distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {Probability} evaluated CDF\n\t*\n\t* @example\n\t* var y = cdf( 2.0 );\n\t* // returns \n\t*/\n\tfunction cdf( x ) {\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x < 0.0 ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn -expm1( -pow( x / lambda, k ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Weibull distribution cumulative distribution function (CDF).\n*\n* @module @stdlib/stats-base-dists-weibull-cdf\n*\n* @example\n* var cdf = require( '@stdlib/stats-base-dists-weibull-cdf' );\n*\n* var y = cdf( 2.0, 1.0, 1.0 );\n* // returns ~0.865\n*\n* var myCDF = cdf.factory( 2.0, 10.0 );\n* y = myCDF( 12.0 );\n* // returns ~0.763\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar expm1 = require( '@stdlib/math-base-special-expm1' );\nvar pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`.\n*\n* @param {number} x - input value\n* @param {PositiveNumber} k - shape parameter\n* @param {PositiveNumber} lambda - scale parameter\n* @returns {Probability} evaluated CDF\n*\n* @example\n* var y = cdf( 2.0, 1.0, 1.0 );\n* // returns ~0.865\n*\n* @example\n* var y = cdf( -1.0, 2.0, 2.0 );\n* // returns 0.0\n*\n* @example\n* var y = cdf( +Infinity, 4.0, 2.0 );\n* // returns 1.0\n*\n* @example\n* var y = cdf( -Infinity, 4.0, 2.0 );\n* // returns 0.0\n*\n* @example\n* var y = cdf( NaN, 0.0, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = cdf( 0.0, NaN, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = cdf( 0.0, 0.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = cdf( 2.0, 0.0, -1.0 );\n* // returns NaN\n*/\nfunction cdf( x, k, lambda ) {\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( k ) ||\n\t\tisnan( lambda ) ||\n\t\tk <= 0.0 ||\n\t\tlambda <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x < 0.0 ) {\n\t\treturn 0.0;\n\t}\n\treturn -expm1( -pow( x / lambda, k ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = cdf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 constantFunction = require( '@stdlib/utils-constant-function' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar expm1 = require( '@stdlib/math-base-special-expm1' );\nvar pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the cumulative distribution function (CDF) for a Weibull distribution.\n*\n* @param {PositiveNumber} k - shape parameter\n* @param {PositiveNumber} lambda - scale parameter\n* @returns {Function} CDF\n*\n* @example\n* var cdf = factory( 2.0, 10.0 );\n* var y = cdf( 12.0 );\n* // returns ~0.763\n*\n* y = cdf( 8.0 );\n* // returns ~0.473\n*/\nfunction factory( k, lambda ) {\n\tif (\n\t\tisnan( k ) ||\n\t\tisnan( lambda ) ||\n\t\tk <= 0.0 ||\n\t\tlambda <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\treturn cdf;\n\n\t/**\n\t* Evaluates the cumulative distribution function (CDF) for a Weibull distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {Probability} evaluated CDF\n\t*\n\t* @example\n\t* var y = cdf( 2.0 );\n\t* // returns \n\t*/\n\tfunction cdf( x ) {\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x < 0.0 ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn -expm1( -pow( x / lambda, k ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Weibull distribution cumulative distribution function (CDF).\n*\n* @module @stdlib/stats-base-dists-weibull-cdf\n*\n* @example\n* var cdf = require( '@stdlib/stats-base-dists-weibull-cdf' );\n*\n* var y = cdf( 2.0, 1.0, 1.0 );\n* // returns ~0.865\n*\n* var myCDF = cdf.factory( 2.0, 10.0 );\n* y = myCDF( 12.0 );\n* // returns ~0.763\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EA6CnD,SAASC,EAAKC,EAAGC,EAAGC,EAAS,CAC5B,OACCN,EAAOI,CAAE,GACTJ,EAAOK,CAAE,GACTL,EAAOM,CAAO,GACdD,GAAK,GACLC,GAAU,EAEH,IAEHF,EAAI,EACD,EAED,CAACH,EAAO,CAACC,EAAKE,EAAIE,EAAQD,CAAE,CAAE,CACtC,CAKAN,EAAO,QAAUI,ICxFjB,IAAAI,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAQ,QAAS,iCAAkC,EACnDC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAoBnD,SAASC,EAASC,EAAGC,EAAS,CAC7B,GACCL,EAAOI,CAAE,GACTJ,EAAOK,CAAO,GACdD,GAAK,GACLC,GAAU,EAEV,OAAON,EAAkB,GAAI,EAE9B,OAAOO,EAaP,SAASA,EAAKC,EAAI,CACjB,OAAKP,EAAOO,CAAE,EACN,IAEHA,EAAI,EACD,EAED,CAACN,EAAO,CAACC,EAAKK,EAAIF,EAAQD,CAAE,CAAE,CACtC,CACD,CAKAN,EAAO,QAAUK,IC3CjB,IAAIK,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD", "names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "expm1", "pow", "cdf", "x", "k", "lambda", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "isnan", "expm1", "pow", "factory", "k", "lambda", "cdf", "x", "setReadOnly", "main", "factory"] } diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 564dc00..08a4014 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -31,7 +31,7 @@ type Unary = ( x: number ) => number; */ interface CDF { /** - * Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`. + * Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`. * * ## Notes * diff --git a/include/stdlib/stats/base/dists/weibull/cdf.h b/include/stdlib/stats/base/dists/weibull/cdf.h index 846a4dc..84feb02 100644 --- a/include/stdlib/stats/base/dists/weibull/cdf.h +++ b/include/stdlib/stats/base/dists/weibull/cdf.h @@ -27,7 +27,7 @@ extern "C" { #endif /** -* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`. +* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`. */ double stdlib_base_dists_weibull_cdf( const double x, const double k, const double lambda ); diff --git a/lib/main.js b/lib/main.js index ecdc4eb..704b32e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -28,7 +28,7 @@ var pow = require( '@stdlib/math-base-special-pow' ); // MAIN // /** -* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`. +* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`. * * @param {number} x - input value * @param {PositiveNumber} k - shape parameter diff --git a/lib/native.js b/lib/native.js index 0f8cac5..d838935 100644 --- a/lib/native.js +++ b/lib/native.js @@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`. +* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`. * * @private * @param {number} x - input value diff --git a/src/main.c b/src/main.c index c5ccc58..4180fce 100644 --- a/src/main.c +++ b/src/main.c @@ -22,7 +22,7 @@ #include "stdlib/math/base/special/pow.h" /** -* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with scale parameter `k` and shape parameter `lambda` at a value `x`. +* Evaluates the cumulative distribution function (CDF) for a Weibull distribution with shape parameter `k` and scale parameter `lambda` at a value `x`. * * @param x input value * @param k shape parameter