@stdlib/math-base-special-trigammaf 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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #ifndef STDLIB_MATH_BASE_SPECIAL_TRIGAMMAF_H
20
+ #define STDLIB_MATH_BASE_SPECIAL_TRIGAMMAF_H
21
+
22
+ /*
23
+ * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
24
+ */
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
28
+
29
+ /**
30
+ * Evaluates the trigamma function for a single-precision floating-point number.
31
+ */
32
+ float stdlib_base_trigammaf( const float x );
33
+
34
+ #ifdef __cplusplus
35
+ }
36
+ #endif
37
+
38
+ #endif // !STDLIB_MATH_BASE_SPECIAL_TRIGAMMAF_H
package/lib/index.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ /**
22
+ * Evaluate the trigamma function for a single-precision floating-point number.
23
+ *
24
+ * @module @stdlib/math-base-special-trigammaf
25
+ *
26
+ * @example
27
+ * var trigammaf = require( '@stdlib/math-base-special-trigammaf' );
28
+ *
29
+ * var v = trigammaf( -2.5 );
30
+ * // returns ~9.539
31
+ *
32
+ * v = trigammaf( 1.0 );
33
+ * // returns ~1.645
34
+ *
35
+ * v = trigammaf( 10.0 );
36
+ * // returns ~0.105
37
+ *
38
+ * v = trigammaf( NaN );
39
+ * // returns NaN
40
+ *
41
+ * v = trigammaf( -1.0 );
42
+ * // returns NaN
43
+ */
44
+
45
+ // MODULES //
46
+
47
+ var main = require( './main.js' );
48
+
49
+
50
+ // EXPORTS //
51
+
52
+ module.exports = main;
package/lib/main.js ADDED
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ *
19
+ * ## Notice
20
+ *
21
+ * The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_88_0/boost/math/special_functions/trigamma.hpp}. The implementation follows the original but has been reformatted and modified for JavaScript.
22
+ *
23
+ * ```text
24
+ * (C) Copyright John Maddock 2006.
25
+ *
26
+ * Use, modification and distribution are subject to the
27
+ * Boost Software License, Version 1.0. (See accompanying file
28
+ * LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
29
+ * ```
30
+ */
31
+
32
+ 'use strict';
33
+
34
+ // MODULES //
35
+
36
+ var f32 = require( '@stdlib/number-float64-base-to-float32' );
37
+ var sinpif = require( '@stdlib/math-base-special-sinpif' );
38
+ var absf = require( '@stdlib/math-base-special-absf' );
39
+ var floorf = require( '@stdlib/math-base-special-floorf' );
40
+ var PI_SQUARED = require( '@stdlib/constants-float32-pi-squared' );
41
+ var rateval12 = require( './rational_p12q12.js' );
42
+ var rateval24 = require( './rational_p24q24.js' );
43
+ var rateval4INF = require( './rational_p4infq4inf.js' );
44
+
45
+
46
+ // VARIABLES //
47
+
48
+ var YOFFSET12 = f32( 2.1093254089355469 );
49
+ var ZERO = f32( 0.0 );
50
+ var ONE = f32( 1.0 );
51
+ var TWO = f32( 2.0 );
52
+ var FOUR = f32( 4.0 );
53
+
54
+
55
+ // MAIN //
56
+
57
+ /**
58
+ * Evaluates the trigamma function for a single-precision floating-point number.
59
+ *
60
+ * @param {number} x - input value
61
+ * @returns {number} function value
62
+ *
63
+ * @example
64
+ * var v = trigammaf( -2.5 );
65
+ * // returns ~9.539
66
+ *
67
+ * @example
68
+ * var v = trigammaf( 1.0 );
69
+ * // returns ~1.645
70
+ *
71
+ * @example
72
+ * var v = trigammaf( 10.0 );
73
+ * // returns ~0.105
74
+ *
75
+ * @example
76
+ * var v = trigammaf( NaN );
77
+ * // returns NaN
78
+ *
79
+ * @example
80
+ * var v = trigammaf( -1.0 );
81
+ * // returns NaN
82
+ */
83
+ function trigammaf( x ) {
84
+ var result;
85
+ var s;
86
+ var y;
87
+ var z;
88
+
89
+ x = f32( x );
90
+ result = ZERO;
91
+
92
+ // Check for negative arguments and use reflection:
93
+ if ( x <= ZERO ) {
94
+ if ( floorf( x ) === x ) {
95
+ return NaN;
96
+ }
97
+ // Reflect:
98
+ z = f32( ONE - x );
99
+ if ( z < ONE ) {
100
+ result = f32( ONE / f32( z*z ) );
101
+ z = f32( ONE + z );
102
+ }
103
+ s = ( absf( x ) < absf( z ) ) ? sinpif( x ) : sinpif( z );
104
+ return f32( f32( result - trigammaf( z ) ) + f32( PI_SQUARED / f32( s*s ) ) );
105
+ }
106
+ if ( x < ONE ) {
107
+ result = f32( ONE / f32( x*x ) );
108
+ x = f32( x + ONE );
109
+ }
110
+ if ( x <= TWO ) {
111
+ result = f32( result + f32( f32( YOFFSET12 + rateval12( x ) ) / f32( x*x ) ) );
112
+ } else if ( x <= FOUR ) {
113
+ y = f32( ONE / x );
114
+ result = f32( result + f32( f32( ONE + rateval24( y ) ) / x ) );
115
+ } else {
116
+ y = f32( ONE / x );
117
+ result = f32( result + f32( f32( ONE + rateval4INF( y ) ) / x ) );
118
+ }
119
+ return result;
120
+ }
121
+
122
+
123
+ // EXPORTS //
124
+
125
+ module.exports = trigammaf;
package/lib/native.js ADDED
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var addon = require( './../src/addon.node' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Evaluates the trigamma function for a single-precision floating-point number.
30
+ *
31
+ * @private
32
+ * @param {number} x - input value
33
+ * @returns {number} function value
34
+ *
35
+ * @example
36
+ * var v = trigammaf( -2.5 );
37
+ * // returns ~9.539
38
+ *
39
+ * @example
40
+ * var v = trigammaf( 1.0 );
41
+ * // returns ~1.645
42
+ *
43
+ * @example
44
+ * var v = trigammaf( 10.0 );
45
+ * // returns ~0.105
46
+ *
47
+ * @example
48
+ * var v = trigammaf( NaN );
49
+ * // returns NaN
50
+ *
51
+ * @example
52
+ * var v = trigammaf( -1.0 );
53
+ * // returns NaN
54
+ */
55
+ function trigammaf( x ) {
56
+ return addon( x );
57
+ }
58
+
59
+
60
+ // EXPORTS //
61
+
62
+ module.exports = trigammaf;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MODULES //
23
+
24
+ var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)).
31
+ *
32
+ * ## Notes
33
+ *
34
+ * - Coefficients should be sorted in ascending degree.
35
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
36
+ *
37
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
38
+ *
39
+ * @private
40
+ * @param {number} x - value at which to evaluate the rational function
41
+ * @returns {number} evaluated rational function
42
+ */
43
+ function evalrational( x ) {
44
+ var ax;
45
+ var s1;
46
+ var s2;
47
+ if ( x === 0.0 ) {
48
+ return -1.109328031539917;
49
+ }
50
+ if ( x < 0.0 ) {
51
+ ax = -x;
52
+ } else {
53
+ ax = x;
54
+ }
55
+ if ( ax <= 1.0 ) {
56
+ s1 = float64ToFloat32(-1.109328031539917 + float64ToFloat32(x * float64ToFloat32(-3.8310675621032715 + float64ToFloat32(x * float64ToFloat32(-3.370384931564331 + float64ToFloat32(x * float64ToFloat32(0.2808057367801666 + float64ToFloat32(x * float64ToFloat32(1.6638069152832031 + float64ToFloat32(x * 0.6446838974952698)))))))))); // eslint-disable-line max-len
57
+ s2 = float64ToFloat32(1.0 + float64ToFloat32(x * float64ToFloat32(3.4535388946533203 + float64ToFloat32(x * float64ToFloat32(4.52089262008667 + float64ToFloat32(x * float64ToFloat32(2.7012734413146973 + float64ToFloat32(x * float64ToFloat32(0.6446880102157593 + float64ToFloat32(x * -2.031451629136427e-7)))))))))); // eslint-disable-line max-len
58
+ } else {
59
+ x = float64ToFloat32( 1.0 / x );
60
+ s1 = float64ToFloat32(0.6446838974952698 + float64ToFloat32(x * float64ToFloat32(1.6638069152832031 + float64ToFloat32(x * float64ToFloat32(0.2808057367801666 + float64ToFloat32(x * float64ToFloat32(-3.370384931564331 + float64ToFloat32(x * float64ToFloat32(-3.8310675621032715 + float64ToFloat32(x * -1.109328031539917)))))))))); // eslint-disable-line max-len
61
+ s2 = float64ToFloat32(-2.031451629136427e-7 + float64ToFloat32(x * float64ToFloat32(0.6446880102157593 + float64ToFloat32(x * float64ToFloat32(2.7012734413146973 + float64ToFloat32(x * float64ToFloat32(4.52089262008667 + float64ToFloat32(x * float64ToFloat32(3.4535388946533203 + float64ToFloat32(x * 1.0)))))))))); // eslint-disable-line max-len
62
+ }
63
+ return float64ToFloat32( s1 / s2 );
64
+ }
65
+
66
+
67
+ // EXPORTS //
68
+
69
+ module.exports = evalrational;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MODULES //
23
+
24
+ var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)).
31
+ *
32
+ * ## Notes
33
+ *
34
+ * - Coefficients should be sorted in ascending degree.
35
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
36
+ *
37
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
38
+ *
39
+ * @private
40
+ * @param {number} x - value at which to evaluate the rational function
41
+ * @returns {number} evaluated rational function
42
+ */
43
+ function evalrational( x ) {
44
+ var ax;
45
+ var s1;
46
+ var s2;
47
+ if ( x === 0.0 ) {
48
+ return -1.3803835408054965e-8;
49
+ }
50
+ if ( x < 0.0 ) {
51
+ ax = -x;
52
+ } else {
53
+ ax = x;
54
+ }
55
+ if ( ax <= 1.0 ) {
56
+ s1 = float64ToFloat32(-1.3803835408054965e-8 + float64ToFloat32(x * float64ToFloat32(0.5000004768371582 + float64ToFloat32(x * float64ToFloat32(1.6077979803085327 + float64ToFloat32(x * float64ToFloat32(2.5645434856414795 + float64ToFloat32(x * float64ToFloat32(2.0534873008728027 + float64ToFloat32(x * 0.7456697821617126)))))))))); // eslint-disable-line max-len
57
+ s2 = float64ToFloat32(1.0 + float64ToFloat32(x * float64ToFloat32(2.8822786808013916 + float64ToFloat32(x * float64ToFloat32(4.168166160583496 + float64ToFloat32(x * float64ToFloat32(2.7853527069091797 + float64ToFloat32(x * float64ToFloat32(0.7496767044067383 + float64ToFloat32(x * -0.0005706911324523389)))))))))); // eslint-disable-line max-len
58
+ } else {
59
+ x = float64ToFloat32( 1.0 / x );
60
+ s1 = float64ToFloat32(0.7456697821617126 + float64ToFloat32(x * float64ToFloat32(2.0534873008728027 + float64ToFloat32(x * float64ToFloat32(2.5645434856414795 + float64ToFloat32(x * float64ToFloat32(1.6077979803085327 + float64ToFloat32(x * float64ToFloat32(0.5000004768371582 + float64ToFloat32(x * -1.3803835408054965e-8)))))))))); // eslint-disable-line max-len
61
+ s2 = float64ToFloat32(-0.0005706911324523389 + float64ToFloat32(x * float64ToFloat32(0.7496767044067383 + float64ToFloat32(x * float64ToFloat32(2.7853527069091797 + float64ToFloat32(x * float64ToFloat32(4.168166160583496 + float64ToFloat32(x * float64ToFloat32(2.8822786808013916 + float64ToFloat32(x * 1.0)))))))))); // eslint-disable-line max-len
62
+ }
63
+ return float64ToFloat32( s1 / s2 );
64
+ }
65
+
66
+
67
+ // EXPORTS //
68
+
69
+ module.exports = evalrational;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* This is a generated file. Do not edit directly. */
20
+ 'use strict';
21
+
22
+ // MODULES //
23
+
24
+ var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\(P\\) and \\(Q\\)).
31
+ *
32
+ * ## Notes
33
+ *
34
+ * - Coefficients should be sorted in ascending degree.
35
+ * - The implementation uses [Horner's rule][horners-method] for efficient computation.
36
+ *
37
+ * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method
38
+ *
39
+ * @private
40
+ * @param {number} x - value at which to evaluate the rational function
41
+ * @returns {number} evaluated rational function
42
+ */
43
+ function evalrational( x ) {
44
+ var ax;
45
+ var s1;
46
+ var s2;
47
+ if ( x === 0.0 ) {
48
+ return 6.8947580279632365e-18;
49
+ }
50
+ if ( x < 0.0 ) {
51
+ ax = -x;
52
+ } else {
53
+ ax = x;
54
+ }
55
+ if ( ax <= 1.0 ) {
56
+ s1 = float64ToFloat32(6.8947580279632365e-18 + float64ToFloat32(x * float64ToFloat32(0.5 + float64ToFloat32(x * float64ToFloat32(1.0177274942398071 + float64ToFloat32(x * float64ToFloat32(2.498208522796631 + float64ToFloat32(x * float64ToFloat32(2.192122220993042 + float64ToFloat32(x * float64ToFloat32(1.5897035598754883 + float64ToFloat32(x * 0.40154388546943665)))))))))))); // eslint-disable-line max-len
57
+ s2 = float64ToFloat32(1.0 + float64ToFloat32(x * float64ToFloat32(1.7021214962005615 + float64ToFloat32(x * float64ToFloat32(4.429043292999268 + float64ToFloat32(x * float64ToFloat32(2.9745631217956543 + float64ToFloat32(x * float64ToFloat32(2.301361560821533 + float64ToFloat32(x * float64ToFloat32(0.2836039960384369 + float64ToFloat32(x * 0.022892987355589867)))))))))))); // eslint-disable-line max-len
58
+ } else {
59
+ x = float64ToFloat32( 1.0 / x );
60
+ s1 = float64ToFloat32(0.40154388546943665 + float64ToFloat32(x * float64ToFloat32(1.5897035598754883 + float64ToFloat32(x * float64ToFloat32(2.192122220993042 + float64ToFloat32(x * float64ToFloat32(2.498208522796631 + float64ToFloat32(x * float64ToFloat32(1.0177274942398071 + float64ToFloat32(x * float64ToFloat32(0.5 + float64ToFloat32(x * 6.8947580279632365e-18)))))))))))); // eslint-disable-line max-len
61
+ s2 = float64ToFloat32(0.022892987355589867 + float64ToFloat32(x * float64ToFloat32(0.2836039960384369 + float64ToFloat32(x * float64ToFloat32(2.301361560821533 + float64ToFloat32(x * float64ToFloat32(2.9745631217956543 + float64ToFloat32(x * float64ToFloat32(4.429043292999268 + float64ToFloat32(x * float64ToFloat32(1.7021214962005615 + float64ToFloat32(x * 1.0)))))))))))); // eslint-disable-line max-len
62
+ }
63
+ return float64ToFloat32( s1 / s2 );
64
+ }
65
+
66
+
67
+ // EXPORTS //
68
+
69
+ module.exports = evalrational;
package/manifest.json ADDED
@@ -0,0 +1,82 @@
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-special-floorf",
41
+ "@stdlib/math-base-special-sinpif",
42
+ "@stdlib/math-base-special-absf",
43
+ "@stdlib/constants-float32-pi-squared"
44
+ ]
45
+ },
46
+ {
47
+ "task": "benchmark",
48
+ "src": [
49
+ "./src/main.c"
50
+ ],
51
+ "include": [
52
+ "./include"
53
+ ],
54
+ "libraries": [],
55
+ "libpath": [],
56
+ "dependencies": [
57
+ "@stdlib/math-base-special-floorf",
58
+ "@stdlib/math-base-special-sinpif",
59
+ "@stdlib/math-base-special-absf",
60
+ "@stdlib/constants-float32-pi-squared"
61
+ ]
62
+ },
63
+ {
64
+ "task": "examples",
65
+ "src": [
66
+ "./src/main.c"
67
+ ],
68
+ "include": [
69
+ "./include"
70
+ ],
71
+ "libraries": [],
72
+ "libpath": [],
73
+ "dependencies": [
74
+ "@stdlib/math-base-special-floorf",
75
+ "@stdlib/math-base-special-sinpif",
76
+ "@stdlib/math-base-special-absf",
77
+ "@stdlib/constants-float32-pi-squared"
78
+ ]
79
+ }
80
+ ]
81
+ }
82
+
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@stdlib/math-base-special-trigammaf",
3
+ "version": "0.1.0",
4
+ "description": "Trigamma function for a single-precision floating-point number.",
5
+ "license": "Apache-2.0 AND BSL-1.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://github.com/stdlib-js/math-base-special-trigammaf.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/stdlib-js/stdlib/issues"
35
+ },
36
+ "dependencies": {
37
+ "@stdlib/constants-float32-pi-squared": "github:stdlib-js/constants-float32-pi-squared#main",
38
+ "@stdlib/math-base-napi-unary": "^0.2.5",
39
+ "@stdlib/math-base-special-absf": "^0.2.2",
40
+ "@stdlib/math-base-special-floorf": "^0.2.2",
41
+ "@stdlib/math-base-special-sinpif": "github:stdlib-js/math-base-special-sinpif#main",
42
+ "@stdlib/number-float64-base-to-float32": "^0.2.2",
43
+ "@stdlib/utils-library-manifest": "^0.2.3"
44
+ },
45
+ "devDependencies": {},
46
+ "engines": {
47
+ "node": ">=0.10.0",
48
+ "npm": ">2.7.0"
49
+ },
50
+ "os": [
51
+ "aix",
52
+ "darwin",
53
+ "freebsd",
54
+ "linux",
55
+ "macos",
56
+ "openbsd",
57
+ "sunos",
58
+ "win32",
59
+ "windows"
60
+ ],
61
+ "keywords": [
62
+ "stdlib",
63
+ "stdmath",
64
+ "mathematics",
65
+ "math",
66
+ "derivative",
67
+ "trigamma",
68
+ "gamma",
69
+ "gammaf",
70
+ "trigammaf",
71
+ "scalar",
72
+ "number",
73
+ "psi"
74
+ ],
75
+ "funding": {
76
+ "type": "opencollective",
77
+ "url": "https://opencollective.com/stdlib"
78
+ }
79
+ }
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #include "stdlib/math/base/special/trigammaf.h"
20
+ #include "stdlib/math/base/napi/unary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_F_F( stdlib_base_trigammaf )