Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add C implementation for stats/base/dists/geometric/mode #4090

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: completed the code review task
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: passed
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: passed
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: passed
  - task: run_c_benchmarks
    status: passed
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: passed
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
0PrashantYadav0 committed Jan 3, 2025
commit f5418ceea1eb0bcff32523dd0eb36b08dbfd8967
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ for ( i = 0; i < 10; i++ ) {

#### stdlib_base_dists_geometric_mode( p )

Returns the mode of a geometric distribution.
Returns the [mode][mode] of a [geometric][geometric-distribution] distribution with success probability `p`.

```c
double out = stdlib_base_dists_geometric_mode( 0.5 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var randu = require( '@stdlib/random/base/randu' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;
var mode = require( './../lib' );

Expand All @@ -40,7 +39,7 @@ bench( pkg, function benchmark( b ) {
len = 100;
p = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
p[ i ] = ( randu() * 1.0 ) + EPS;
p[ i ] = ( randu() * 1.0 );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var Float64Array = require( '@stdlib/array/float64' );
var tryRequire = require( '@stdlib/utils/try-require' );
var randu = require( '@stdlib/random/base/randu' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;


Expand All @@ -49,7 +48,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
len = 100;
p = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
p[ i ] = ( randu() * 1.0 ) + EPS;
p[ i ] = ( randu() * 1.0 );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

#include "stdlib/stats/base/dists/geometric/mode.h"
#include "stdlib/constants/float64/eps.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
Expand Down Expand Up @@ -100,7 +99,7 @@ static double benchmark( void ) {
int i;

for ( i = 0; i < 100; i++ ) {
p[ i ] = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
p[ i ] = random_uniform( 0.0, 1.0 );
}

t = tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/math/base/assert/is-nan",
"@stdlib/constants/float64/eps"
"@stdlib/math/base/assert/is-nan"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ double stdlib_base_dists_geometric_mode( const double p ) {
p < 0.0 ||
p > 1.0
) {
return 0.0 / 0.0; // NaN
return 0.0 / 0.0; // NaN
}
return 0.0;
}
Loading