@ohos-ports/stdlib-math-base-special-gammaln 0.3.1-beta.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.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 0.020580808432516733;
40
+ }
41
+ return 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 1.3920053346762105;
40
+ }
41
+ return 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 0.21498241596060885;
40
+ }
41
+ return 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return -0.032788541075985965;
40
+ }
41
+ return -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 0.01797067508118204;
40
+ }
41
+ return 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return -0.010314224129834144;
40
+ }
41
+ return -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 0.6328270640250934;
40
+ }
41
+ return 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 2.4559779371304113;
40
+ }
41
+ return 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MAIN //
23
+
24
+ /**
25
+ * Evaluates a polynomial.
26
+ *
27
+ * ## Notes
28
+ *
29
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
30
+ *
31
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
32
+ *
33
+ * @private
34
+ * @param {number} x - value at which to evaluate the polynomial
35
+ * @returns {number} evaluated polynomial
36
+ */
37
+ function evalpoly( x ) {
38
+ if ( x === 0.0 ) {
39
+ return 0.08333333333333297;
40
+ }
41
+ return 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); // eslint-disable-line max-len
42
+ }
43
+
44
+
45
+ // EXPORTS //
46
+
47
+ module.exports = evalpoly;
package/manifest.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "options": {
3
+ "task": "build"
4
+ },
5
+ "fields": [
6
+ {
7
+ "field": "src",
8
+ "resolve": true,
9
+ "relative": true
10
+ },
11
+ {
12
+ "field": "include",
13
+ "resolve": true,
14
+ "relative": true
15
+ },
16
+ {
17
+ "field": "libraries",
18
+ "resolve": false,
19
+ "relative": false
20
+ },
21
+ {
22
+ "field": "libpath",
23
+ "resolve": true,
24
+ "relative": false
25
+ }
26
+ ],
27
+ "confs": [
28
+ {
29
+ "task": "build",
30
+ "src": [
31
+ "./src/main.c"
32
+ ],
33
+ "include": [
34
+ "./include"
35
+ ],
36
+ "libraries": [],
37
+ "libpath": [],
38
+ "dependencies": [
39
+ "@stdlib/math-base-napi-unary",
40
+ "@stdlib/math-base-assert-is-nan",
41
+ "@stdlib/math-base-assert-is-infinite",
42
+ "@stdlib/math-base-special-abs",
43
+ "@stdlib/math-base-special-ln",
44
+ "@stdlib/math-base-special-trunc",
45
+ "@stdlib/math-base-special-sinpi",
46
+ "@stdlib/constants-float64-pinf",
47
+ "@stdlib/constants-float64-pi"
48
+ ]
49
+ },
50
+ {
51
+ "task": "benchmark",
52
+ "src": [
53
+ "./src/main.c"
54
+ ],
55
+ "include": [
56
+ "./include"
57
+ ],
58
+ "libraries": [],
59
+ "libpath": [],
60
+ "dependencies": [
61
+ "@stdlib/math-base-assert-is-nan",
62
+ "@stdlib/math-base-assert-is-infinite",
63
+ "@stdlib/math-base-special-abs",
64
+ "@stdlib/math-base-special-ln",
65
+ "@stdlib/math-base-special-trunc",
66
+ "@stdlib/math-base-special-sinpi",
67
+ "@stdlib/constants-float64-pinf",
68
+ "@stdlib/constants-float64-pi"
69
+ ]
70
+ },
71
+ {
72
+ "task": "examples",
73
+ "src": [
74
+ "./src/main.c"
75
+ ],
76
+ "include": [
77
+ "./include"
78
+ ],
79
+ "libraries": [],
80
+ "libpath": [],
81
+ "dependencies": [
82
+ "@stdlib/math-base-assert-is-nan",
83
+ "@stdlib/math-base-assert-is-infinite",
84
+ "@stdlib/math-base-special-abs",
85
+ "@stdlib/math-base-special-ln",
86
+ "@stdlib/math-base-special-trunc",
87
+ "@stdlib/math-base-special-sinpi",
88
+ "@stdlib/constants-float64-pinf",
89
+ "@stdlib/constants-float64-pi"
90
+ ]
91
+ }
92
+ ]
93
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@ohos-ports/stdlib-math-base-special-gammaln",
3
+ "version": "0.3.1-beta.0",
4
+ "description": "Natural logarithm of the gamma function.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "gypfile": false,
18
+ "directories": {
19
+ "doc": "./docs",
20
+ "include": "./include",
21
+ "lib": "./lib",
22
+ "scripts": "./scripts",
23
+ "src": "./src",
24
+ "dist": "./dist"
25
+ },
26
+ "types": "./docs/types",
27
+ "scripts": {},
28
+ "homepage": "https://stdlib.io",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/ohos-ports/ohos-ports.git",
32
+ "directory": "ports/stdlib-math-base-special-gammaln/0.3.1"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/ohos-ports/ohos-ports/issues"
36
+ },
37
+ "dependencies": {
38
+ "@stdlib/constants-float64-pi": "^0.2.3",
39
+ "@stdlib/constants-float64-pinf": "^0.2.3",
40
+ "@stdlib/math-base-assert-is-infinite": "^0.2.3",
41
+ "@stdlib/math-base-assert-is-nan": "^0.2.3",
42
+ "@stdlib/math-base-napi-unary": "^0.2.7",
43
+ "@stdlib/math-base-special-abs": "^0.2.3",
44
+ "@stdlib/math-base-special-ln": "^0.2.5",
45
+ "@stdlib/math-base-special-sinpi": "^0.3.0",
46
+ "@stdlib/math-base-special-trunc": "^0.2.3",
47
+ "@stdlib/utils-library-manifest": "^0.2.4"
48
+ },
49
+ "devDependencies": {},
50
+ "engines": {
51
+ "node": ">=0.10.0",
52
+ "npm": ">2.7.0"
53
+ },
54
+ "os": [
55
+ "aix",
56
+ "darwin",
57
+ "freebsd",
58
+ "linux",
59
+ "macos",
60
+ "openbsd",
61
+ "sunos",
62
+ "win32",
63
+ "windows",
64
+ "openharmony"
65
+ ],
66
+ "keywords": [
67
+ "stdlib",
68
+ "stdmath",
69
+ "mathematics",
70
+ "math",
71
+ "special function",
72
+ "special",
73
+ "function",
74
+ "gamma",
75
+ "factorial",
76
+ "natural",
77
+ "logarithm",
78
+ "log",
79
+ "ln",
80
+ "lgamma",
81
+ "number"
82
+ ],
83
+ "funding": {
84
+ "type": "opencollective",
85
+ "url": "https://opencollective.com/stdlib"
86
+ }
87
+ }
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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/math/base/special/gammaln.h"
20
+ #include "stdlib/math/base/napi/unary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_gammaln )