@stdlib/stats-base-dists-gamma-logpdf 0.0.6 → 0.1.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/CITATION.cff +30 -0
- package/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +22 -10
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/package.json +29 -29
- package/docs/repl.txt +0 -83
- package/docs/types/test.ts +0 -119
- /package/lib/{logpdf.js → main.js} +0 -0
package/CITATION.cff
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: stdlib
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
|
|
7
|
+
type: software
|
|
8
|
+
|
|
9
|
+
authors:
|
|
10
|
+
- name: The Stdlib Authors
|
|
11
|
+
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
+
|
|
13
|
+
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
+
url: https://stdlib.io
|
|
15
|
+
|
|
16
|
+
abstract: |
|
|
17
|
+
Standard library for JavaScript and Node.js.
|
|
18
|
+
|
|
19
|
+
keywords:
|
|
20
|
+
- JavaScript
|
|
21
|
+
- Node.js
|
|
22
|
+
- TypeScript
|
|
23
|
+
- standard library
|
|
24
|
+
- scientific computing
|
|
25
|
+
- numerical computing
|
|
26
|
+
- statistical computing
|
|
27
|
+
|
|
28
|
+
license: Apache-2.0 AND BSL-1.0
|
|
29
|
+
|
|
30
|
+
date-released: 2016
|
package/LICENSE
CHANGED
|
@@ -175,307 +175,3 @@
|
|
|
175
175
|
of your accepting any such warranty or additional liability.
|
|
176
176
|
|
|
177
177
|
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Boost Software License - Version 1.0 - August 17th, 2003
|
|
182
|
-
|
|
183
|
-
Permission is hereby granted, free of charge, to any person or organization
|
|
184
|
-
obtaining a copy of the software and accompanying documentation covered by this
|
|
185
|
-
license (the "Software") to use, reproduce, display, distribute, execute, and
|
|
186
|
-
transmit the Software, and to prepare derivative works of the Software, and to
|
|
187
|
-
permit third-parties to whom the Software is furnished to do so, all subject to
|
|
188
|
-
the following:
|
|
189
|
-
|
|
190
|
-
The copyright notices in the Software and this entire statement, including the
|
|
191
|
-
above license grant, this restriction and the following disclaimer, must be
|
|
192
|
-
included in all copies of the Software, in whole or in part, and all derivative
|
|
193
|
-
works of the Software, unless such copies or derivative works are solely in the
|
|
194
|
-
form of machine-executable object code generated by a source language processor.
|
|
195
|
-
|
|
196
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
197
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
198
|
-
FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
199
|
-
COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
|
|
200
|
-
OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
201
|
-
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
DEPENDENCIES
|
|
207
|
-
|
|
208
|
-
The library links against the following external libraries, which have their own
|
|
209
|
-
licenses:
|
|
210
|
-
|
|
211
|
-
* OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/
|
|
212
|
-
def146efed8d5908ea04e22668feeab7099599a0/LICENSE>
|
|
213
|
-
|
|
214
|
-
Copyright (c) 2011-2014, The OpenBLAS Project
|
|
215
|
-
All rights reserved.
|
|
216
|
-
|
|
217
|
-
Redistribution and use in source and binary forms, with or without
|
|
218
|
-
modification, are permitted provided that the following conditions are
|
|
219
|
-
met:
|
|
220
|
-
|
|
221
|
-
1. Redistributions of source code must retain the above copyright
|
|
222
|
-
notice, this list of conditions and the following disclaimer.
|
|
223
|
-
|
|
224
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
225
|
-
notice, this list of conditions and the following disclaimer in
|
|
226
|
-
the documentation and/or other materials provided with the
|
|
227
|
-
distribution.
|
|
228
|
-
|
|
229
|
-
3. Neither the name of the OpenBLAS project nor the names of
|
|
230
|
-
its contributors may be used to endorse or promote products
|
|
231
|
-
derived from this software without specific prior written
|
|
232
|
-
permission.
|
|
233
|
-
|
|
234
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
235
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
236
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
237
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
238
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
239
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
240
|
-
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
241
|
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
242
|
-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
243
|
-
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* Electron <https://raw.githubusercontent.com/electron/electron/
|
|
247
|
-
c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE>
|
|
248
|
-
|
|
249
|
-
Copyright (c) 2013-2017 GitHub Inc.
|
|
250
|
-
|
|
251
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
252
|
-
a copy of this software and associated documentation files (the
|
|
253
|
-
"Software"), to deal in the Software without restriction, including
|
|
254
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
255
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
256
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
257
|
-
the following conditions:
|
|
258
|
-
|
|
259
|
-
The above copyright notice and this permission notice shall be
|
|
260
|
-
included in all copies or substantial portions of the Software.
|
|
261
|
-
|
|
262
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
263
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
264
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
265
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
266
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
267
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
268
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
* Boost <http://www.boost.org/LICENSE_1_0.txt>
|
|
272
|
-
|
|
273
|
-
Boost Software License - Version 1.0 - August 17th, 2003
|
|
274
|
-
|
|
275
|
-
Permission is hereby granted, free of charge, to any person or organization
|
|
276
|
-
obtaining a copy of the software and accompanying documentation covered by
|
|
277
|
-
this license (the "Software") to use, reproduce, display, distribute,
|
|
278
|
-
execute, and transmit the Software, and to prepare derivative works of the
|
|
279
|
-
Software, and to permit third-parties to whom the Software is furnished to
|
|
280
|
-
do so, all subject to the following:
|
|
281
|
-
|
|
282
|
-
The copyright notices in the Software and this entire statement, including
|
|
283
|
-
the above license grant, this restriction and the following disclaimer,
|
|
284
|
-
must be included in all copies of the Software, in whole or in part, and
|
|
285
|
-
all derivative works of the Software, unless such copies or derivative
|
|
286
|
-
works are solely in the form of machine-executable object code generated by
|
|
287
|
-
a source language processor.
|
|
288
|
-
|
|
289
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
290
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
291
|
-
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
292
|
-
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
293
|
-
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
294
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
295
|
-
DEALINGS IN THE SOFTWARE.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* Cephes <http://www.netlib.org/cephes/readme>
|
|
299
|
-
|
|
300
|
-
Copyright (c) 1984-2000 Stephen L. Moshier
|
|
301
|
-
|
|
302
|
-
Some software in this archive may be from the book _Methods and Programs for
|
|
303
|
-
Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
|
|
304
|
-
or from the Cephes Mathematical Library, a commercial product. In either event,
|
|
305
|
-
it is copyrighted by the author. What you see here may be used freely but it
|
|
306
|
-
comes with no support or guarantee.
|
|
307
|
-
|
|
308
|
-
Stephen L. Moshier
|
|
309
|
-
moshier@na-net.ornl.gov
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
ATTRIBUTION
|
|
314
|
-
|
|
315
|
-
The library contains implementations from the following external libraries,
|
|
316
|
-
which have their own licenses:
|
|
317
|
-
|
|
318
|
-
* FreeBSD <https://svnweb.freebsd.org/>
|
|
319
|
-
|
|
320
|
-
Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
|
|
321
|
-
|
|
322
|
-
Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
323
|
-
Permission to use, copy, modify, and distribute this
|
|
324
|
-
software is freely granted, provided that this notice
|
|
325
|
-
is preserved.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
* FDLIBM <http://www.netlib.org/fdlibm/>
|
|
329
|
-
|
|
330
|
-
Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
|
331
|
-
|
|
332
|
-
Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
333
|
-
Permission to use, copy, modify, and distribute this
|
|
334
|
-
software is freely granted, provided that this notice
|
|
335
|
-
is preserved.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
* Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>
|
|
339
|
-
|
|
340
|
-
Copyright (c) 2009 The Go Authors. All rights reserved.
|
|
341
|
-
|
|
342
|
-
Redistribution and use in source and binary forms, with or without
|
|
343
|
-
modification, are permitted provided that the following conditions are
|
|
344
|
-
met:
|
|
345
|
-
|
|
346
|
-
* Redistributions of source code must retain the above copyright
|
|
347
|
-
notice, this list of conditions and the following disclaimer.
|
|
348
|
-
* Redistributions in binary form must reproduce the above
|
|
349
|
-
copyright notice, this list of conditions and the following disclaimer
|
|
350
|
-
in the documentation and/or other materials provided with the
|
|
351
|
-
distribution.
|
|
352
|
-
* Neither the name of Google Inc. nor the names of its
|
|
353
|
-
contributors may be used to endorse or promote products derived from
|
|
354
|
-
this software without specific prior written permission.
|
|
355
|
-
|
|
356
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
357
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
358
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
359
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
360
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
361
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
362
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
363
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
364
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
365
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
366
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
* SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>
|
|
370
|
-
|
|
371
|
-
Public domain.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
* ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE>
|
|
375
|
-
|
|
376
|
-
Copyright JS Foundation and other contributors, https://js.foundation
|
|
377
|
-
|
|
378
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
379
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
380
|
-
in the Software without restriction, including without limitation the rights
|
|
381
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
382
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
383
|
-
furnished to do so, subject to the following conditions:
|
|
384
|
-
|
|
385
|
-
The above copyright notice and this permission notice shall be included in
|
|
386
|
-
all copies or substantial portions of the Software.
|
|
387
|
-
|
|
388
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
389
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
390
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
391
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
392
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
393
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
394
|
-
THE SOFTWARE.
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
* StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/
|
|
398
|
-
e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md>
|
|
399
|
-
|
|
400
|
-
Copyright (c) 2015: Dahua Lin.
|
|
401
|
-
|
|
402
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
403
|
-
a copy of this software and associated documentation files (the
|
|
404
|
-
"Software"), to deal in the Software without restriction, including
|
|
405
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
406
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
407
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
408
|
-
the following conditions:
|
|
409
|
-
|
|
410
|
-
The above copyright notice and this permission notice shall be
|
|
411
|
-
included in all copies or substantial portions of the Software.
|
|
412
|
-
|
|
413
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
414
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
415
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
416
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
417
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
418
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
419
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
* SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/
|
|
423
|
-
SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE>
|
|
424
|
-
|
|
425
|
-
The MIT License (MIT)
|
|
426
|
-
|
|
427
|
-
Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others:
|
|
428
|
-
|
|
429
|
-
https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors
|
|
430
|
-
|
|
431
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
432
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
433
|
-
in the Software without restriction, including without limitation the rights
|
|
434
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
435
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
436
|
-
furnished to do so, subject to the following conditions:
|
|
437
|
-
|
|
438
|
-
The above copyright notice and this permission notice shall be included in all
|
|
439
|
-
copies or substantial portions of the Software.
|
|
440
|
-
|
|
441
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
442
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
443
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
444
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
445
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
446
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
447
|
-
SOFTWARE.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
* MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/
|
|
451
|
-
mt19937ar.c>
|
|
452
|
-
|
|
453
|
-
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
454
|
-
All rights reserved.
|
|
455
|
-
|
|
456
|
-
Redistribution and use in source and binary forms, with or without
|
|
457
|
-
modification, are permitted provided that the following conditions
|
|
458
|
-
are met:
|
|
459
|
-
|
|
460
|
-
1. Redistributions of source code must retain the above copyright
|
|
461
|
-
notice, this list of conditions and the following disclaimer.
|
|
462
|
-
|
|
463
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
464
|
-
notice, this list of conditions and the following disclaimer in the
|
|
465
|
-
documentation and/or other materials provided with the distribution.
|
|
466
|
-
|
|
467
|
-
3. The names of its contributors may not be used to endorse or promote
|
|
468
|
-
products derived from this software without specific prior written
|
|
469
|
-
permission.
|
|
470
|
-
|
|
471
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
472
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
473
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
474
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
475
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
476
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
477
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
478
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
479
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
480
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
481
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2023 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
-->
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
21
32
|
# Logarithm of Probability Density Function
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -197,7 +208,7 @@ See [LICENSE][stdlib-license].
|
|
|
197
208
|
|
|
198
209
|
## Copyright
|
|
199
210
|
|
|
200
|
-
Copyright © 2016-
|
|
211
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
201
212
|
|
|
202
213
|
</section>
|
|
203
214
|
|
|
@@ -210,8 +221,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
210
221
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-gamma-logpdf.svg
|
|
211
222
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-gamma-logpdf
|
|
212
223
|
|
|
213
|
-
[test-image]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/actions/workflows/test.yml/badge.svg
|
|
214
|
-
[test-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/actions/workflows/test.yml
|
|
224
|
+
[test-image]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
225
|
+
[test-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/actions/workflows/test.yml?query=branch:v0.1.0
|
|
215
226
|
|
|
216
227
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-gamma-logpdf/main.svg
|
|
217
228
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-gamma-logpdf?branch=main
|
|
@@ -223,19 +234,20 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
223
234
|
|
|
224
235
|
-->
|
|
225
236
|
|
|
237
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
238
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
239
|
+
|
|
240
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
241
|
+
|
|
242
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
243
|
+
|
|
226
244
|
[umd]: https://github.com/umdjs/umd
|
|
227
245
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
228
246
|
|
|
229
247
|
[deno-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/tree/deno
|
|
230
248
|
[umd-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/tree/umd
|
|
231
249
|
[esm-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/tree/esm
|
|
232
|
-
|
|
233
|
-
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
234
|
-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
235
|
-
|
|
236
|
-
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
237
|
-
|
|
238
|
-
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
250
|
+
[branches-url]: https://github.com/stdlib-js/stats-base-dists-gamma-logpdf/blob/main/branches.md
|
|
239
251
|
|
|
240
252
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-base-dists-gamma-logpdf/main/LICENSE
|
|
241
253
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";var o=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var y=o(function(vr,P){
|
|
2
|
+
var T=require('@stdlib/math-base-special-gamma-lanczos-sum-expg-scaled/dist'),j=require('@stdlib/math-base-special-gammaln/dist'),k=require('@stdlib/math-base-special-gamma/dist'),B=require('@stdlib/math-base-special-log1p/dist'),C=require('@stdlib/math-base-special-sqrt/dist'),H=require('@stdlib/math-base-special-abs/dist'),t=require('@stdlib/math-base-special-exp/dist'),s=require('@stdlib/math-base-special-pow/dist'),c=require('@stdlib/math-base-special-max/dist'),l=require('@stdlib/math-base-special-min/dist'),I=require('@stdlib/math-base-special-ln/dist'),N=require('@stdlib/constants-float64-max-ln/dist'),m=require('@stdlib/constants-float64-min-ln/dist'),g=require('@stdlib/constants-float64-gamma-lanczos-g/dist'),J=require('@stdlib/constants-float64-e/dist');function K(r,e){var i,n,v,a,u,q,f;return v=r+g-.5,f=(e-r-g+.5)/v,r<1?e<=m?t(r*I(e)-e-j(r)):s(e,r)*t(-e)/k(r):(H(f*f*r)<=100&&r>150?(i=r*(B(f)-f)+e*(.5-g)/v,i=t(i)):(a=r*I(e/v),u=r-e,l(a,u)<=m||c(a,u)>=N?(n=u/r,l(a,u)/2>m&&c(a,u)/2<N?(q=s(e/v,r/2)*t(u/2),i=q*q):l(a,u)/4>m&&c(a,u)/4<N&&e>r?(q=s(e/v,r/4)*t(u/4),i=q*q,i*=i):n>m&&n<N?i=s(e*t(n)/v,r):i=t(a+u)):i=s(e/v,r)*t(u)),i*=C(v/J)/T(r),i)}P.exports=K
|
|
3
|
+
});var d=o(function(ar,D){
|
|
4
|
+
var Q=require('@stdlib/math-base-special-gammaln/dist'),U=require('@stdlib/math-base-special-exp/dist'),G=require('@stdlib/math-base-special-ln/dist'),A=require('@stdlib/constants-float64-pinf/dist'),V=require('@stdlib/constants-float64-max/dist'),W=y();function Y(r,e){var i;return r<=0?NaN:e<0?NaN:e===0?r>1?0:r===1?1:A:(i=W(r,e),e<1&&V*e<i?A:(i===0?(i=r*G(e)-e-Q(r)-G(e),i=U(i)):i/=e,i))}D.exports=Y
|
|
5
|
+
});var O=o(function(tr,E){
|
|
6
|
+
var p=require('@stdlib/math-base-assert-is-nan/dist'),L=require('@stdlib/math-base-special-ln/dist'),M=require('@stdlib/constants-float64-pinf/dist'),_=require('@stdlib/constants-float64-ninf/dist'),Z=d();function $(r,e,i){return p(r)||p(e)||p(i)||e<0||i<=0?NaN:r<0||r===M?_:e===0?r===0?M:_:L(Z(e,r*i))+L(i)}E.exports=$
|
|
7
|
+
});var w=o(function(qr,X){
|
|
8
|
+
var x=require('@stdlib/utils-constant-function/dist'),b=require('@stdlib/stats-base-dists-degenerate-logpdf/dist').factory,F=require('@stdlib/math-base-assert-is-nan/dist'),S=require('@stdlib/math-base-special-ln/dist'),h=require('@stdlib/constants-float64-ninf/dist'),z=require('@stdlib/constants-float64-pinf/dist'),rr=d();function er(r,e){if(F(r)||F(e)||r<0||e<=0)return x(NaN);if(r===0)return b(0);return i;function i(n){return F(n)?NaN:n<0||n===z?h:S(rr(r,n*e))+S(e)}}X.exports=er
|
|
9
|
+
});var ir=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),R=O(),ur=w();ir(R,"factory",ur);module.exports=R;
|
|
10
|
+
/** @license Apache-2.0 */
|
|
11
|
+
/** @license Apache-2.0 */
|
|
12
|
+
/** @license Apache-2.0 */
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/regularised_gamma_prefix.js", "../lib/gamma_p_derivative.js", "../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* ## Notice\n*\n* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_64_0/boost/math/special_functions/gamma.hpp}. The implementation has been modified for JavaScript.\n*\n* ```text\n* Copyright John Maddock 2006-7, 2013-14.\n* Copyright Paul A. Bristow 2007, 2013-14.\n* Copyright Nikhar Agrawal 2013-14.\n* Copyright Christopher Kormanyos 2013-14.\n*\n* Use, modification and distribution are subject to the\n* Boost Software License, Version 1.0. (See accompanying file\n* LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)\n* ```\n*/\n\n'use strict';\n\n// MODULES //\n\nvar lanczosSumExpGScaled = require( '@stdlib/math-base-special-gamma-lanczos-sum-expg-scaled' );\nvar gammaln = require( '@stdlib/math-base-special-gammaln' );\nvar gamma = require( '@stdlib/math-base-special-gamma' );\nvar log1p = require( '@stdlib/math-base-special-log1p' );\nvar sqrt = require( '@stdlib/math-base-special-sqrt' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar exp = require( '@stdlib/math-base-special-exp' );\nvar pow = require( '@stdlib/math-base-special-pow' );\nvar max = require( '@stdlib/math-base-special-max' );\nvar min = require( '@stdlib/math-base-special-min' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar MAX_LN = require( '@stdlib/constants-float64-max-ln' );\nvar MIN_LN = require( '@stdlib/constants-float64-min-ln' );\nvar G = require( '@stdlib/constants-float64-gamma-lanczos-g' );\nvar E = require( '@stdlib/constants-float64-e' );\n\n\n// MAIN //\n\n/**\n* Computes `(z^a)*(e^-z) / gamma(a)`.\n*\n* @private\n* @param {number} a - input value\n* @param {number} z - input value\n* @returns {number} function value\n*/\nfunction regularisedGammaPrefix( a, z ) {\n\tvar prefix;\n\tvar amza;\n\tvar agh;\n\tvar alz;\n\tvar amz;\n\tvar sq;\n\tvar d;\n\n\tagh = a + G - 0.5;\n\td = ( (z - a) - G + 0.5 ) / agh;\n\tif ( a < 1.0 ) {\n\t\t// Treat a < 1 as a special case because our Lanczos approximations are optimized against the factorials with a > 1, and for high precision types very small values of `a` can give rather erroneous results for gamma:\n\t\tif ( z <= MIN_LN ) {\n\t\t\t// Use logs, so should be free of cancellation errors:\n\t\t\treturn exp( ( a * ln(z) ) - z - gammaln( a ) );\n\t\t}\n\t\t// No danger of overflow as gamma(a) < 1/a for small a, so direct calculation:\n\t\treturn pow( z, a ) * exp( -z ) / gamma( a );\n\t}\n\tif ( abs(d*d*a) <= 100.0 && a > 150.0 ) {\n\t\t// Special case for large a and a ~ z:\n\t\tprefix = ( a * ( log1p( d ) - d ) ) + ( z * ( 0.5-G ) / agh );\n\t\tprefix = exp( prefix );\n\t}\n\telse {\n\t\t// General case. Direct computation is most accurate, but use various fallbacks for different parts of the problem domain:\n\t\talz = a * ln(z / agh);\n\t\tamz = a - z;\n\t\tif (\n\t\t\tmin(alz, amz) <= MIN_LN ||\n\t\t\tmax(alz, amz) >= MAX_LN\n\t\t) {\n\t\t\tamza = amz / a;\n\t\t\tif (\n\t\t\t\tmin(alz, amz)/2.0 > MIN_LN &&\n\t\t\t\tmax(alz, amz)/2.0 < MAX_LN\n\t\t\t) {\n\t\t\t\t// Compute square root of the result and then square it:\n\t\t\t\tsq = pow( z / agh, a / 2.0 ) * exp( amz / 2.0 );\n\t\t\t\tprefix = sq * sq;\n\t\t\t}\n\t\t\telse if (\n\t\t\t\tmin(alz, amz)/4.0 > MIN_LN &&\n\t\t\t\tmax(alz, amz)/4.0 < MAX_LN &&\n\t\t\t\tz > a\n\t\t\t) {\n\t\t\t\t// Compute the 4th root of the result then square it twice:\n\t\t\t\tsq = pow( z / agh, a / 4.0 ) * exp( amz / 4.0 );\n\t\t\t\tprefix = sq * sq;\n\t\t\t\tprefix *= prefix;\n\t\t\t}\n\t\t\telse if (\n\t\t\t\tamza > MIN_LN &&\n\t\t\t\tamza < MAX_LN\n\t\t\t) {\n\t\t\t\tprefix = pow( (z * exp(amza)) / agh, a );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprefix = exp( alz + amz );\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprefix = pow( z / agh, a ) * exp( amz );\n\t\t}\n\t}\n\tprefix *= sqrt( agh / E ) / lanczosSumExpGScaled( a );\n\treturn prefix;\n}\n\n\n// EXPORTS //\n\nmodule.exports = regularisedGammaPrefix;\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* ## Notice\n*\n* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_58_0/boost/math/special_functions/gamma.hpp}. The implementation has been modified for JavaScript.\n*\n* ```text\n* Copyright John Maddock 2006-7, 2013-14.\n* Copyright Paul A. Bristow 2007, 2013-14.\n* Copyright Nikhar Agrawal 2013-14.\n* Copyright Christopher Kormanyos 2013-14.\n*\n* Use, modification and distribution are subject to the\n* Boost Software License, Version 1.0. (See accompanying file\n* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n* ```\n*/\n\n'use strict';\n\n// MODULES //\n\nvar gammaln = require( '@stdlib/math-base-special-gammaln' );\nvar exp = require( '@stdlib/math-base-special-exp' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar FLOAT64_MAX = require( '@stdlib/constants-float64-max' );\nvar regularisedGammaPrefix = require( './regularised_gamma_prefix.js' );\n\n\n// MAIN //\n\n/**\n* Calculates the partial derivative with respect to x of the incomplete gamma function.\n*\n* @private\n* @param {PositiveNumber} a - function parameter\n* @param {NonNegativeNumber} x - function parameter\n* @returns {number} function value\n*/\nfunction gammaPDerivative( a, x ) {\n\tvar f1;\n\tif ( a <= 0.0 ) {\n\t\treturn NaN;\n\t}\n\tif ( x < 0.0 ) {\n\t\treturn NaN;\n\t}\n\tif ( x === 0.0 ) {\n\t\tif ( a > 1.0 ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\treturn ( a === 1.0 ) ? 1.0 : PINF;\n\t}\n\tf1 = regularisedGammaPrefix( a, x );\n\tif ( x < 1.0 && ( FLOAT64_MAX * x < f1 ) ) {\n\t\treturn PINF;\n\t}\n\tif ( f1 === 0.0 ) {\n\t\t// Underflow in calculation, use logs instead:\n\t\tf1 = (a * ln( x )) - x - gammaln( a ) - ln( x );\n\t\tf1 = exp( f1 );\n\t} else {\n\t\tf1 /= x;\n\t}\n\treturn f1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gammaPDerivative;\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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar gammaDeriv = require( './gamma_p_derivative.js' );\n\n\n// MAIN //\n\n/**\n* Evaluates the logarithm of the probability density function (PDF) for a gamma distribution with shape parameter `alpha` and rate parameter `beta` at a value `x`.\n*\n* @param {number} x - input value\n* @param {NonNegativeNumber} alpha - shape parameter\n* @param {PositiveNumber} beta - rate parameter\n* @returns {number} evaluated logPDF\n*\n* @example\n* var y = logpdf( 2.0, 0.5, 1.0 );\n* // returns ~-2.919\n*\n* @example\n* var y = logpdf( 0.1, 1.0, 1.0 );\n* // returns ~-0.1\n*\n* @example\n* var y = logpdf( -1.0, 4.0, 2.0 );\n* // returns -Infinity\n*\n* @example\n* var y = logpdf( NaN, 0.6, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 0.0, NaN, 1.0 );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 0.0, 1.0, NaN );\n* // returns NaN\n*\n* @example\n* // Negative shape parameter:\n* var y = logpdf( 2.0, -1.0, 1.0 );\n* // returns NaN\n*\n* @example\n* // Negative rate parameter:\n* var y = logpdf( 2.0, 1.0, -1.0 );\n* // returns NaN\n*/\nfunction logpdf( x, alpha, beta ) {\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( alpha ) ||\n\t\tisnan( beta ) ||\n\t\talpha < 0.0 ||\n\t\tbeta <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x < 0.0 || x === PINF ) {\n\t\treturn NINF;\n\t}\n\tif ( alpha === 0.0 ) {\n\t\t// Point mass at 0...\n\t\treturn ( x === 0.0 ) ? PINF : NINF;\n\t}\n\treturn ln( gammaDeriv( alpha, x * beta ) ) + ln( beta );\n}\n\n\n// EXPORTS //\n\nmodule.exports = logpdf;\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 degenerate = require( '@stdlib/stats-base-dists-degenerate-logpdf' ).factory;\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar gammaDeriv = require( './gamma_p_derivative.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the logarithm of the probability density function (PDF) for a gamma distribution with shape parameter `alpha` and rate parameter `beta`.\n*\n* @param {NonNegativeNumber} alpha - shape parameter\n* @param {PositiveNumber} beta - rate parameter\n* @returns {Function} logPDF\n*\n* @example\n* var logpdf = factory( 3.0, 1.5 );\n*\n* var y = logpdf( 1.0 );\n* // returns ~-0.977\n*\n* y = logpdf( 4.0 );\n* // returns ~-2.704\n*/\nfunction factory( alpha, beta ) {\n\tif (\n\t\tisnan( alpha ) ||\n\t\tisnan( beta ) ||\n\t\talpha < 0.0 ||\n\t\tbeta <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\tif ( alpha === 0.0 ) {\n\t\treturn degenerate( 0.0 );\n\t}\n\treturn logpdf;\n\n\t/**\n\t* Evaluates the logarithm of the probability density function (PDF) for a gamma distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {number} evaluated logPDF\n\t*\n\t* @example\n\t* var y = logpdf( -1.2 );\n\t* // returns <number>\n\t*/\n\tfunction logpdf( x ) {\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x < 0.0 || x === PINF ) {\n\t\t\treturn NINF;\n\t\t}\n\t\treturn ln( gammaDeriv( alpha, x * beta ) ) + ln( beta );\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* Gamma distribution logarithm of probability density function (PDF).\n*\n* @module @stdlib/stats-base-dists-gamma-logpdf\n*\n* @example\n* var logpdf = require( '@stdlib/stats-base-dists-gamma-logpdf' );\n*\n* var y = logpdf( 2.0, 0.5, 1.0 );\n* // returns ~-2.919\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-gamma-logpdf' ).factory;\n*\n* var logpdf = factory( 6.0, 7.0 );\n* var y = logpdf( 2.0 );\n* // returns ~-3.646\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
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_regularised_gamma_prefix", "__commonJSMin", "exports", "module", "lanczosSumExpGScaled", "gammaln", "gamma", "log1p", "sqrt", "abs", "exp", "pow", "max", "min", "ln", "MAX_LN", "MIN_LN", "G", "E", "regularisedGammaPrefix", "a", "z", "prefix", "amza", "agh", "alz", "amz", "sq", "d", "require_gamma_p_derivative", "__commonJSMin", "exports", "module", "gammaln", "exp", "ln", "PINF", "FLOAT64_MAX", "regularisedGammaPrefix", "gammaPDerivative", "a", "x", "f1", "require_main", "__commonJSMin", "exports", "module", "isnan", "ln", "PINF", "NINF", "gammaDeriv", "logpdf", "x", "alpha", "beta", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "degenerate", "isnan", "ln", "NINF", "PINF", "gammaDeriv", "factory", "alpha", "beta", "logpdf", "x", "setReadOnly", "main", "factory"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
// MODULES //
|
|
41
41
|
|
|
42
42
|
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
43
|
-
var
|
|
43
|
+
var main = require( './main.js' );
|
|
44
44
|
var factory = require( './factory.js' );
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
// MAIN //
|
|
48
48
|
|
|
49
|
-
setReadOnly(
|
|
49
|
+
setReadOnly( main, 'factory', factory );
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
// EXPORTS //
|
|
53
53
|
|
|
54
|
-
module.exports =
|
|
54
|
+
module.exports = main;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-base-dists-gamma-logpdf",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Gamma distribution logarithm of probability density function (PDF).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,36 +37,36 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/constants-float64-e": "^0.0
|
|
41
|
-
"@stdlib/constants-float64-gamma-lanczos-g": "^0.0
|
|
42
|
-
"@stdlib/constants-float64-max": "^0.0
|
|
43
|
-
"@stdlib/constants-float64-max-ln": "^0.0
|
|
44
|
-
"@stdlib/constants-float64-min-ln": "^0.0
|
|
45
|
-
"@stdlib/constants-float64-ninf": "^0.0
|
|
46
|
-
"@stdlib/constants-float64-pinf": "^0.0
|
|
47
|
-
"@stdlib/math-base-assert-is-nan": "^0.0
|
|
48
|
-
"@stdlib/math-base-special-abs": "^0.0
|
|
49
|
-
"@stdlib/math-base-special-exp": "^0.0
|
|
50
|
-
"@stdlib/math-base-special-gamma": "^0.0
|
|
51
|
-
"@stdlib/math-base-special-gamma-lanczos-sum-expg-scaled": "^0.0
|
|
52
|
-
"@stdlib/math-base-special-gammaln": "^0.0
|
|
53
|
-
"@stdlib/math-base-special-ln": "^0.0
|
|
54
|
-
"@stdlib/math-base-special-log1p": "^0.0
|
|
55
|
-
"@stdlib/math-base-special-max": "^0.0
|
|
56
|
-
"@stdlib/math-base-special-min": "^0.0
|
|
57
|
-
"@stdlib/math-base-special-pow": "^0.0
|
|
58
|
-
"@stdlib/math-base-special-sqrt": "^0.0
|
|
59
|
-
"@stdlib/stats-base-dists-degenerate-logpdf": "^0.0
|
|
60
|
-
"@stdlib/utils-constant-function": "^0.0
|
|
61
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0
|
|
40
|
+
"@stdlib/constants-float64-e": "^0.1.0",
|
|
41
|
+
"@stdlib/constants-float64-gamma-lanczos-g": "^0.1.0",
|
|
42
|
+
"@stdlib/constants-float64-max": "^0.1.0",
|
|
43
|
+
"@stdlib/constants-float64-max-ln": "^0.1.0",
|
|
44
|
+
"@stdlib/constants-float64-min-ln": "^0.1.0",
|
|
45
|
+
"@stdlib/constants-float64-ninf": "^0.1.0",
|
|
46
|
+
"@stdlib/constants-float64-pinf": "^0.1.0",
|
|
47
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.0",
|
|
48
|
+
"@stdlib/math-base-special-abs": "^0.1.0",
|
|
49
|
+
"@stdlib/math-base-special-exp": "^0.1.0",
|
|
50
|
+
"@stdlib/math-base-special-gamma": "^0.1.0",
|
|
51
|
+
"@stdlib/math-base-special-gamma-lanczos-sum-expg-scaled": "^0.1.0",
|
|
52
|
+
"@stdlib/math-base-special-gammaln": "^0.1.0",
|
|
53
|
+
"@stdlib/math-base-special-ln": "^0.1.0",
|
|
54
|
+
"@stdlib/math-base-special-log1p": "^0.1.0",
|
|
55
|
+
"@stdlib/math-base-special-max": "^0.1.0",
|
|
56
|
+
"@stdlib/math-base-special-min": "^0.1.0",
|
|
57
|
+
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
58
|
+
"@stdlib/math-base-special-sqrt": "^0.1.0",
|
|
59
|
+
"@stdlib/stats-base-dists-degenerate-logpdf": "^0.1.0",
|
|
60
|
+
"@stdlib/utils-constant-function": "^0.1.0",
|
|
61
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@stdlib/bench": "^0.0
|
|
65
|
-
"@stdlib/constants-float64-eps": "^0.0
|
|
66
|
-
"@stdlib/random-base-randu": "^0.0.
|
|
64
|
+
"@stdlib/bench": "^0.1.0",
|
|
65
|
+
"@stdlib/constants-float64-eps": "^0.1.0",
|
|
66
|
+
"@stdlib/random-base-randu": "^0.0.8",
|
|
67
67
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
68
68
|
"istanbul": "^0.4.1",
|
|
69
|
-
"tap-
|
|
69
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=0.10.0",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"continuous"
|
|
100
100
|
],
|
|
101
101
|
"funding": {
|
|
102
|
-
"type": "
|
|
103
|
-
"url": "https://
|
|
102
|
+
"type": "opencollective",
|
|
103
|
+
"url": "https://opencollective.com/stdlib"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( x, α, β )
|
|
3
|
-
Evaluates the logarithm of the probability density function (PDF) for a
|
|
4
|
-
gamma distribution with shape parameter `α` and rate parameter `β` at a
|
|
5
|
-
value `x`.
|
|
6
|
-
|
|
7
|
-
If `α < 0` or `β <= 0`, the function returns `NaN`.
|
|
8
|
-
|
|
9
|
-
If provided `NaN` as any argument, the function returns `NaN`.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
x: number
|
|
14
|
-
Input value.
|
|
15
|
-
|
|
16
|
-
α: number
|
|
17
|
-
Shape parameter.
|
|
18
|
-
|
|
19
|
-
β: number
|
|
20
|
-
Rate parameter.
|
|
21
|
-
|
|
22
|
-
Returns
|
|
23
|
-
-------
|
|
24
|
-
out: number
|
|
25
|
-
Evaluated logPDF.
|
|
26
|
-
|
|
27
|
-
Examples
|
|
28
|
-
--------
|
|
29
|
-
> var y = {{alias}}( 2.0, 0.5, 1.0 )
|
|
30
|
-
~-2.919
|
|
31
|
-
> y = {{alias}}( 0.1, 1.0, 1.0 )
|
|
32
|
-
~-0.1
|
|
33
|
-
> y = {{alias}}( -1.0, 4.0, 2.0 )
|
|
34
|
-
-Infinity
|
|
35
|
-
|
|
36
|
-
> y = {{alias}}( NaN, 0.6, 1.0 )
|
|
37
|
-
NaN
|
|
38
|
-
> y = {{alias}}( 0.0, NaN, 1.0 )
|
|
39
|
-
NaN
|
|
40
|
-
> y = {{alias}}( 0.0, 1.0, NaN )
|
|
41
|
-
NaN
|
|
42
|
-
|
|
43
|
-
// Negative shape parameter:
|
|
44
|
-
> y = {{alias}}( 2.0, -1.0, 1.0 )
|
|
45
|
-
NaN
|
|
46
|
-
// Non-positive rate parameter:
|
|
47
|
-
> y = {{alias}}( 2.0, 1.0, -1.0 )
|
|
48
|
-
NaN
|
|
49
|
-
|
|
50
|
-
// Degenerate distribution centered at `0.0` when `α = 0.0`:
|
|
51
|
-
> y = {{alias}}( 2.0, 0.0, 2.0 )
|
|
52
|
-
-Infinity
|
|
53
|
-
> y = {{alias}}( 0.0, 0.0, 2.0 )
|
|
54
|
-
Infinity
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{{alias}}.factory( α, β )
|
|
58
|
-
Returns a function for evaluating the logarithm of the probability density
|
|
59
|
-
function (PDF) of a gamma distribution with shape parameter `α` and rate
|
|
60
|
-
parameter `β`.
|
|
61
|
-
|
|
62
|
-
Parameters
|
|
63
|
-
----------
|
|
64
|
-
α: number
|
|
65
|
-
Shape parameter.
|
|
66
|
-
|
|
67
|
-
β: number
|
|
68
|
-
Rate parameter.
|
|
69
|
-
|
|
70
|
-
Returns
|
|
71
|
-
-------
|
|
72
|
-
logpdf: Function
|
|
73
|
-
Logarithm of probability density function (PDF).
|
|
74
|
-
|
|
75
|
-
Examples
|
|
76
|
-
--------
|
|
77
|
-
> var mylogPDF = {{alias}}.factory( 6.0, 7.0 );
|
|
78
|
-
> var y = mylogPDF( 2.0 )
|
|
79
|
-
~-3.646
|
|
80
|
-
|
|
81
|
-
See Also
|
|
82
|
-
--------
|
|
83
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2019 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
|
-
import logpdf = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a number...
|
|
25
|
-
{
|
|
26
|
-
logpdf( 2, 2, 4 ); // $ExpectType number
|
|
27
|
-
logpdf( 1, 2, 8 ); // $ExpectType number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// The compiler throws an error if the function is provided values other than three numbers...
|
|
31
|
-
{
|
|
32
|
-
logpdf( true, 3, 6 ); // $ExpectError
|
|
33
|
-
logpdf( false, 2, 4 ); // $ExpectError
|
|
34
|
-
logpdf( '5', 1, 2 ); // $ExpectError
|
|
35
|
-
logpdf( [], 1, 2 ); // $ExpectError
|
|
36
|
-
logpdf( {}, 2, 4 ); // $ExpectError
|
|
37
|
-
logpdf( ( x: number ): number => x, 2, 4 ); // $ExpectError
|
|
38
|
-
|
|
39
|
-
logpdf( 9, true, 12 ); // $ExpectError
|
|
40
|
-
logpdf( 9, false, 12 ); // $ExpectError
|
|
41
|
-
logpdf( 5, '5', 10 ); // $ExpectError
|
|
42
|
-
logpdf( 8, [], 16 ); // $ExpectError
|
|
43
|
-
logpdf( 9, {}, 18 ); // $ExpectError
|
|
44
|
-
logpdf( 8, ( x: number ): number => x, 16 ); // $ExpectError
|
|
45
|
-
|
|
46
|
-
logpdf( 9, 5, true ); // $ExpectError
|
|
47
|
-
logpdf( 9, 5, false ); // $ExpectError
|
|
48
|
-
logpdf( 5, 2, '5' ); // $ExpectError
|
|
49
|
-
logpdf( 8, 4, [] ); // $ExpectError
|
|
50
|
-
logpdf( 9, 4, {} ); // $ExpectError
|
|
51
|
-
logpdf( 8, 5, ( x: number ): number => x ); // $ExpectError
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
55
|
-
{
|
|
56
|
-
logpdf(); // $ExpectError
|
|
57
|
-
logpdf( 2 ); // $ExpectError
|
|
58
|
-
logpdf( 2, 0 ); // $ExpectError
|
|
59
|
-
logpdf( 2, 0, 4, 1 ); // $ExpectError
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Attached to main export is a `factory` method which returns a function...
|
|
63
|
-
{
|
|
64
|
-
logpdf.factory( 3, 4 ); // $ExpectType Unary
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// The `factory` method returns a function which returns a number...
|
|
68
|
-
{
|
|
69
|
-
const fcn = logpdf.factory( 3, 4 );
|
|
70
|
-
fcn( 2 ); // $ExpectType number
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// The compiler throws an error if the function returned by the `factory` method is provided invalid arguments...
|
|
74
|
-
{
|
|
75
|
-
const fcn = logpdf.factory( 3, 4 );
|
|
76
|
-
fcn( true ); // $ExpectError
|
|
77
|
-
fcn( false ); // $ExpectError
|
|
78
|
-
fcn( '5' ); // $ExpectError
|
|
79
|
-
fcn( [] ); // $ExpectError
|
|
80
|
-
fcn( {} ); // $ExpectError
|
|
81
|
-
fcn( ( x: number ): number => x ); // $ExpectError
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments...
|
|
85
|
-
{
|
|
86
|
-
const fcn = logpdf.factory( 3, 4 );
|
|
87
|
-
fcn(); // $ExpectError
|
|
88
|
-
fcn( 2, 0 ); // $ExpectError
|
|
89
|
-
fcn( 2, 0, 1 ); // $ExpectError
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The compiler throws an error if the `factory` method is provided values other than two numbers...
|
|
93
|
-
{
|
|
94
|
-
logpdf.factory( true, 3 ); // $ExpectError
|
|
95
|
-
logpdf.factory( false, 2 ); // $ExpectError
|
|
96
|
-
logpdf.factory( '5', 1 ); // $ExpectError
|
|
97
|
-
logpdf.factory( [], 1 ); // $ExpectError
|
|
98
|
-
logpdf.factory( {}, 2 ); // $ExpectError
|
|
99
|
-
logpdf.factory( ( x: number ): number => x, 2 ); // $ExpectError
|
|
100
|
-
|
|
101
|
-
logpdf.factory( 9, true ); // $ExpectError
|
|
102
|
-
logpdf.factory( 9, false ); // $ExpectError
|
|
103
|
-
logpdf.factory( 5, '5' ); // $ExpectError
|
|
104
|
-
logpdf.factory( 8, [] ); // $ExpectError
|
|
105
|
-
logpdf.factory( 9, {} ); // $ExpectError
|
|
106
|
-
logpdf.factory( 8, ( x: number ): number => x ); // $ExpectError
|
|
107
|
-
|
|
108
|
-
logpdf.factory( [], true ); // $ExpectError
|
|
109
|
-
logpdf.factory( {}, false ); // $ExpectError
|
|
110
|
-
logpdf.factory( false, '5' ); // $ExpectError
|
|
111
|
-
logpdf.factory( {}, [] ); // $ExpectError
|
|
112
|
-
logpdf.factory( '5', ( x: number ): number => x ); // $ExpectError
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// The compiler throws an error if the `factory` method is provided an unsupported number of arguments...
|
|
116
|
-
{
|
|
117
|
-
logpdf.factory( 0 ); // $ExpectError
|
|
118
|
-
logpdf.factory( 0, 4, 8 ); // $ExpectError
|
|
119
|
-
}
|
|
File without changes
|