@stdlib/stats-base-dists-frechet-logcdf 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -90,7 +90,7 @@ y = logcdf( 0.0, 2.0, 1.0, -1.0 );
90
90
  If provided `x <= m`, the function returns `-Infinity`.
91
91
 
92
92
  ```javascript
93
- y = logcdf( -2.0, 2.0, 1.0, -1.0 );
93
+ var y = logcdf( -2.0, 2.0, 1.0, -1.0 );
94
94
  // returns -Infinity
95
95
  ```
96
96
 
@@ -189,6 +189,108 @@ for ( i = 0; i < 100; i++ ) {
189
189
 
190
190
  <!-- /.examples -->
191
191
 
192
+ <!-- C interface documentation. -->
193
+
194
+ * * *
195
+
196
+ <section class="c">
197
+
198
+ ## C APIs
199
+
200
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
201
+
202
+ <section class="intro">
203
+
204
+ </section>
205
+
206
+ <!-- /.intro -->
207
+
208
+ <!-- C usage documentation. -->
209
+
210
+ <section class="usage">
211
+
212
+ ### Usage
213
+
214
+ ```c
215
+ #include "stdlib/stats/base/dists/frechet/logcdf.h"
216
+ ```
217
+
218
+ #### stdlib_base_dists_frechet_logcdf( x, alpha, s, m )
219
+
220
+ Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [Fréchet][frechet-distribution] distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.
221
+
222
+ ```c
223
+ double y = stdlib_base_dists_frechet_logcdf( 10.0, 2.0, 3.0, 2.0 );
224
+ // returns ~-0.141
225
+ ```
226
+
227
+ The function accepts the following arguments:
228
+
229
+ - **x**: `[in] double` input value.
230
+ - **alpha**: `[in] double` shape parameter.
231
+ - **s**: `[in] double` scale parameter.
232
+ - **m**: `[in] double` location parameter.
233
+
234
+ ```c
235
+ double stdlib_base_dists_frechet_logcdf( const double x, const double alpha, const double s, const double m );
236
+ ```
237
+
238
+ </section>
239
+
240
+ <!-- /.usage -->
241
+
242
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
243
+
244
+ <section class="notes">
245
+
246
+ </section>
247
+
248
+ <!-- /.notes -->
249
+
250
+ <!-- C API usage examples. -->
251
+
252
+ <section class="examples">
253
+
254
+ ### Examples
255
+
256
+ ```c
257
+ #include "stdlib/stats/base/dists/frechet/logcdf.h"
258
+ #include "stdlib/constants/float64/eps.h"
259
+ #include <stdlib.h>
260
+ #include <stdio.h>
261
+
262
+ static double random_uniform( const double min, const double max ) {
263
+ double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
264
+ return min + ( v*(max-min) );
265
+ }
266
+
267
+ int main( void ) {
268
+ double alpha;
269
+ double x;
270
+ double s;
271
+ double m;
272
+ double y;
273
+ int i;
274
+
275
+ for ( i = 0; i < 10; i++ ) {
276
+ alpha = random_uniform( 0.0, 10.0 );
277
+ x = random_uniform( 0.0, 10.0 );
278
+ s = random_uniform( 0.0, 10.0 );
279
+ m = random_uniform( 0.0, 10.0 );
280
+ y = stdlib_base_dists_frechet_logcdf( x, alpha, s, m );
281
+ printf( "x: %lf, α: %lf, s: %lf, m: %lf, ln(F(x;α,s,m)): %lf\n", x, alpha, s, m, y );
282
+ }
283
+ }
284
+ ```
285
+
286
+ </section>
287
+
288
+ <!-- /.examples -->
289
+
290
+ </section>
291
+
292
+ <!-- /.c -->
293
+
192
294
  <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
193
295
 
194
296
  <section class="related">
@@ -223,7 +325,7 @@ See [LICENSE][stdlib-license].
223
325
 
224
326
  ## Copyright
225
327
 
226
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
328
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
227
329
 
228
330
  </section>
229
331
 
@@ -236,8 +338,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
236
338
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-frechet-logcdf.svg
237
339
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-frechet-logcdf
238
340
 
239
- [test-image]: https://github.com/stdlib-js/stats-base-dists-frechet-logcdf/actions/workflows/test.yml/badge.svg?branch=v0.2.2
240
- [test-url]: https://github.com/stdlib-js/stats-base-dists-frechet-logcdf/actions/workflows/test.yml?query=branch:v0.2.2
341
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-frechet-logcdf/actions/workflows/test.yml/badge.svg?branch=v0.3.0
342
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-frechet-logcdf/actions/workflows/test.yml?query=branch:v0.3.0
241
343
 
242
344
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-frechet-logcdf/main.svg
243
345
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-frechet-logcdf?branch=main
@@ -249,8 +351,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
249
351
 
250
352
  -->
251
353
 
252
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
253
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
354
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
355
+ [chat-url]: https://stdlib.zulipchat.com
254
356
 
255
357
  [stdlib]: https://github.com/stdlib-js/stdlib
256
358
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference path="../docs/types/index.d.ts" />
2
- import logCDF from '../docs/types/index';
3
- export = logCDF;
2
+ import logcdf from '../docs/types/index';
3
+ export = logcdf;
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/main.js", "../lib/factory.js", "../lib/index.js"],
4
- "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 pow = require( '@stdlib/math-base-special-pow' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.\n*\n* @param {number} x - input value\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {number} evaluated logCDF\n*\n* @example\n* var y = logcdf( 10.0, 2.0, 3.0, 2.0 );\n* // returns ~-0.141\n*\n* @example\n* var y = logcdf( -2.5, 1.0, 3.0, -3.0 );\n* // returns -6.0\n*\n* @example\n* var y = logcdf( 0.0, 2.0, 1.0, -1.0 );\n* // returns -1.0\n*\n* @example\n* var y = logcdf( NaN, 2.0, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, NaN, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 2.0, NaN, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 2.0, 1.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, -1.0, 1.0, 0.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 1.0, -1.0, 0.0 );\n* // returns NaN\n*/\nfunction logcdf( x, alpha, s, m ) {\n\tvar z;\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x <= m ) {\n\t\treturn NINF;\n\t}\n\tz = ( x - m ) / s;\n\treturn -pow( z, -alpha );\n}\n\n\n// EXPORTS //\n\nmodule.exports = logcdf;\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 pow = require( '@stdlib/math-base-special-pow' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m`.\n*\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {Function} logCDF\n*\n* @example\n* var logcdf = factory( 3.0, 3.0, 5.0 );\n*\n* var y = logcdf( 10.0 );\n* // returns ~-0.216\n*\n* y = logcdf( 7.0 );\n* // returns ~-3.375\n*/\nfunction factory( alpha, s, m ) {\n\tif (\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\treturn logcdf;\n\n\t/**\n\t* Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {number} evaluated logCDF\n\t*\n\t* @example\n\t* var y = logcdf( -2.0 );\n\t* // returns <number>\n\t*/\n\tfunction logcdf( x ) {\n\t\tvar z;\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x <= m ) {\n\t\t\treturn NINF;\n\t\t}\n\t\tz = ( x - m ) / s;\n\t\treturn -pow( z, -alpha );\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* Fr\u00E9chet distribution logarithm of the cumulative distribution function (CDF).\n*\n* @module @stdlib/stats-base-dists-frechet-logcdf\n*\n* @example\n* var logcdf = require( '@stdlib/stats-base-dists-frechet-logcdf' );\n*\n* var y = logcdf( 10.0, 2.0, 3.0, 5.0 );\n* // returns ~-0.36\n*\n* y = logcdf( 3.8, 2.0, 3.0, 2.0 );\n* // returns ~-2.778\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-frechet-logcdf' ).factory;\n* var logcdf = factory( 3.0, 3.0, 5.0 );\n* var y = logcdf( 10.0 );\n* // returns ~-0.216\n*\n* y = logcdf( 7.0 );\n* // returns ~-3.381\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"],
4
+ "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 pow = require( '@stdlib/math-base-special-pow' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.\n*\n* @param {number} x - input value\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {number} evaluated logCDF\n*\n* @example\n* var y = logcdf( 10.0, 2.0, 3.0, 2.0 );\n* // returns ~-0.141\n*\n* @example\n* var y = logcdf( -2.5, 1.0, 3.0, -3.0 );\n* // returns -6.0\n*\n* @example\n* var y = logcdf( 0.0, 2.0, 1.0, -1.0 );\n* // returns -1.0\n*\n* @example\n* var y = logcdf( NaN, 2.0, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, NaN, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 2.0, NaN, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 2.0, 1.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, -1.0, 1.0, 0.0 );\n* // returns NaN\n*\n* @example\n* var y = logcdf( 0.0, 1.0, -1.0, 0.0 );\n* // returns NaN\n*/\nfunction logcdf( x, alpha, s, m ) {\n\tvar z;\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x <= m ) {\n\t\treturn NINF;\n\t}\n\tz = ( x - m ) / s;\n\treturn -pow( z, -alpha );\n}\n\n\n// EXPORTS //\n\nmodule.exports = logcdf;\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 pow = require( '@stdlib/math-base-special-pow' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m`.\n*\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {Function} logCDF\n*\n* @example\n* var logcdf = factory( 3.0, 3.0, 5.0 );\n*\n* var y = logcdf( 10.0 );\n* // returns ~-0.216\n*\n* y = logcdf( 7.0 );\n* // returns ~-3.375\n*/\nfunction factory( alpha, s, m ) {\n\tif (\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\treturn logcdf;\n\n\t/**\n\t* Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fr\u00E9chet distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {number} evaluated logCDF\n\t*\n\t* @example\n\t* var y = logcdf( -2.0 );\n\t* // returns <number>\n\t*/\n\tfunction logcdf( x ) {\n\t\tvar z;\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x <= m ) {\n\t\t\treturn NINF;\n\t\t}\n\t\tz = ( x - m ) / s;\n\t\treturn -pow( z, -alpha );\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* Fr\u00E9chet distribution logarithm of the cumulative distribution function (CDF).\n*\n* @module @stdlib/stats-base-dists-frechet-logcdf\n*\n* @example\n* var logcdf = require( '@stdlib/stats-base-dists-frechet-logcdf' );\n*\n* var y = logcdf( 10.0, 2.0, 3.0, 5.0 );\n* // returns ~-0.36\n*\n* y = logcdf( 3.8, 2.0, 3.0, 2.0 );\n* // returns ~-2.778\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-frechet-logcdf' ).factory;\n* var logcdf = factory( 3.0, 3.0, 5.0 );\n* var y = logcdf( 10.0 );\n* // returns ~-0.216\n*\n* y = logcdf( 7.0 );\n* // returns ~-3.375\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"],
5
5
  "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAC/CC,EAAO,QAAS,gCAAiC,EAkDrD,SAASC,EAAQC,EAAGC,EAAOC,EAAGC,EAAI,CACjC,IAAIC,EACJ,OACCR,EAAOI,CAAE,GACTJ,EAAOK,CAAM,GACbL,EAAOM,CAAE,GACTN,EAAOO,CAAE,GACTF,GAAS,GACTC,GAAK,EAEE,IAEHF,GAAKG,EACFL,GAERM,GAAMJ,EAAIG,GAAMD,EACT,CAACL,EAAKO,EAAG,CAACH,CAAM,EACxB,CAKAN,EAAO,QAAUI,IChGjB,IAAAM,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAC/CC,EAAO,QAAS,gCAAiC,EAsBrD,SAASC,EAASC,EAAOC,EAAGC,EAAI,CAC/B,GACCN,EAAOI,CAAM,GACbJ,EAAOK,CAAE,GACTL,EAAOM,CAAE,GACTF,GAAS,GACTC,GAAK,EAEL,OAAON,EAAkB,GAAI,EAE9B,OAAOQ,EAaP,SAASA,EAAQC,EAAI,CACpB,IAAIC,EACJ,OAAKT,EAAOQ,CAAE,EACN,IAEHA,GAAKF,EACFJ,GAERO,GAAMD,EAAIF,GAAMD,EACT,CAACJ,EAAKQ,EAAG,CAACL,CAAM,EACxB,CACD,CAKAN,EAAO,QAAUK,ICxCjB,IAAIO,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
6
6
  "names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "pow", "NINF", "logcdf", "x", "alpha", "s", "m", "z", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "isnan", "pow", "NINF", "factory", "alpha", "s", "m", "logcdf", "x", "z", "setReadOnly", "main", "factory"]
7
7
  }
@@ -122,11 +122,11 @@ interface LogCDF {
122
122
  * // returns ~-0.216
123
123
  *
124
124
  * y = mylogcdf( 7.0 );
125
- * // returns ~-3.381
125
+ * // returns ~-3.375
126
126
  */
127
- declare var logCDF: LogCDF;
127
+ declare var logcdf: LogCDF;
128
128
 
129
129
 
130
130
  // EXPORTS //
131
131
 
132
- export = logCDF;
132
+ export = logcdf;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #ifndef STDLIB_STATS_BASE_DISTS_FRECHET_LOGCDF_H
20
+ #define STDLIB_STATS_BASE_DISTS_FRECHET_LOGCDF_H
21
+
22
+ /*
23
+ * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
24
+ */
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
28
+
29
+ /**
30
+ * Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fréchet distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.
31
+ */
32
+ double stdlib_base_dists_frechet_logcdf( const double x, const double alpha, const double s, const double m );
33
+
34
+ #ifdef __cplusplus
35
+ }
36
+ #endif
37
+
38
+ #endif // !STDLIB_STATS_BASE_DISTS_FRECHET_LOGCDF_H
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@
39
39
  * // returns ~-0.216
40
40
  *
41
41
  * y = logcdf( 7.0 );
42
- * // returns ~-3.381
42
+ * // returns ~-3.375
43
43
  */
44
44
 
45
45
  // MODULES //
package/lib/native.js ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var addon = require( './../src/addon.node' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fréchet distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.
30
+ *
31
+ * @private
32
+ * @param {number} x - input value
33
+ * @param {PositiveNumber} alpha - shape parameter
34
+ * @param {PositiveNumber} s - scale parameter
35
+ * @param {number} m - location parameter
36
+ * @returns {number} evaluated logCDF
37
+ *
38
+ * @example
39
+ * var y = logcdf( 10.0, 2.0, 3.0, 2.0 );
40
+ * // returns ~-0.141
41
+ *
42
+ * @example
43
+ * var y = logcdf( -2.5, 1.0, 3.0, -3.0 );
44
+ * // returns -6.0
45
+ *
46
+ * @example
47
+ * var y = logcdf( 0.0, 2.0, 1.0, -1.0 );
48
+ * // returns -1.0
49
+ *
50
+ * @example
51
+ * var y = logcdf( NaN, 2.0, 1.0, -1.0 );
52
+ * // returns NaN
53
+ *
54
+ * @example
55
+ * var y = logcdf( 0.0, NaN, 1.0, -1.0 );
56
+ * // returns NaN
57
+ *
58
+ * @example
59
+ * var y = logcdf( 0.0, 2.0, NaN, -1.0 );
60
+ * // returns NaN
61
+ *
62
+ * @example
63
+ * var y = logcdf( 0.0, 2.0, 1.0, NaN );
64
+ * // returns NaN
65
+ *
66
+ * @example
67
+ * var y = logcdf( 0.0, -1.0, 1.0, 0.0 );
68
+ * // returns NaN
69
+ *
70
+ * @example
71
+ * var y = logcdf( 0.0, 1.0, -1.0, 0.0 );
72
+ * // returns NaN
73
+ */
74
+ function logcdf( x, alpha, s, m ) {
75
+ return addon( x, alpha, s, m );
76
+ }
77
+
78
+
79
+ // EXPORTS //
80
+
81
+ module.exports = logcdf;
package/manifest.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "options": {
3
+ "task": "build",
4
+ "wasm": false
5
+ },
6
+ "fields": [
7
+ {
8
+ "field": "src",
9
+ "resolve": true,
10
+ "relative": true
11
+ },
12
+ {
13
+ "field": "include",
14
+ "resolve": true,
15
+ "relative": true
16
+ },
17
+ {
18
+ "field": "libraries",
19
+ "resolve": false,
20
+ "relative": false
21
+ },
22
+ {
23
+ "field": "libpath",
24
+ "resolve": true,
25
+ "relative": false
26
+ }
27
+ ],
28
+ "confs": [
29
+ {
30
+ "task": "build",
31
+ "wasm": false,
32
+ "src": [
33
+ "./src/main.c"
34
+ ],
35
+ "include": [
36
+ "./include"
37
+ ],
38
+ "libraries": [],
39
+ "libpath": [],
40
+ "dependencies": [
41
+ "@stdlib/math-base-napi-quaternary",
42
+ "@stdlib/math-base-assert-is-nan",
43
+ "@stdlib/math-base-special-pow",
44
+ "@stdlib/constants-float64-ninf"
45
+ ]
46
+ },
47
+ {
48
+ "task": "benchmark",
49
+ "wasm": false,
50
+ "src": [
51
+ "./src/main.c"
52
+ ],
53
+ "include": [
54
+ "./include"
55
+ ],
56
+ "libraries": [],
57
+ "libpath": [],
58
+ "dependencies": [
59
+ "@stdlib/math-base-assert-is-nan",
60
+ "@stdlib/math-base-special-pow",
61
+ "@stdlib/constants-float64-ninf",
62
+ "@stdlib/constants-float64-eps"
63
+ ]
64
+ },
65
+ {
66
+ "task": "examples",
67
+ "wasm": false,
68
+ "src": [
69
+ "./src/main.c"
70
+ ],
71
+ "include": [
72
+ "./include"
73
+ ],
74
+ "libraries": [],
75
+ "libpath": [],
76
+ "dependencies": [
77
+ "@stdlib/math-base-assert-is-nan",
78
+ "@stdlib/math-base-special-pow",
79
+ "@stdlib/constants-float64-ninf",
80
+ "@stdlib/constants-float64-eps"
81
+ ]
82
+ }
83
+ ]
84
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-frechet-logcdf",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Fréchet distribution logarithm of cumulative distribution function (CDF).",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -14,9 +14,12 @@
14
14
  }
15
15
  ],
16
16
  "main": "./lib",
17
+ "gypfile": false,
17
18
  "directories": {
18
19
  "doc": "./docs",
20
+ "include": "./include",
19
21
  "lib": "./lib",
22
+ "src": "./src",
20
23
  "dist": "./dist"
21
24
  },
22
25
  "types": "./docs/types",
@@ -32,9 +35,11 @@
32
35
  "dependencies": {
33
36
  "@stdlib/constants-float64-ninf": "^0.2.2",
34
37
  "@stdlib/math-base-assert-is-nan": "^0.2.2",
38
+ "@stdlib/math-base-napi-quaternary": "^0.2.3",
35
39
  "@stdlib/math-base-special-pow": "^0.3.0",
36
40
  "@stdlib/utils-constant-function": "^0.2.2",
37
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2"
41
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
42
+ "@stdlib/utils-library-manifest": "^0.2.3"
38
43
  },
39
44
  "devDependencies": {},
40
45
  "engines": {
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #include "stdlib/stats/base/dists/frechet/logcdf.h"
20
+ #include "stdlib/math/base/napi/quaternary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_DDDD_D( stdlib_base_dists_frechet_logcdf )
package/src/main.c ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #include "stdlib/stats/base/dists/frechet/logcdf.h"
20
+ #include "stdlib/math/base/assert/is_nan.h"
21
+ #include "stdlib/math/base/special/pow.h"
22
+ #include "stdlib/constants/float64/ninf.h"
23
+
24
+ /**
25
+ * Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Fréchet distribution with shape `alpha`, scale `s`, and location `m` at a value `x`.
26
+ *
27
+ * @param x input value
28
+ * @param alpha shape parameter
29
+ * @param s scale parameter
30
+ * @param m location parameter
31
+ * @return evaluated logCDF
32
+ *
33
+ * @example
34
+ * double y = stdlib_base_dists_frechet_logcdf( 10.0, 2.0, 3.0, 2.0 );
35
+ * // returns ~-0.141
36
+ */
37
+ double stdlib_base_dists_frechet_logcdf( const double x, const double alpha, const double s, const double m ) {
38
+ double z;
39
+ if (
40
+ stdlib_base_is_nan( x ) ||
41
+ stdlib_base_is_nan( alpha ) ||
42
+ stdlib_base_is_nan( s ) ||
43
+ stdlib_base_is_nan( m ) ||
44
+ alpha <= 0.0 ||
45
+ s <= 0.0
46
+ ) {
47
+ return 0.0/0.0; // NaN
48
+ }
49
+ if ( x <= m ) {
50
+ return STDLIB_CONSTANT_FLOAT64_NINF;
51
+ }
52
+ z = ( x - m ) / s;
53
+ return -stdlib_base_pow( z, -alpha );
54
+ }