stdlib-js / stdlib-js/stdlib

Incorrect domain of `t` used in `stats/base/dists/normal/mgf` across benchmark, test and examples

Abierto
#12,247 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
6k
Forks
1.3k
Merge medio
1 d 3 h
PR fusionados (30 d)
611

Descripción

For the mgf function in normal distribution `mgf( t, mu, sigma)` t is allowed to take any value within `(-inf, +inf)` but in the test, benchmarks and examples the domain used is `[0, +inf)` except the C benchmark file.

- For C benchmark in `stats/base/dists/normal/mgf/benchmark/c/benchmark.c` at [line 105](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/benchmark/c/benchmark.c#L105) the domain of `t` is correct.
```c
for ( i = 0; i < 100; i++ ) {
t[ i ] = random_uniform( -100.0, 100.0 );
```

- For JS benchmarks in `stats/base/dists/normal/mgf/benchmark/benchmark.js` at [line 76](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js#L76-L78), [line 45](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js#L45) and `stats/base/dists/normal/mgf/benchmark/benchmark.native.js` at [line 54](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.native.js#L54) the domain of `t` is `[0,1)`
```js
t = uniform( 100, 0.0, 1.0, {
'dtype': 'float64'
});
```

- For both C and JS examples in `stats/base/dists/normal/mgf/examples/index.js` at [line 30](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/examples/index.js#L30) the domain is `[0,10)` and in `stats/base/dists/normal/mgf/examples/c/example.c` at [line 37](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/examples/c/example.c#L37) the domain is `[0,1)`

JS file
```js
var t = uniform( 10, 0.0, 10.0, opts );
```
C file
```c
t = random_uniform( 0.0, 1.0 );
```

- For the Julia test fixture runner in `stats/base/dists/normal/mgf/test/fixtures/julia/runner.jl` at [line 74](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/test/fixtures/julia/runner.jl#L74), [line 80](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/test/fixtures/julia/runner.jl#L80) and [line 86](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/test/fixtures/julia/runner.jl#L86) the value `x` (which corresponds to `t`) is generated only from `[0, +inf)`, missing coverage of negative values which are valid inputs.
```julia
x = rand( 1000 ) .* 20.0;
...
x = rand( 1000 ) .* 20.0;
...
x = rand( 1000 ) .* 10.0;
```

- For the README.md examples in `stats/base/dists/normal/mgf/README.md` at [line 142](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/README.md?plain=1#L142) the JS example uses `[0,10)` and at [line 233](https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/stats/base/dists/normal/mgf/README.md?plain=1#L233) the C example uses `[0,1)` for the domain of `t`.

JS example
```js
var t = uniform( 10, 0.0, 10.0, opts );
```
C example
```c
t = random_uniform( 0.0, 1.0 );
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Review the generators and examples in stats/base/dists/normal/mgf/benchmark/benchmark.js, benchmark/benchmark.native.js, examples/index.js, examples/c/example.c, test/fixtures/julia/runner.jl, and README.md; compare them with the existing C benchmark. Update the listed inputs so valid negative t values are covered consistently, then run the normal/mgf tests and inspect the examples and benchmarks.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c, javascript, julia
Área
documentation, testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
72/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.