@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.
- package/LICENSE +209 -0
- package/NOTICE +1 -0
- package/README.md +301 -0
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +52 -0
- package/include/stdlib/math/base/special/trigammaf.h +38 -0
- package/lib/index.js +52 -0
- package/lib/main.js +125 -0
- package/lib/native.js +62 -0
- package/lib/rational_p12q12.js +69 -0
- package/lib/rational_p24q24.js +69 -0
- package/lib/rational_p4infq4inf.js +69 -0
- package/manifest.json +82 -0
- package/package.json +79 -0
- package/src/addon.c +22 -0
- package/src/main.c +215 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
DEPENDENCIES & ATTRIBUTION
|
|
180
|
+
|
|
181
|
+
The library links against the following external libraries or contains
|
|
182
|
+
implementations from the following external libraries, which have their own
|
|
183
|
+
licenses:
|
|
184
|
+
|
|
185
|
+
* Boost <http://www.boost.org/LICENSE_1_0.txt>
|
|
186
|
+
|
|
187
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
188
|
+
|
|
189
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
190
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
191
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
192
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
193
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
194
|
+
do so, all subject to the following:
|
|
195
|
+
|
|
196
|
+
The copyright notices in the Software and this entire statement, including
|
|
197
|
+
the above license grant, this restriction and the following disclaimer,
|
|
198
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
199
|
+
all derivative works of the Software, unless such copies or derivative
|
|
200
|
+
works are solely in the form of machine-executable object code generated by
|
|
201
|
+
a source language processor.
|
|
202
|
+
|
|
203
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
204
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
205
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
206
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
207
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
208
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
209
|
+
DEALINGS IN THE SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2025 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
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
|
+
|
|
32
|
+
# Trigamma
|
|
33
|
+
|
|
34
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
|
+
|
|
36
|
+
> [Trigamma][trigamma-function] function for a single-precision floating-point number.
|
|
37
|
+
|
|
38
|
+
<section class="intro">
|
|
39
|
+
|
|
40
|
+
The [trigamma function][trigamma-function] `ψ^(1)` is the derivative of the [digamma function][digamma-function].
|
|
41
|
+
|
|
42
|
+
<!-- <equation class="equation" label="eq:trigamma_function" align="center" raw="\psi^{(1)}(x) =\frac{d}{dx} \Psi(x) = \sum_{k=0}^\infty \frac{1}{(k+x)^2}" alt="Trigamma function"> -->
|
|
43
|
+
|
|
44
|
+
<!-- </equation> -->
|
|
45
|
+
|
|
46
|
+
</section>
|
|
47
|
+
|
|
48
|
+
<!-- /.intro -->
|
|
49
|
+
|
|
50
|
+
<section class="installation">
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @stdlib/math-base-special-trigammaf
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
</section>
|
|
59
|
+
|
|
60
|
+
<section class="usage">
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
var trigammaf = require( '@stdlib/math-base-special-trigammaf' );
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### trigammaf( x )
|
|
69
|
+
|
|
70
|
+
Evaluates the [trigamma function][trigamma-function] for a single-precision floating-point number.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
var v = trigammaf( -2.5 );
|
|
74
|
+
// returns ~9.539
|
|
75
|
+
|
|
76
|
+
v = trigammaf( 1.0 );
|
|
77
|
+
// returns ~1.645
|
|
78
|
+
|
|
79
|
+
v = trigammaf( 10.0 );
|
|
80
|
+
// returns ~0.105
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If `x` is `0` or a negative `integer`, the function returns `NaN`.
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
var v = trigammaf( 0.0 );
|
|
87
|
+
// returns NaN
|
|
88
|
+
|
|
89
|
+
v = trigammaf( -1.0 );
|
|
90
|
+
// returns NaN
|
|
91
|
+
|
|
92
|
+
v = trigammaf( -2.0 );
|
|
93
|
+
// returns NaN
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If provided `NaN`, the function returns `NaN`.
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
var v = trigammaf( NaN );
|
|
100
|
+
// returns NaN
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</section>
|
|
104
|
+
|
|
105
|
+
<!-- /.usage -->
|
|
106
|
+
|
|
107
|
+
<section class="examples">
|
|
108
|
+
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
<!-- eslint no-undef: "error" -->
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
var uniform = require( '@stdlib/random-array-uniform' );
|
|
115
|
+
var logEachMap = require( '@stdlib/console-log-each-map' );
|
|
116
|
+
var trigammaf = require( '@stdlib/math-base-special-trigammaf' );
|
|
117
|
+
|
|
118
|
+
var opts = {
|
|
119
|
+
'dtype': 'float32'
|
|
120
|
+
};
|
|
121
|
+
var x = uniform( 100, -50.0, 50.0, opts );
|
|
122
|
+
|
|
123
|
+
logEachMap( 'x: %0.4f, ψ^(1)(x): %0.4f', x, trigammaf );
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</section>
|
|
127
|
+
|
|
128
|
+
<!-- /.examples -->
|
|
129
|
+
|
|
130
|
+
<!-- C interface documentation. -->
|
|
131
|
+
|
|
132
|
+
* * *
|
|
133
|
+
|
|
134
|
+
<section class="c">
|
|
135
|
+
|
|
136
|
+
## C APIs
|
|
137
|
+
|
|
138
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
139
|
+
|
|
140
|
+
<section class="intro">
|
|
141
|
+
|
|
142
|
+
</section>
|
|
143
|
+
|
|
144
|
+
<!-- /.intro -->
|
|
145
|
+
|
|
146
|
+
<!-- C usage documentation. -->
|
|
147
|
+
|
|
148
|
+
<section class="usage">
|
|
149
|
+
|
|
150
|
+
### Usage
|
|
151
|
+
|
|
152
|
+
```c
|
|
153
|
+
#include "stdlib/math/base/special/trigammaf.h"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### stdlib_base_trigammaf( x )
|
|
157
|
+
|
|
158
|
+
Evaluates the [trigamma function][trigamma-function] for a single-precision floating-point number.
|
|
159
|
+
|
|
160
|
+
```c
|
|
161
|
+
float out = stdlib_base_trigammaf( -2.5f );
|
|
162
|
+
// returns ~9.539f
|
|
163
|
+
|
|
164
|
+
out = stdlib_base_trigammaf( 1.0f );
|
|
165
|
+
// returns ~1.645f
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The function accepts the following arguments:
|
|
169
|
+
|
|
170
|
+
- **x**: `[in] float` input value.
|
|
171
|
+
|
|
172
|
+
```c
|
|
173
|
+
float stdlib_base_trigammaf( const float x );
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
</section>
|
|
177
|
+
|
|
178
|
+
<!-- /.usage -->
|
|
179
|
+
|
|
180
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
181
|
+
|
|
182
|
+
<section class="notes">
|
|
183
|
+
|
|
184
|
+
</section>
|
|
185
|
+
|
|
186
|
+
<!-- /.notes -->
|
|
187
|
+
|
|
188
|
+
<!-- C API usage examples. -->
|
|
189
|
+
|
|
190
|
+
<section class="examples">
|
|
191
|
+
|
|
192
|
+
### Examples
|
|
193
|
+
|
|
194
|
+
```c
|
|
195
|
+
#include "stdlib/math/base/special/trigammaf.h"
|
|
196
|
+
#include <stdio.h>
|
|
197
|
+
|
|
198
|
+
int main( void ) {
|
|
199
|
+
const float x[] = { 4.0f, -1.5f, -0.5f, 0.5f };
|
|
200
|
+
|
|
201
|
+
float y;
|
|
202
|
+
int i;
|
|
203
|
+
for ( i = 0; i < 4; i++ ) {
|
|
204
|
+
y = stdlib_base_trigammaf( x[ i ] );
|
|
205
|
+
printf( "x: %f, ψ^(1)(x): %f\n", x[ i ], y );
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
</section>
|
|
211
|
+
|
|
212
|
+
<!-- /.examples -->
|
|
213
|
+
|
|
214
|
+
</section>
|
|
215
|
+
|
|
216
|
+
<!-- /.c -->
|
|
217
|
+
|
|
218
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
219
|
+
|
|
220
|
+
<section class="related">
|
|
221
|
+
|
|
222
|
+
</section>
|
|
223
|
+
|
|
224
|
+
<!-- /.related -->
|
|
225
|
+
|
|
226
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<section class="main-repo" >
|
|
230
|
+
|
|
231
|
+
* * *
|
|
232
|
+
|
|
233
|
+
## Notice
|
|
234
|
+
|
|
235
|
+
This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
|
|
236
|
+
|
|
237
|
+
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
238
|
+
|
|
239
|
+
#### Community
|
|
240
|
+
|
|
241
|
+
[![Chat][chat-image]][chat-url]
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Copyright
|
|
246
|
+
|
|
247
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
248
|
+
|
|
249
|
+
</section>
|
|
250
|
+
|
|
251
|
+
<!-- /.stdlib -->
|
|
252
|
+
|
|
253
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
254
|
+
|
|
255
|
+
<section class="links">
|
|
256
|
+
|
|
257
|
+
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-special-trigammaf.svg
|
|
258
|
+
[npm-url]: https://npmjs.org/package/@stdlib/math-base-special-trigammaf
|
|
259
|
+
|
|
260
|
+
[test-image]: https://github.com/stdlib-js/math-base-special-trigammaf/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
261
|
+
[test-url]: https://github.com/stdlib-js/math-base-special-trigammaf/actions/workflows/test.yml?query=branch:v0.1.0
|
|
262
|
+
|
|
263
|
+
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-trigammaf/main.svg
|
|
264
|
+
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-special-trigammaf?branch=main
|
|
265
|
+
|
|
266
|
+
<!--
|
|
267
|
+
|
|
268
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/math-base-special-trigammaf.svg
|
|
269
|
+
[dependencies-url]: https://david-dm.org/stdlib-js/math-base-special-trigammaf/main
|
|
270
|
+
|
|
271
|
+
-->
|
|
272
|
+
|
|
273
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
274
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
275
|
+
|
|
276
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
277
|
+
|
|
278
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
279
|
+
|
|
280
|
+
[umd]: https://github.com/umdjs/umd
|
|
281
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
282
|
+
|
|
283
|
+
[deno-url]: https://github.com/stdlib-js/math-base-special-trigammaf/tree/deno
|
|
284
|
+
[deno-readme]: https://github.com/stdlib-js/math-base-special-trigammaf/blob/deno/README.md
|
|
285
|
+
[umd-url]: https://github.com/stdlib-js/math-base-special-trigammaf/tree/umd
|
|
286
|
+
[umd-readme]: https://github.com/stdlib-js/math-base-special-trigammaf/blob/umd/README.md
|
|
287
|
+
[esm-url]: https://github.com/stdlib-js/math-base-special-trigammaf/tree/esm
|
|
288
|
+
[esm-readme]: https://github.com/stdlib-js/math-base-special-trigammaf/blob/esm/README.md
|
|
289
|
+
[branches-url]: https://github.com/stdlib-js/math-base-special-trigammaf/blob/main/branches.md
|
|
290
|
+
|
|
291
|
+
[trigamma-function]: https://en.wikipedia.org/wiki/Trigamma_function
|
|
292
|
+
|
|
293
|
+
[digamma-function]: https://en.wikipedia.org/wiki/Digamma_function
|
|
294
|
+
|
|
295
|
+
<!-- <related-links> -->
|
|
296
|
+
|
|
297
|
+
<!-- </related-links> -->
|
|
298
|
+
|
|
299
|
+
</section>
|
|
300
|
+
|
|
301
|
+
<!-- /.links -->
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var o=function(r,v){return function(){return v||r((v={exports:{}}).exports,v),v.exports}};var q=o(function(_,n){
|
|
2
|
+
var a=require('@stdlib/number-float64-base-to-float32/dist');function S(r){var v,u,s;return r===0?-1.109328031539917:(r<0?v=-r:v=r,v<=1?(u=a(-1.109328031539917+a(r*a(-3.8310675621032715+a(r*a(-3.370384931564331+a(r*a(.2808057367801666+a(r*a(1.6638069152832031+a(r*.6446838974952698)))))))))),s=a(1+a(r*a(3.4535388946533203+a(r*a(4.52089262008667+a(r*a(2.7012734413146973+a(r*a(.6446880102157593+a(r*-2031451629136427e-22))))))))))):(r=a(1/r),u=a(.6446838974952698+a(r*a(1.6638069152832031+a(r*a(.2808057367801666+a(r*a(-3.370384931564331+a(r*a(-3.8310675621032715+a(r*-1.109328031539917)))))))))),s=a(-2031451629136427e-22+a(r*a(.6446880102157593+a(r*a(2.7012734413146973+a(r*a(4.52089262008667+a(r*a(3.4535388946533203+a(r*1))))))))))),a(u/s))}n.exports=S
|
|
3
|
+
});var F=o(function(d,c){
|
|
4
|
+
var i=require('@stdlib/number-float64-base-to-float32/dist');function U(r){var v,u,s;return r===0?-13803835408054965e-24:(r<0?v=-r:v=r,v<=1?(u=i(-13803835408054965e-24+i(r*i(.5000004768371582+i(r*i(1.6077979803085327+i(r*i(2.5645434856414795+i(r*i(2.0534873008728027+i(r*.7456697821617126)))))))))),s=i(1+i(r*i(2.8822786808013916+i(r*i(4.168166160583496+i(r*i(2.7853527069091797+i(r*i(.7496767044067383+i(r*-.0005706911324523389))))))))))):(r=i(1/r),u=i(.7456697821617126+i(r*i(2.0534873008728027+i(r*i(2.5645434856414795+i(r*i(1.6077979803085327+i(r*i(.5000004768371582+i(r*-13803835408054965e-24)))))))))),s=i(-.0005706911324523389+i(r*i(.7496767044067383+i(r*i(2.7853527069091797+i(r*i(4.168166160583496+i(r*i(2.8822786808013916+i(r*1))))))))))),i(u/s))}c.exports=U
|
|
5
|
+
});var O=o(function(h,p){
|
|
6
|
+
var e=require('@stdlib/number-float64-base-to-float32/dist');function b(r){var v,u,s;return r===0?68947580279632365e-34:(r<0?v=-r:v=r,v<=1?(u=e(68947580279632365e-34+e(r*e(.5+e(r*e(1.0177274942398071+e(r*e(2.498208522796631+e(r*e(2.192122220993042+e(r*e(1.5897035598754883+e(r*.40154388546943665)))))))))))),s=e(1+e(r*e(1.7021214962005615+e(r*e(4.429043292999268+e(r*e(2.9745631217956543+e(r*e(2.301361560821533+e(r*e(.2836039960384369+e(r*.022892987355589867))))))))))))):(r=e(1/r),u=e(.40154388546943665+e(r*e(1.5897035598754883+e(r*e(2.192122220993042+e(r*e(2.498208522796631+e(r*e(1.0177274942398071+e(r*e(.5+e(r*68947580279632365e-34)))))))))))),s=e(.022892987355589867+e(r*e(.2836039960384369+e(r*e(2.301361560821533+e(r*e(2.9745631217956543+e(r*e(4.429043292999268+e(r*e(1.7021214962005615+e(r*1))))))))))))),e(u/s))}p.exports=b
|
|
7
|
+
});var I=o(function(j,R){
|
|
8
|
+
var t=require('@stdlib/number-float64-base-to-float32/dist'),T=require('@stdlib/math-base-special-sinpif/dist'),E=require('@stdlib/math-base-special-absf/dist'),g=require('@stdlib/math-base-special-floorf/dist'),y=require('@stdlib/constants-float32-pi-squared/dist'),z=q(),A=F(),D=O(),P=t(2.109325408935547),N=t(0),f=t(1),Q=t(2),W=t(4);function m(r){var v,u,s,l;return r=t(r),v=N,r<=N?g(r)===r?NaN:(l=t(f-r),l<f&&(v=t(f/t(l*l)),l=t(f+l)),u=E(r)<E(l)?T(r):T(l),t(t(v-m(l))+t(y/t(u*u)))):(r<f&&(v=t(f/t(r*r)),r=t(r+f)),r<=Q?v=t(v+t(t(P+z(r))/t(r*r))):r<=W?(s=t(f/r),v=t(v+t(t(f+A(s))/r))):(s=t(f/r),v=t(v+t(t(f+D(s))/r))),v)}R.exports=m
|
|
9
|
+
});var Y=I();module.exports=Y;
|
|
10
|
+
/** @license Apache-2.0 */
|
|
11
|
+
/** @license Apache-2.0 */
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/rational_p12q12.js", "../lib/rational_p24q24.js", "../lib/rational_p4infq4inf.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MODULES //\n\nvar float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n\n\n// MAIN //\n\n/**\n* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\\\(P\\\\) and \\\\(Q\\\\)).\n*\n* ## Notes\n*\n* - Coefficients should be sorted in ascending degree.\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the rational function\n* @returns {number} evaluated rational function\n*/\nfunction evalrational( x ) {\n\tvar ax;\n\tvar s1;\n\tvar s2;\n\tif ( x === 0.0 ) {\n\t\treturn -1.109328031539917;\n\t}\n\tif ( x < 0.0 ) {\n\t\tax = -x;\n\t} else {\n\t\tax = x;\n\t}\n\tif ( ax <= 1.0 ) {\n\t\ts1 = 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\n\t\ts2 = 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\n\t} else {\n\t\tx = float64ToFloat32( 1.0 / x );\n\t\ts1 = 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\n\t\ts2 = 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\n\t}\n\treturn float64ToFloat32( s1 / s2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalrational;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MODULES //\n\nvar float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n\n\n// MAIN //\n\n/**\n* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\\\(P\\\\) and \\\\(Q\\\\)).\n*\n* ## Notes\n*\n* - Coefficients should be sorted in ascending degree.\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the rational function\n* @returns {number} evaluated rational function\n*/\nfunction evalrational( x ) {\n\tvar ax;\n\tvar s1;\n\tvar s2;\n\tif ( x === 0.0 ) {\n\t\treturn -1.3803835408054965e-8;\n\t}\n\tif ( x < 0.0 ) {\n\t\tax = -x;\n\t} else {\n\t\tax = x;\n\t}\n\tif ( ax <= 1.0 ) {\n\t\ts1 = 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\n\t\ts2 = 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\n\t} else {\n\t\tx = float64ToFloat32( 1.0 / x );\n\t\ts1 = 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\n\t\ts2 = 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\n\t}\n\treturn float64ToFloat32( s1 / s2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalrational;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MODULES //\n\nvar float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n\n\n// MAIN //\n\n/**\n* Evaluates a rational function (i.e., the ratio of two polynomials described by the coefficients stored in \\\\(P\\\\) and \\\\(Q\\\\)).\n*\n* ## Notes\n*\n* - Coefficients should be sorted in ascending degree.\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the rational function\n* @returns {number} evaluated rational function\n*/\nfunction evalrational( x ) {\n\tvar ax;\n\tvar s1;\n\tvar s2;\n\tif ( x === 0.0 ) {\n\t\treturn 6.8947580279632365e-18;\n\t}\n\tif ( x < 0.0 ) {\n\t\tax = -x;\n\t} else {\n\t\tax = x;\n\t}\n\tif ( ax <= 1.0 ) {\n\t\ts1 = 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\n\t\ts2 = 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\n\t} else {\n\t\tx = float64ToFloat32( 1.0 / x );\n\t\ts1 = 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\n\t\ts2 = 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\n\t}\n\treturn float64ToFloat32( s1 / s2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalrational;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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_88_0/boost/math/special_functions/trigamma.hpp}. The implementation follows the original but has been reformatted and modified for JavaScript.\n*\n* ```text\n* (C) Copyright John Maddock 2006.\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 f32 = require( '@stdlib/number-float64-base-to-float32' );\nvar sinpif = require( '@stdlib/math-base-special-sinpif' );\nvar absf = require( '@stdlib/math-base-special-absf' );\nvar floorf = require( '@stdlib/math-base-special-floorf' );\nvar PI_SQUARED = require( '@stdlib/constants-float32-pi-squared' );\nvar rateval12 = require( './rational_p12q12.js' );\nvar rateval24 = require( './rational_p24q24.js' );\nvar rateval4INF = require( './rational_p4infq4inf.js' );\n\n\n// VARIABLES //\n\nvar YOFFSET12 = f32( 2.1093254089355469 );\nvar ZERO = f32( 0.0 );\nvar ONE = f32( 1.0 );\nvar TWO = f32( 2.0 );\nvar FOUR = f32( 4.0 );\n\n\n// MAIN //\n\n/**\n* Evaluates the trigamma function for a single-precision floating-point number.\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = trigammaf( -2.5 );\n* // returns ~9.539\n*\n* @example\n* var v = trigammaf( 1.0 );\n* // returns ~1.645\n*\n* @example\n* var v = trigammaf( 10.0 );\n* // returns ~0.105\n*\n* @example\n* var v = trigammaf( NaN );\n* // returns NaN\n*\n* @example\n* var v = trigammaf( -1.0 );\n* // returns NaN\n*/\nfunction trigammaf( x ) {\n\tvar result;\n\tvar s;\n\tvar y;\n\tvar z;\n\n\tx = f32( x );\n\tresult = ZERO;\n\n\t// Check for negative arguments and use reflection:\n\tif ( x <= ZERO ) {\n\t\tif ( floorf( x ) === x ) {\n\t\t\treturn NaN;\n\t\t}\n\t\t// Reflect:\n\t\tz = f32( ONE - x );\n\t\tif ( z < ONE ) {\n\t\t\tresult = f32( ONE / f32( z*z ) );\n\t\t\tz = f32( ONE + z );\n\t\t}\n\t\ts = ( absf( x ) < absf( z ) ) ? sinpif( x ) : sinpif( z );\n\t\treturn f32( f32( result - trigammaf( z ) ) + f32( PI_SQUARED / f32( s*s ) ) );\n\t}\n\tif ( x < ONE ) {\n\t\tresult = f32( ONE / f32( x*x ) );\n\t\tx = f32( x + ONE );\n\t}\n\tif ( x <= TWO ) {\n\t\tresult = f32( result + f32( f32( YOFFSET12 + rateval12( x ) ) / f32( x*x ) ) );\n\t} else if ( x <= FOUR ) {\n\t\ty = f32( ONE / x );\n\t\tresult = f32( result + f32( f32( ONE + rateval24( y ) ) / x ) );\n\t} else {\n\t\ty = f32( ONE / x );\n\t\tresult = f32( result + f32( f32( ONE + rateval4INF( y ) ) / x ) );\n\t}\n\treturn result;\n}\n\n\n// EXPORTS //\n\nmodule.exports = trigammaf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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* Evaluate the trigamma function for a single-precision floating-point number.\n*\n* @module @stdlib/math-base-special-trigammaf\n*\n* @example\n* var trigammaf = require( '@stdlib/math-base-special-trigammaf' );\n*\n* var v = trigammaf( -2.5 );\n* // returns ~9.539\n*\n* v = trigammaf( 1.0 );\n* // returns ~1.645\n*\n* v = trigammaf( 10.0 );\n* // returns ~0.105\n*\n* v = trigammaf( NaN );\n* // returns NaN\n*\n* v = trigammaf( -1.0 );\n* // returns NaN\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuBA,IAAIC,EAAmB,QAAS,wCAAyC,EAmBzE,SAASC,EAAcC,EAAI,CAC1B,IAAIC,EACAC,EACAC,EACJ,OAAKH,IAAM,EACH,oBAEHA,EAAI,EACRC,EAAK,CAACD,EAENC,EAAKD,EAEDC,GAAM,GACVC,EAAKJ,EAAiB,mBAAqBA,EAAiBE,EAAIF,EAAiB,oBAAsBA,EAAiBE,EAAIF,EAAiB,mBAAqBA,EAAiBE,EAAIF,EAAiB,kBAAqBA,EAAiBE,EAAIF,EAAiB,mBAAqBA,EAAiBE,EAAI,iBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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A",
|
|
6
|
+
"names": ["require_rational_p12q12", "__commonJSMin", "exports", "module", "float64ToFloat32", "evalrational", "x", "ax", "s1", "s2", "require_rational_p24q24", "__commonJSMin", "exports", "module", "float64ToFloat32", "evalrational", "x", "ax", "s1", "s2", "require_rational_p4infq4inf", "__commonJSMin", "exports", "module", "float64ToFloat32", "evalrational", "x", "ax", "s1", "s2", "require_main", "__commonJSMin", "exports", "module", "f32", "sinpif", "absf", "floorf", "PI_SQUARED", "rateval12", "rateval24", "rateval4INF", "YOFFSET12", "ZERO", "ONE", "TWO", "FOUR", "trigammaf", "x", "result", "s", "y", "z", "main"]
|
|
7
|
+
}
|
|
@@ -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
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates the trigamma function for a single-precision floating-point number.
|
|
23
|
+
*
|
|
24
|
+
* @param x - input value
|
|
25
|
+
* @returns function value
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* var v = trigammaf( -2.5 );
|
|
29
|
+
* // returns ~9.539
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* var v = trigammaf( 1.0 );
|
|
33
|
+
* // returns ~1.645
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var v = trigammaf( 10.0 );
|
|
37
|
+
* // returns ~0.105
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var v = trigammaf( NaN );
|
|
41
|
+
* // returns NaN
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* var v = trigammaf( -1.0 );
|
|
45
|
+
* // returns NaN
|
|
46
|
+
*/
|
|
47
|
+
declare function trigammaf( x: number ): number;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// EXPORTS //
|
|
51
|
+
|
|
52
|
+
export = trigammaf;
|