@stdlib/stats-base-dists-rayleigh-pdf 0.2.2 → 0.3.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/NOTICE +1 -1
- package/README.md +107 -15
- package/include/stdlib/stats/base/dists/rayleigh/pdf.h +38 -0
- package/lib/native.js +68 -0
- package/manifest.json +86 -0
- package/package.json +9 -4
- package/src/addon.c +22 -0
- package/src/main.c +55 -0
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -142,19 +142,107 @@ y = myPDF( 4.0 );
|
|
|
142
142
|
<!-- eslint no-undef: "error" -->
|
|
143
143
|
|
|
144
144
|
```javascript
|
|
145
|
-
var
|
|
145
|
+
var uniform = require( '@stdlib/random-array-uniform' );
|
|
146
|
+
var logEachMap = require( '@stdlib/console-log-each-map' );
|
|
146
147
|
var pdf = require( '@stdlib/stats-base-dists-rayleigh-pdf' );
|
|
147
148
|
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var
|
|
149
|
+
var opts = {
|
|
150
|
+
'dtype': 'float64'
|
|
151
|
+
};
|
|
152
|
+
var x = uniform( 10, 0.0, 10.0, opts );
|
|
153
|
+
var sigma = uniform( 10, 0.0, 10.0, opts );
|
|
152
154
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
logEachMap( 'x: %0.4f, σ: %0.4f, f(x;σ): %0.4f', x, sigma, pdf );
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
</section>
|
|
159
|
+
|
|
160
|
+
<!-- /.examples -->
|
|
161
|
+
|
|
162
|
+
<!-- C interface documentation. -->
|
|
163
|
+
|
|
164
|
+
* * *
|
|
165
|
+
|
|
166
|
+
<section class="c">
|
|
167
|
+
|
|
168
|
+
## C APIs
|
|
169
|
+
|
|
170
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
171
|
+
|
|
172
|
+
<section class="intro">
|
|
173
|
+
|
|
174
|
+
</section>
|
|
175
|
+
|
|
176
|
+
<!-- /.intro -->
|
|
177
|
+
|
|
178
|
+
<!-- C usage documentation. -->
|
|
179
|
+
|
|
180
|
+
<section class="usage">
|
|
181
|
+
|
|
182
|
+
### Usage
|
|
183
|
+
|
|
184
|
+
```c
|
|
185
|
+
#include "stdlib/stats/base/dists/rayleigh/pdf.h"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### stdlib_base_dists_rayleigh_pdf( x, sigma )
|
|
189
|
+
|
|
190
|
+
Evaluates the probability density function (PDF) for a Rayleigh distribution.
|
|
191
|
+
|
|
192
|
+
```c
|
|
193
|
+
double out = stdlib_base_dists_rayleigh_pdf( 0.3, 1.0 );
|
|
194
|
+
// returns ~0.287
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The function accepts the following arguments:
|
|
198
|
+
|
|
199
|
+
- **x**: `[in] double` input value.
|
|
200
|
+
- **sigma**: `[in] double` scale parameter.
|
|
201
|
+
|
|
202
|
+
```c
|
|
203
|
+
double stdlib_base_dists_rayleigh_pdf( const double x, const double sigma );
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
</section>
|
|
207
|
+
|
|
208
|
+
<!-- /.usage -->
|
|
209
|
+
|
|
210
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
211
|
+
|
|
212
|
+
<section class="notes">
|
|
213
|
+
|
|
214
|
+
</section>
|
|
215
|
+
|
|
216
|
+
<!-- /.notes -->
|
|
217
|
+
|
|
218
|
+
<!-- C API usage examples. -->
|
|
219
|
+
|
|
220
|
+
<section class="examples">
|
|
221
|
+
|
|
222
|
+
### Examples
|
|
223
|
+
|
|
224
|
+
```c
|
|
225
|
+
#include "stdlib/stats/base/dists/rayleigh/pdf.h"
|
|
226
|
+
#include <stdlib.h>
|
|
227
|
+
#include <stdio.h>
|
|
228
|
+
|
|
229
|
+
static double random_uniform( const double min, const double max ) {
|
|
230
|
+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
|
|
231
|
+
return min + ( v*(max-min) );
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
int main( void ) {
|
|
235
|
+
double sigma;
|
|
236
|
+
double x;
|
|
237
|
+
double y;
|
|
238
|
+
int i;
|
|
239
|
+
|
|
240
|
+
for ( i = 0; i < 25; i++ ) {
|
|
241
|
+
x = random_uniform( 0.0, 10.0 );
|
|
242
|
+
sigma = random_uniform( 0.0, 10.0 );
|
|
243
|
+
y = stdlib_base_dists_rayleigh_pdf( x, sigma );
|
|
244
|
+
printf( "x: %lf, σ: %lf, f(x;σ): %lf\n", x, sigma, y );
|
|
245
|
+
}
|
|
158
246
|
}
|
|
159
247
|
```
|
|
160
248
|
|
|
@@ -162,6 +250,10 @@ for ( i = 0; i < 10; i++ ) {
|
|
|
162
250
|
|
|
163
251
|
<!-- /.examples -->
|
|
164
252
|
|
|
253
|
+
</section>
|
|
254
|
+
|
|
255
|
+
<!-- /.c -->
|
|
256
|
+
|
|
165
257
|
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
166
258
|
|
|
167
259
|
<section class="related">
|
|
@@ -196,7 +288,7 @@ See [LICENSE][stdlib-license].
|
|
|
196
288
|
|
|
197
289
|
## Copyright
|
|
198
290
|
|
|
199
|
-
Copyright © 2016-
|
|
291
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
200
292
|
|
|
201
293
|
</section>
|
|
202
294
|
|
|
@@ -209,8 +301,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
209
301
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-rayleigh-pdf.svg
|
|
210
302
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-rayleigh-pdf
|
|
211
303
|
|
|
212
|
-
[test-image]: https://github.com/stdlib-js/stats-base-dists-rayleigh-pdf/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
213
|
-
[test-url]: https://github.com/stdlib-js/stats-base-dists-rayleigh-pdf/actions/workflows/test.yml?query=branch:v0.
|
|
304
|
+
[test-image]: https://github.com/stdlib-js/stats-base-dists-rayleigh-pdf/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
305
|
+
[test-url]: https://github.com/stdlib-js/stats-base-dists-rayleigh-pdf/actions/workflows/test.yml?query=branch:v0.3.0
|
|
214
306
|
|
|
215
307
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-rayleigh-pdf/main.svg
|
|
216
308
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-rayleigh-pdf?branch=main
|
|
@@ -222,8 +314,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
222
314
|
|
|
223
315
|
-->
|
|
224
316
|
|
|
225
|
-
[chat-image]: https://img.shields.io/
|
|
226
|
-
[chat-url]: https://
|
|
317
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
318
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
227
319
|
|
|
228
320
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
229
321
|
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
#ifndef STDLIB_STATS_BASE_DISTS_RAYLEIGH_PDF_H
|
|
20
|
+
#define STDLIB_STATS_BASE_DISTS_RAYLEIGH_PDF_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 probability density function (PDF) for a Rayleigh distribution with scale parameter `sigma` at a value `x`.
|
|
31
|
+
*/
|
|
32
|
+
double stdlib_base_dists_rayleigh_pdf( const double x, const double sigma );
|
|
33
|
+
|
|
34
|
+
#ifdef __cplusplus
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#endif // !STDLIB_STATS_BASE_DISTS_RAYLEIGH_PDF_H
|
package/lib/native.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var addon = require( './../src/addon.node' );
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Evaluates the probability density function (PDF) for a Rayleigh distribution with scale parameter `sigma` at a value `x`.
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
* @param {number} x - input value
|
|
33
|
+
* @param {NonNegativeNumber} sigma - scale parameter
|
|
34
|
+
* @returns {number} evaluated PDF
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* var y = pdf( 0.3, 1.0 );
|
|
38
|
+
* // returns ~0.287
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* var y = pdf( 2.0, 0.8 );
|
|
42
|
+
* // returns ~0.137
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* var y = pdf( -1.0, 0.5 );
|
|
46
|
+
* // returns 0.0
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* var y = pdf( 0.0, NaN );
|
|
50
|
+
* // returns NaN
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* var y = pdf( NaN, 2.0 );
|
|
54
|
+
* // returns NaN
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // Negative scale parameter:
|
|
58
|
+
* var y = pdf( 2.0, -1.0 );
|
|
59
|
+
* // returns NaN
|
|
60
|
+
*/
|
|
61
|
+
function pdf( x, sigma ) {
|
|
62
|
+
return addon( x, sigma );
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// EXPORTS //
|
|
67
|
+
|
|
68
|
+
module.exports = pdf;
|
package/manifest.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": {
|
|
3
|
+
"task": "build",
|
|
4
|
+
"wasm": false
|
|
5
|
+
},
|
|
6
|
+
"fields": [
|
|
7
|
+
{
|
|
8
|
+
"field": "src",
|
|
9
|
+
"resolve": true,
|
|
10
|
+
"relative": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"field": "include",
|
|
14
|
+
"resolve": true,
|
|
15
|
+
"relative": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"field": "libraries",
|
|
19
|
+
"resolve": false,
|
|
20
|
+
"relative": false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"field": "libpath",
|
|
24
|
+
"resolve": true,
|
|
25
|
+
"relative": false
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"confs": [
|
|
29
|
+
{
|
|
30
|
+
"task": "build",
|
|
31
|
+
"wasm": false,
|
|
32
|
+
"src": [
|
|
33
|
+
"./src/main.c"
|
|
34
|
+
],
|
|
35
|
+
"include": [
|
|
36
|
+
"./include"
|
|
37
|
+
],
|
|
38
|
+
"libraries": [],
|
|
39
|
+
"libpath": [],
|
|
40
|
+
"dependencies": [
|
|
41
|
+
"@stdlib/math-base-napi-binary",
|
|
42
|
+
"@stdlib/math-base-assert-is-nan",
|
|
43
|
+
"@stdlib/math-base-special-exp",
|
|
44
|
+
"@stdlib/math-base-special-pow",
|
|
45
|
+
"@stdlib/constants-float64-pinf"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"task": "benchmark",
|
|
50
|
+
"wasm": false,
|
|
51
|
+
"src": [
|
|
52
|
+
"./src/main.c"
|
|
53
|
+
],
|
|
54
|
+
"include": [
|
|
55
|
+
"./include"
|
|
56
|
+
],
|
|
57
|
+
"libraries": [],
|
|
58
|
+
"libpath": [],
|
|
59
|
+
"dependencies": [
|
|
60
|
+
"@stdlib/math-base-assert-is-nan",
|
|
61
|
+
"@stdlib/math-base-special-exp",
|
|
62
|
+
"@stdlib/constants-float64-eps",
|
|
63
|
+
"@stdlib/math-base-special-pow",
|
|
64
|
+
"@stdlib/constants-float64-pinf"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"task": "examples",
|
|
69
|
+
"wasm": false,
|
|
70
|
+
"src": [
|
|
71
|
+
"./src/main.c"
|
|
72
|
+
],
|
|
73
|
+
"include": [
|
|
74
|
+
"./include"
|
|
75
|
+
],
|
|
76
|
+
"libraries": [],
|
|
77
|
+
"libpath": [],
|
|
78
|
+
"dependencies": [
|
|
79
|
+
"@stdlib/math-base-assert-is-nan",
|
|
80
|
+
"@stdlib/math-base-special-exp",
|
|
81
|
+
"@stdlib/math-base-special-pow",
|
|
82
|
+
"@stdlib/constants-float64-pinf"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-base-dists-rayleigh-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Rayleigh distribution probability density function (PDF).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -14,9 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
|
+
"gypfile": false,
|
|
17
18
|
"directories": {
|
|
18
19
|
"doc": "./docs",
|
|
20
|
+
"include": "./include",
|
|
19
21
|
"lib": "./lib",
|
|
22
|
+
"src": "./src",
|
|
20
23
|
"dist": "./dist"
|
|
21
24
|
},
|
|
22
25
|
"types": "./docs/types",
|
|
@@ -32,11 +35,13 @@
|
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@stdlib/constants-float64-pinf": "^0.2.2",
|
|
34
37
|
"@stdlib/math-base-assert-is-nan": "^0.2.2",
|
|
35
|
-
"@stdlib/math-base-
|
|
38
|
+
"@stdlib/math-base-napi-binary": "^0.3.1",
|
|
39
|
+
"@stdlib/math-base-special-exp": "^0.2.4",
|
|
36
40
|
"@stdlib/math-base-special-pow": "^0.3.0",
|
|
37
|
-
"@stdlib/stats-base-dists-degenerate-pdf": "^0.
|
|
41
|
+
"@stdlib/stats-base-dists-degenerate-pdf": "^0.3.0",
|
|
38
42
|
"@stdlib/utils-constant-function": "^0.2.2",
|
|
39
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2"
|
|
43
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
|
|
44
|
+
"@stdlib/utils-library-manifest": "^0.2.3"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {},
|
|
42
47
|
"engines": {
|
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/stats/base/dists/rayleigh/pdf.h"
|
|
20
|
+
#include "stdlib/math/base/napi/binary.h"
|
|
21
|
+
|
|
22
|
+
STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_rayleigh_pdf )
|
package/src/main.c
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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/stats/base/dists/rayleigh/pdf.h"
|
|
20
|
+
#include "stdlib/math/base/assert/is_nan.h"
|
|
21
|
+
#include "stdlib/math/base/special/exp.h"
|
|
22
|
+
#include "stdlib/math/base/special/pow.h"
|
|
23
|
+
#include "stdlib/constants/float64/pinf.h"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Evaluates the probability density function (PDF) for a Rayleigh distribution with scale parameter `sigma` at a value `x`.
|
|
27
|
+
*
|
|
28
|
+
* @param x input value
|
|
29
|
+
* @param sigma scale parameter
|
|
30
|
+
* @return evaluated PDF
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* double y = stdlib_base_dists_rayleigh_pdf( 3.0, 1.0 );
|
|
34
|
+
* // returns ~0.287
|
|
35
|
+
*/
|
|
36
|
+
double stdlib_base_dists_rayleigh_pdf( const double x, const double sigma ) {
|
|
37
|
+
double s2;
|
|
38
|
+
double s2i;
|
|
39
|
+
if (
|
|
40
|
+
stdlib_base_is_nan( x ) ||
|
|
41
|
+
stdlib_base_is_nan( sigma ) ||
|
|
42
|
+
sigma < 0.0
|
|
43
|
+
) {
|
|
44
|
+
return 0.0 / 0.0; // NaN
|
|
45
|
+
}
|
|
46
|
+
if ( sigma == 0.0 ) {
|
|
47
|
+
return ( x == 0.0 ) ? STDLIB_CONSTANT_FLOAT64_PINF : 0.0;
|
|
48
|
+
}
|
|
49
|
+
if ( x < 0.0 || x == STDLIB_CONSTANT_FLOAT64_PINF ) {
|
|
50
|
+
return 0.0;
|
|
51
|
+
}
|
|
52
|
+
s2 = stdlib_base_pow( sigma, 2.0 );
|
|
53
|
+
s2i = 1.0 / s2;
|
|
54
|
+
return s2i * x * stdlib_base_exp( -stdlib_base_pow( x, 2.0 ) / ( 2.0 * s2 ) );
|
|
55
|
+
}
|