diff --git a/stats/base/dists/rayleigh/logcdf/coverage.ndjson b/stats/base/dists/rayleigh/logcdf/coverage.ndjson new file mode 100644 index 000000000..383dbc995 --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/coverage.ndjson @@ -0,0 +1 @@ +[302,302,100,31,31,100,4,4,100,302,302,100,"3a05645a2054675503b44dffb2f6817298bc9bd9","2024-12-17 08:58:17 -0500"] diff --git a/stats/base/dists/rayleigh/logcdf/factory.js.html b/stats/base/dists/rayleigh/logcdf/factory.js.html new file mode 100644 index 000000000..129b945b9 --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/factory.js.html @@ -0,0 +1,352 @@ + + + + + + Code coverage report for stats/base/dists/rayleigh/logcdf/lib/factory.js + + + + + + + + + +
+
+

All files / stats/base/dists/rayleigh/logcdf/lib factory.js

+
+ +
+ 100% + Statements + 89/89 +
+ + +
+ 100% + Branches + 14/14 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 89/89 +
+ + +
+

+ 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 +88 +89 +903x +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 +3008x +3008x +3008x +3x +3x +3008x +2x +2x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +3003x +1x +1x +3003x +1x +1x +3001x +3003x +3003x +3008x +3x +3x +3x +3x +3x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 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 constantFunction = require( '@stdlib/utils/constant-function' );
+var degenerate = require( '@stdlib/stats/base/dists/degenerate/logcdf' ).factory;
+var expm1 = require( '@stdlib/math/base/special/expm1' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var log1p = require( '@stdlib/math/base/special/log1p' );
+var exp = require( '@stdlib/math/base/special/exp' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var ln = require( '@stdlib/math/base/special/ln' );
+var LNHALF = require( '@stdlib/constants/float64/ln-half' );
+var NINF = require( '@stdlib/constants/float64/ninf' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Returns a function for evaluating the logarithm of the cumulative distribution function (CDF) for a Rayleigh distribution with scale parameter `sigma`.
+*
+* @param {NonNegativeNumber} sigma - scale parameter
+* @returns {Function} logCDF
+*
+* @example
+* var logcdf = factory( 2.0 );
+* var y = logcdf( 3.0 );
+* // returns ~-0.393
+*
+* y = logcdf( 1.0 );
+* // returns ~-2.141
+*/
+function factory( sigma ) {
+	var s2;
+	if ( isnan( sigma ) || sigma < 0.0 ) {
+		return constantFunction( NaN );
+	}
+	if ( sigma === 0.0 ) {
+		return degenerate( 0.0 );
+	}
+	s2 = pow( sigma, 2.0 );
+	return logcdf;
+ 
+	/**
+	* Evaluates the logarithm of the cumulative distribution function (CDF) for a Rayleigh distribution.
+	*
+	* @private
+	* @param {number} x - input value
+	* @returns {number} evaluated logCDF
+	*
+	* @example
+	* var y = logcdf( 2 );
+	* // returns <number>
+	*/
+	function logcdf( x ) {
+		var p;
+		if ( isnan( x ) ) {
+			return NaN;
+		}
+		if ( x < 0.0 ) {
+			return NINF;
+		}
+		p = -pow( x, 2.0 ) / ( 2.0 * s2 );
+		return ( p < LNHALF ) ? log1p( -exp( p ) ) : ln( -expm1( p ) );
+	}
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = factory;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/rayleigh/logcdf/index.html b/stats/base/dists/rayleigh/logcdf/index.html new file mode 100644 index 000000000..a48a17960 --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/index.html @@ -0,0 +1,161 @@ + + + + + + Code coverage report for stats/base/dists/rayleigh/logcdf/lib + + + + + + + + + +
+
+

All files stats/base/dists/rayleigh/logcdf/lib

+
+ +
+ 100% + Statements + 302/302 +
+ + +
+ 100% + Branches + 31/31 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 302/302 +
+ + +
+

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

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
factory.js +
+
100%89/89100%14/14100%2/2100%89/89
index.js +
+
100%54/54100%1/1100%0/0100%54/54
main.js +
+
100%91/91100%14/14100%1/1100%91/91
native.js +
+
100%68/68100%2/2100%1/1100%68/68
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/rayleigh/logcdf/index.js.html b/stats/base/dists/rayleigh/logcdf/index.js.html new file mode 100644 index 000000000..134b6a6fc --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/index.js.html @@ -0,0 +1,247 @@ + + + + + + Code coverage report for stats/base/dists/rayleigh/logcdf/lib/index.js + + + + + + + + + +
+
+

All files / stats/base/dists/rayleigh/logcdf/lib index.js

+
+ +
+ 100% + Statements + 54/54 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 0/0 +
+ + +
+ 100% + Lines + 54/54 +
+ + +
+

+ 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 +552x +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 +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 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';
+ 
+/**
+* Rayleigh distribution logarithm of cumulative distribution function (CDF).
+*
+* @module @stdlib/stats/base/dists/rayleigh/logcdf
+*
+* @example
+* var logcdf = require( '@stdlib/stats/base/dists/rayleigh/logcdf' );
+*
+* var y = logcdf( 2.0, 5.0 );
+* // returns ~-2.564
+*
+* var mylogcdf = logcdf.factory( 0.5 );
+* y = mylogcdf( 1.0 );
+* // returns ~-0.145
+*
+* y = mylogcdf( 0.5 );
+* // returns ~-0.934
+*/
+ 
+// MODULES //
+ 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var factory = require( './factory.js' );
+ 
+ 
+// MAIN //
+ 
+setReadOnly( main, 'factory', factory );
+ 
+ 
+// EXPORTS //
+ 
+module.exports = main;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/rayleigh/logcdf/main.js.html b/stats/base/dists/rayleigh/logcdf/main.js.html new file mode 100644 index 000000000..ea32ffa95 --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/main.js.html @@ -0,0 +1,358 @@ + + + + + + Code coverage report for stats/base/dists/rayleigh/logcdf/lib/main.js + + + + + + + + + +
+
+

All files / stats/base/dists/rayleigh/logcdf/lib main.js

+
+ +
+ 100% + Statements + 91/91 +
+ + +
+ 100% + Branches + 14/14 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 91/91 +
+ + +
+

+ 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 +88 +89 +90 +91 +922x +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 +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +3009x +3009x +3009x +3009x +3009x +3009x +3007x +3009x +4x +4x +3009x +3x +3x +3009x +1x +1x +3001x +3001x +3009x +3009x +2x +2x +2x +2x +2x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2018 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 expm1 = require( '@stdlib/math/base/special/expm1' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var log1p = require( '@stdlib/math/base/special/log1p' );
+var exp = require( '@stdlib/math/base/special/exp' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var ln = require( '@stdlib/math/base/special/ln' );
+var LNHALF = require( '@stdlib/constants/float64/ln-half' );
+var NINF = require( '@stdlib/constants/float64/ninf' );
+ 
+ 
+// MAIN //
+ 
+/**
+* Evaluates the logarithm of the cumulative distribution function (CDF) for a Rayleigh distribution with scale parameter `sigma` at a value `x`.
+*
+* @param {number} x - input value
+* @param {NonNegativeNumber} sigma - scale parameter
+* @returns {number} evaluated logCDF
+*
+* @example
+* var y = logcdf( 2.0, 3.0 );
+* // returns ~-1.613
+*
+* @example
+* var y = logcdf( 1.0, 2.0 );
+* // returns ~-2.141
+*
+* @example
+* var y = logcdf( -1.0, 4.0 );
+* // returns -Infinity
+*
+* @example
+* var y = logcdf( NaN, 1.0 );
+* // returns NaN
+*
+* @example
+* var y = logcdf( 0.0, NaN );
+* // returns NaN
+*
+* @example
+* // Negative scale parameter:
+* var y = logcdf( 2.0, -1.0 );
+* // returns NaN
+*/
+function logcdf( x, sigma ) {
+	var s2;
+	var p;
+	if (
+		isnan( x ) ||
+		isnan( sigma ) ||
+		sigma < 0.0
+	) {
+		return NaN;
+	}
+	if ( sigma === 0.0 ) {
+		return ( x < 0.0 ) ? NINF : 0.0;
+	}
+	if ( x < 0.0 ) {
+		return NINF;
+	}
+	s2 = pow( sigma, 2.0 );
+	p = -pow( x, 2.0 ) / ( 2.0 * s2 );
+	return ( p < LNHALF ) ? log1p( -exp( p ) ) : ln( -expm1( p ) );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = logcdf;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/stats/base/dists/rayleigh/logcdf/native.js.html b/stats/base/dists/rayleigh/logcdf/native.js.html new file mode 100644 index 000000000..b5d812adf --- /dev/null +++ b/stats/base/dists/rayleigh/logcdf/native.js.html @@ -0,0 +1,289 @@ + + + + + + Code coverage report for stats/base/dists/rayleigh/logcdf/lib/native.js + + + + + + + + + +
+
+

All files / stats/base/dists/rayleigh/logcdf/lib native.js

+
+ +
+ 100% + Statements + 68/68 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 68/68 +
+ + +
+

+ 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 +691x +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 +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +3009x +3009x +3009x +1x +1x +1x +1x +1x + 
/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 //
+ 
+/**
+* Evaluates the logarithm of the cumulative distribution function (CDF) for a Rayleigh distribution with scale parameter `sigma` at a value `x`.
+*
+* @private
+* @param {number} x - input value
+* @param {NonNegativeNumber} sigma - scale parameter
+* @returns {number} evaluated logCDF
+*
+* @example
+* var y = logcdf( 2.0, 3.0 );
+* // returns ~-1.613
+*
+* @example
+* var y = logcdf( 1.0, 2.0 );
+* // returns ~-2.141
+*
+* @example
+* var y = logcdf( -1.0, 4.0 );
+* // returns -Infinity
+*
+* @example
+* var y = logcdf( NaN, 1.0 );
+* // returns NaN
+*
+* @example
+* var y = logcdf( 0.0, NaN );
+* // returns NaN
+*
+* @example
+* // Negative scale parameter:
+* var y = logcdf( 2.0, -1.0 );
+* // returns NaN
+*/
+function logcdf( x, sigma ) {
+	return addon( x, sigma );
+}
+ 
+ 
+// EXPORTS //
+ 
+module.exports = logcdf;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file