@stdlib/stats-base-dists-triangular-logpdf 0.0.7 → 0.1.1
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/NOTICE +1 -1
- package/README.md +15 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -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 +15 -15
- package/docs/repl.txt +0 -84
- package/docs/types/test.ts +0 -141
- /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/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] -->
|
|
@@ -200,7 +211,7 @@ See [LICENSE][stdlib-license].
|
|
|
200
211
|
|
|
201
212
|
## Copyright
|
|
202
213
|
|
|
203
|
-
Copyright © 2016-
|
|
214
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
204
215
|
|
|
205
216
|
</section>
|
|
206
217
|
|
|
@@ -213,8 +224,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
213
224
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-triangular-logpdf.svg
|
|
214
225
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-triangular-logpdf
|
|
215
226
|
|
|
216
|
-
[test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-logpdf/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
217
|
-
[test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-logpdf/actions/workflows/test.yml?query=branch:v0.
|
|
227
|
+
[test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-logpdf/actions/workflows/test.yml/badge.svg?branch=v0.1.1
|
|
228
|
+
[test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-logpdf/actions/workflows/test.yml?query=branch:v0.1.1
|
|
218
229
|
|
|
219
230
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-triangular-logpdf/main.svg
|
|
220
231
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-triangular-logpdf?branch=main
|
|
@@ -227,7 +238,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
227
238
|
-->
|
|
228
239
|
|
|
229
240
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
230
|
-
[chat-url]: https://gitter.im
|
|
241
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
231
242
|
|
|
232
243
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
233
244
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var y=m(function(z,p){
|
|
2
|
+
var s=require('@stdlib/math-base-assert-is-nan/dist'),u=require('@stdlib/math-base-special-ln/dist'),l=require('@stdlib/constants-float64-ninf/dist'),N=require('@stdlib/constants-float64-ln-two/dist');function O(e,r,n,i){var o,v,a;return s(e)||s(r)||s(n)||s(i)||r>i||i>n?NaN:e<r?l:(o=u(n-r)+u(i-r),v=u(n-r),a=u(n-r)+u(n-i),e<i?N+u(e-r)-o:e===i?N-v:e<=n?N+u(n-e)-a:l)}p.exports=O
|
|
3
|
+
});var I=m(function(A,g){
|
|
4
|
+
var R=require('@stdlib/utils-constant-function/dist'),q=require('@stdlib/math-base-assert-is-nan/dist'),f=require('@stdlib/math-base-special-ln/dist'),F=require('@stdlib/constants-float64-ninf/dist'),d=require('@stdlib/constants-float64-ln-two/dist');function h(e,r,n){var i,o,v;if(q(e)||q(r)||q(n)||e>n||n>r)return R(NaN);return i=f(r-e)+f(n-e),o=f(r-e),v=f(r-e)+f(r-n),a;function a(t){return q(t)?NaN:t<e?F:t<n?d+f(t-e)-i:t===n?d-o:t<=r?d+f(r-t)-v:F}}g.exports=h
|
|
5
|
+
});var j=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),L=y(),k=I();j(L,"factory",k);module.exports=L;
|
|
6
|
+
/** @license Apache-2.0 */
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 ln = require( '@stdlib/math-base-special-ln' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar LN2 = require( '@stdlib/constants-float64-ln-two' );\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a` and upper limit `b` and mode `c` at a value `x`.\n*\n* @param {number} x - input value\n* @param {number} a - lower limit\n* @param {number} b - upper limit\n* @param {number} c - mode\n* @returns {number} evaluated logPDF\n*\n* @example\n* var y = logpdf( 0.5, -1.0, 1.0, 0.0 );\n* // returns ~-0.693\n*\n* @example\n* var y = logpdf( 0.5, -1.0, 1.0, 0.5 );\n* // returns 0.0\n*\n* @example\n* var y = logpdf( -10.0, -20.0, 0.0, -2.0 );\n* // returns ~-2.89\n*\n* @example\n* var y = logpdf( -2.0, -1.0, 1.0, 0.0 );\n* // returns -Infinity\n*\n* @example\n* var y = logpdf( NaN, 0.0, 1.0, 0.5 );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 0.0, NaN, 1.0, 0.5 );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 0.0, 0.0, NaN, 0.5 );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 2.0, 1.0, 0.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = logpdf( 2.0, 1.0, 0.0, 1.5 );\n* // returns NaN\n*/\nfunction logpdf( x, a, b, c ) {\n\tvar denom1;\n\tvar denom2;\n\tvar denom3;\n\n\tif (\n\t\tisnan( x ) ||\n\t\tisnan( a ) ||\n\t\tisnan( b ) ||\n\t\tisnan( c ) ||\n\t\ta > c ||\n\t\tc > b\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x < a ) {\n\t\treturn NINF;\n\t}\n\tdenom1 = ln( b - a ) + ln( c - a );\n\tdenom2 = ln( b - a );\n\tdenom3 = ln( b - a ) + ln( b - c );\n\n\t// Case: x >= a\n\tif ( x < c ) {\n\t\treturn LN2 + ln( x - a ) - denom1;\n\t}\n\tif ( x === c ) {\n\t\treturn LN2 - denom2;\n\t}\n\t// Case: x > c\n\tif ( x <= b ) {\n\t\treturn LN2 + ln( b - x ) - denom3;\n\t}\n\t// Case: x > b\n\treturn NINF;\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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar LN2 = require( '@stdlib/constants-float64-ln-two' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the natural logarithm of the probability density function (PDF) for a triangular distribution with lower limit `a` and upper limit `b` and mode `c`.\n*\n* @param {number} a - lower limit\n* @param {number} b - upper limit\n* @param {number} c - mode\n* @returns {Function} logPDF\n*\n* @example\n* var logpdf = factory( 0.0, 10.0, 5.0 );\n* var y = logpdf( 2.0 );\n* // returns ~-2.526\n*\n* y = logpdf( 12.0 );\n* // returns -Infinity\n*/\nfunction factory( a, b, c ) {\n\tvar denom1;\n\tvar denom2;\n\tvar denom3;\n\n\tif (\n\t\tisnan( a ) ||\n\t\tisnan( b ) ||\n\t\tisnan( c ) ||\n\t\ta > c ||\n\t\tc > b\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\n\tdenom1 = ln( b - a ) + ln( c - a );\n\tdenom2 = ln( b - a );\n\tdenom3 = ln( b - a ) + ln( b - c );\n\treturn logpdf;\n\n\t/**\n\t* Evaluates the natural logarithm of the probability density function (PDF) for a triangular 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( 12.0 );\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 < a ) {\n\t\t\treturn NINF;\n\t\t}\n\t\t// Case: x >= a\n\t\tif ( x < c ) {\n\t\t\treturn LN2 + ln( x - a ) - denom1;\n\t\t}\n\t\tif ( x === c ) {\n\t\t\treturn LN2 - denom2;\n\t\t}\n\t\t// Case: x > c\n\t\tif ( x <= b ) {\n\t\t\treturn LN2 + ln( b - x ) - denom3;\n\t\t}\n\t\t// Case: x > b\n\t\treturn NINF;\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* Triangular distribution logarithm of probability density function (PDF).\n*\n* @module @stdlib/stats-base-dists-triangular-logpdf\n*\n* @example\n* var logpdf = require( '@stdlib/stats-base-dists-triangular-logpdf' );\n*\n* var y = logpdf( 0.5, -1.0, 1.0, 0.0 );\n* // returns ~-0.693\n*\n* y = logpdf( 0.5, -1.0, 1.0, 0.5 );\n* // returns 0.0\n*\n* y = logpdf( -10.0, -20.0, 0.0, -2.0 );\n* // returns ~-2.89\n*\n* var mylogpdf = logpdf.factory( 0.0, 10.0, 5.0 );\n* y = mylogpdf( 2.0 );\n* // returns ~-2.526\n*\n* y = mylogpdf( 12.0 );\n* // returns -Infinity\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": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAK,QAAS,8BAA+B,EAC7CC,EAAO,QAAS,gCAAiC,EACjDC,EAAM,QAAS,kCAAmC,EAkDtD,SAASC,EAAQC,EAAGC,EAAGC,EAAGC,EAAI,CAC7B,IAAIC,EACAC,EACAC,EAEJ,OACCX,EAAOK,CAAE,GACTL,EAAOM,CAAE,GACTN,EAAOO,CAAE,GACTP,EAAOQ,CAAE,GACTF,EAAIE,GACJA,EAAID,EAEG,IAEHF,EAAIC,EACDJ,GAERO,EAASR,EAAIM,EAAID,CAAE,EAAIL,EAAIO,EAAIF,CAAE,EACjCI,EAAST,EAAIM,EAAID,CAAE,EACnBK,EAASV,EAAIM,EAAID,CAAE,EAAIL,EAAIM,EAAIC,CAAE,EAG5BH,EAAIG,EACDL,EAAMF,EAAII,EAAIC,CAAE,EAAIG,EAEvBJ,IAAMG,EACHL,EAAMO,EAGTL,GAAKE,EACFJ,EAAMF,EAAIM,EAAIF,CAAE,EAAIM,EAGrBT,EACR,CAKAH,EAAO,QAAUK,ICnHjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAQ,QAAS,iCAAkC,EACnDC,EAAK,QAAS,8BAA+B,EAC7CC,EAAO,QAAS,gCAAiC,EACjDC,EAAM,QAAS,kCAAmC,EAqBtD,SAASC,EAASC,EAAGC,EAAGC,EAAI,CAC3B,IAAIC,EACAC,EACAC,EAEJ,GACCV,EAAOK,CAAE,GACTL,EAAOM,CAAE,GACTN,EAAOO,CAAE,GACTF,EAAIE,GACJA,EAAID,EAEJ,OAAOP,EAAkB,GAAI,EAG9B,OAAAS,EAASP,EAAIK,EAAID,CAAE,EAAIJ,EAAIM,EAAIF,CAAE,EACjCI,EAASR,EAAIK,EAAID,CAAE,EACnBK,EAAST,EAAIK,EAAID,CAAE,EAAIJ,EAAIK,EAAIC,CAAE,EAC1BI,EAaP,SAASA,EAAQC,EAAI,CACpB,OAAKZ,EAAOY,CAAE,EACN,IAEHA,EAAIP,EACDH,EAGHU,EAAIL,EACDJ,EAAMF,EAAIW,EAAIP,CAAE,EAAIG,EAEvBI,IAAML,EACHJ,EAAMM,EAGTG,GAAKN,EACFH,EAAMF,EAAIK,EAAIM,CAAE,EAAIF,EAGrBR,CACR,CACD,CAKAJ,EAAO,QAAUM,ICzDjB,IAAIS,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "ln", "NINF", "LN2", "logpdf", "x", "a", "b", "c", "denom1", "denom2", "denom3", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "isnan", "ln", "NINF", "LN2", "factory", "a", "b", "c", "denom1", "denom2", "denom3", "logpdf", "x", "setReadOnly", "main", "factory"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
// MODULES //
|
|
47
47
|
|
|
48
48
|
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
49
|
-
var
|
|
49
|
+
var main = require( './main.js' );
|
|
50
50
|
var factory = require( './factory.js' );
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
// MAIN //
|
|
54
54
|
|
|
55
|
-
setReadOnly(
|
|
55
|
+
setReadOnly( main, 'factory', factory );
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
// EXPORTS //
|
|
59
59
|
|
|
60
|
-
module.exports =
|
|
60
|
+
module.exports = main;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-base-dists-triangular-logpdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Triangular distribution logarithm of probability density function (PDF).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/constants-float64-ln-two": "^0.
|
|
41
|
-
"@stdlib/constants-float64-ninf": "^0.
|
|
42
|
-
"@stdlib/math-base-assert-is-nan": "^0.
|
|
43
|
-
"@stdlib/math-base-special-ln": "^0.
|
|
44
|
-
"@stdlib/utils-constant-function": "^0.
|
|
45
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.
|
|
40
|
+
"@stdlib/constants-float64-ln-two": "^0.1.1",
|
|
41
|
+
"@stdlib/constants-float64-ninf": "^0.1.1",
|
|
42
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.1",
|
|
43
|
+
"@stdlib/math-base-special-ln": "^0.1.1",
|
|
44
|
+
"@stdlib/utils-constant-function": "^0.1.1",
|
|
45
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@stdlib/bench": "^0.0
|
|
49
|
-
"@stdlib/constants-float64-eps": "^0.
|
|
50
|
-
"@stdlib/constants-float64-pinf": "^0.
|
|
51
|
-
"@stdlib/math-base-special-abs": "^0.0
|
|
52
|
-
"@stdlib/random-base-randu": "^0.0
|
|
48
|
+
"@stdlib/bench": "^0.1.0",
|
|
49
|
+
"@stdlib/constants-float64-eps": "^0.1.1",
|
|
50
|
+
"@stdlib/constants-float64-pinf": "^0.1.1",
|
|
51
|
+
"@stdlib/math-base-special-abs": "^0.1.0",
|
|
52
|
+
"@stdlib/random-base-randu": "^0.1.0",
|
|
53
53
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
54
54
|
"istanbul": "^0.4.1",
|
|
55
|
-
"tap-
|
|
55
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=0.10.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"univariate"
|
|
88
88
|
],
|
|
89
89
|
"funding": {
|
|
90
|
-
"type": "
|
|
91
|
-
"url": "https://
|
|
90
|
+
"type": "opencollective",
|
|
91
|
+
"url": "https://opencollective.com/stdlib"
|
|
92
92
|
}
|
|
93
93
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( x, a, b, c )
|
|
3
|
-
Evaluates the natural logarithm of the probability density function (PDF)
|
|
4
|
-
for a triangular distribution with minimum support `a`, maximum support `b`,
|
|
5
|
-
and mode `c` at a value `x`.
|
|
6
|
-
|
|
7
|
-
If the condition `a <= c <= b` is not satisfied, the function returns `NaN`.
|
|
8
|
-
|
|
9
|
-
If either `a`, `b`, or `c` is `NaN`, the function returns `NaN`.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
x: number
|
|
14
|
-
Input value.
|
|
15
|
-
|
|
16
|
-
a: number
|
|
17
|
-
Minimum support.
|
|
18
|
-
|
|
19
|
-
b: number
|
|
20
|
-
Maximum support.
|
|
21
|
-
|
|
22
|
-
c: number
|
|
23
|
-
Mode.
|
|
24
|
-
|
|
25
|
-
Returns
|
|
26
|
-
-------
|
|
27
|
-
out: number
|
|
28
|
-
Evaluated logPDF.
|
|
29
|
-
|
|
30
|
-
Examples
|
|
31
|
-
--------
|
|
32
|
-
> var y = {{alias}}( 0.5, -1.0, 1.0, 0.0 )
|
|
33
|
-
~-0.693
|
|
34
|
-
> y = {{alias}}( 0.5, -1.0, 1.0, 0.5 )
|
|
35
|
-
0.0
|
|
36
|
-
> y = {{alias}}( -10.0, -20.0, 0.0, -2.0 )
|
|
37
|
-
~-2.89
|
|
38
|
-
> y = {{alias}}( -2.0, -1.0, 1.0, 0.0 )
|
|
39
|
-
-Infinity
|
|
40
|
-
> y = {{alias}}( NaN, 0.0, 1.0, 0.5 )
|
|
41
|
-
NaN
|
|
42
|
-
> y = {{alias}}( 0.0, NaN, 1.0, 0.5 )
|
|
43
|
-
NaN
|
|
44
|
-
> y = {{alias}}( 0.0, 0.0, NaN, 0.5 )
|
|
45
|
-
NaN
|
|
46
|
-
> y = {{alias}}( 2.0, 1.0, 0.0, NaN )
|
|
47
|
-
NaN
|
|
48
|
-
> y = {{alias}}( 2.0, 1.0, 0.0, 1.5 )
|
|
49
|
-
NaN
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{{alias}}.factory( a, b, c )
|
|
53
|
-
Returns a function for evaluating the natural logarithm of the probability
|
|
54
|
-
density function (PDF) of a triangular distribution with minimum support
|
|
55
|
-
`a`, maximum support `b`, and mode `c`.
|
|
56
|
-
|
|
57
|
-
Parameters
|
|
58
|
-
----------
|
|
59
|
-
a: number
|
|
60
|
-
Minimum support.
|
|
61
|
-
|
|
62
|
-
b: number
|
|
63
|
-
Maximum support.
|
|
64
|
-
|
|
65
|
-
c: number
|
|
66
|
-
Mode.
|
|
67
|
-
|
|
68
|
-
Returns
|
|
69
|
-
-------
|
|
70
|
-
logpdf: Function
|
|
71
|
-
Logarithm of probability density function (PDF).
|
|
72
|
-
|
|
73
|
-
Examples
|
|
74
|
-
--------
|
|
75
|
-
> var mylogpdf = {{alias}}.factory( 0.0, 10.0, 5.0 );
|
|
76
|
-
> var y = mylogpdf( 2.0 )
|
|
77
|
-
~-2.526
|
|
78
|
-
> y = mylogpdf( 12.0 )
|
|
79
|
-
-Infinity
|
|
80
|
-
|
|
81
|
-
See Also
|
|
82
|
-
--------
|
|
83
|
-
|
|
84
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,141 +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, 5 ); // $ExpectType number
|
|
27
|
-
logpdf( 1, 2, 8, 4 ); // $ExpectType number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// The compiler throws an error if the function is provided values other than four numbers...
|
|
31
|
-
{
|
|
32
|
-
logpdf( true, 3, 6, 5 ); // $ExpectError
|
|
33
|
-
logpdf( false, 2, 4, 3 ); // $ExpectError
|
|
34
|
-
logpdf( '5', 1, 2, 1.5 ); // $ExpectError
|
|
35
|
-
logpdf( [], 1, 2, 1.5 ); // $ExpectError
|
|
36
|
-
logpdf( {}, 2, 4, 3 ); // $ExpectError
|
|
37
|
-
logpdf( ( x: number ): number => x, 2, 4, 3 ); // $ExpectError
|
|
38
|
-
|
|
39
|
-
logpdf( 9, true, 12, 8 ); // $ExpectError
|
|
40
|
-
logpdf( 9, false, 12, 8 ); // $ExpectError
|
|
41
|
-
logpdf( 5, '5', 10, 8 ); // $ExpectError
|
|
42
|
-
logpdf( 8, [], 16, 8 ); // $ExpectError
|
|
43
|
-
logpdf( 9, {}, 18, 8 ); // $ExpectError
|
|
44
|
-
logpdf( 8, ( x: number ): number => x, 16, 8 ); // $ExpectError
|
|
45
|
-
|
|
46
|
-
logpdf( 9, 5, true, 8 ); // $ExpectError
|
|
47
|
-
logpdf( 9, 5, false, 9 ); // $ExpectError
|
|
48
|
-
logpdf( 5, 2, '5', 8 ); // $ExpectError
|
|
49
|
-
logpdf( 8, 4, [], 8 ); // $ExpectError
|
|
50
|
-
logpdf( 9, 4, {}, 8 ); // $ExpectError
|
|
51
|
-
logpdf( 8, 5, ( x: number ): number => x, 8 ); // $ExpectError
|
|
52
|
-
|
|
53
|
-
logpdf( 9, 5, 10, true ); // $ExpectError
|
|
54
|
-
logpdf( 9, 5, 10, false ); // $ExpectError
|
|
55
|
-
logpdf( 5, 2, 4, '5' ); // $ExpectError
|
|
56
|
-
logpdf( 8, 4, 8, [] ); // $ExpectError
|
|
57
|
-
logpdf( 9, 4, 8, {} ); // $ExpectError
|
|
58
|
-
logpdf( 8, 5, 10, ( x: number ): number => x ); // $ExpectError
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
62
|
-
{
|
|
63
|
-
logpdf(); // $ExpectError
|
|
64
|
-
logpdf( 2 ); // $ExpectError
|
|
65
|
-
logpdf( 2, 0 ); // $ExpectError
|
|
66
|
-
logpdf( 2, 0, 4 ); // $ExpectError
|
|
67
|
-
logpdf( 2, 0, 4, 1, 5 ); // $ExpectError
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Attached to main export is a `factory` method which returns a function...
|
|
71
|
-
{
|
|
72
|
-
logpdf.factory( 3, 5, 4 ); // $ExpectType Unary
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// The `factory` method returns a function which returns a number...
|
|
76
|
-
{
|
|
77
|
-
const fcn = logpdf.factory( 3, 5, 4 );
|
|
78
|
-
fcn( 2 ); // $ExpectType number
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// The compiler throws an error if the function returned by the `factory` method is provided invalid arguments...
|
|
82
|
-
{
|
|
83
|
-
const fcn = logpdf.factory( 3, 5, 4 );
|
|
84
|
-
fcn( true ); // $ExpectError
|
|
85
|
-
fcn( false ); // $ExpectError
|
|
86
|
-
fcn( '5' ); // $ExpectError
|
|
87
|
-
fcn( [] ); // $ExpectError
|
|
88
|
-
fcn( {} ); // $ExpectError
|
|
89
|
-
fcn( ( x: number ): number => x ); // $ExpectError
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments...
|
|
93
|
-
{
|
|
94
|
-
const fcn = logpdf.factory( 3, 5, 4 );
|
|
95
|
-
fcn(); // $ExpectError
|
|
96
|
-
fcn( 2, 0 ); // $ExpectError
|
|
97
|
-
fcn( 2, 0, 1 ); // $ExpectError
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// The compiler throws an error if the `factory` method is provided values other than three numbers...
|
|
101
|
-
{
|
|
102
|
-
logpdf.factory( true, 3, 2 ); // $ExpectError
|
|
103
|
-
logpdf.factory( false, 3, 2 ); // $ExpectError
|
|
104
|
-
logpdf.factory( '5', 1, 0.5 ); // $ExpectError
|
|
105
|
-
logpdf.factory( [], 1, 0.5 ); // $ExpectError
|
|
106
|
-
logpdf.factory( {}, 2, 0.5 ); // $ExpectError
|
|
107
|
-
logpdf.factory( ( x: number ): number => x, 2, 1 ); // $ExpectError
|
|
108
|
-
|
|
109
|
-
logpdf.factory( 9, true, 2 ); // $ExpectError
|
|
110
|
-
logpdf.factory( 9, false, 2 ); // $ExpectError
|
|
111
|
-
logpdf.factory( 5, '5', 3 ); // $ExpectError
|
|
112
|
-
logpdf.factory( 8, [], 3 ); // $ExpectError
|
|
113
|
-
logpdf.factory( 9, {}, 3 ); // $ExpectError
|
|
114
|
-
logpdf.factory( 8, ( x: number ): number => x, 3 ); // $ExpectError
|
|
115
|
-
|
|
116
|
-
logpdf.factory( 9, 10, true ); // $ExpectError
|
|
117
|
-
logpdf.factory( 9, 18, false ); // $ExpectError
|
|
118
|
-
logpdf.factory( 5, 10, '5' ); // $ExpectError
|
|
119
|
-
logpdf.factory( 8, 16, [] ); // $ExpectError
|
|
120
|
-
logpdf.factory( 9, 18, {} ); // $ExpectError
|
|
121
|
-
logpdf.factory( 8, 16, ( x: number ): number => x ); // $ExpectError
|
|
122
|
-
|
|
123
|
-
logpdf.factory( [], true, 3 ); // $ExpectError
|
|
124
|
-
logpdf.factory( {}, false, 3 ); // $ExpectError
|
|
125
|
-
logpdf.factory( false, '5', 3 ); // $ExpectError
|
|
126
|
-
logpdf.factory( {}, [], 3 ); // $ExpectError
|
|
127
|
-
logpdf.factory( '5', ( x: number ): number => x, 3 ); // $ExpectError
|
|
128
|
-
|
|
129
|
-
logpdf.factory( [], true, [] ); // $ExpectError
|
|
130
|
-
logpdf.factory( {}, false, {} ); // $ExpectError
|
|
131
|
-
logpdf.factory( false, '5', false ); // $ExpectError
|
|
132
|
-
logpdf.factory( {}, [], '1' ); // $ExpectError
|
|
133
|
-
logpdf.factory( '5', ( x: number ): number => x, ( x: number ): number => x ); // $ExpectError
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// The compiler throws an error if the `factory` method is provided an unsupported number of arguments...
|
|
137
|
-
{
|
|
138
|
-
logpdf.factory( 0 ); // $ExpectError
|
|
139
|
-
logpdf.factory( 0, 4 ); // $ExpectError
|
|
140
|
-
logpdf.factory( 0, 4, 3, 7 ); // $ExpectError
|
|
141
|
-
}
|
|
File without changes
|