-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add C implementation of math/base/special/kernel-betainc
#10279
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
Merged
+4,865
−19
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
8f7a4c1
feat: add c implementation of kernal betainc
nirmaljb 725981a
chore: update copyright years
stdlib-bot 4d067da
fix: removed trailing whitespace
nirmaljb 8b09879
fix: removed unnecessary assigned variable
nirmaljb c9ec37f
test: added fixture
nirmaljb c398869
style: remove trailing space after ;
nirmaljb d0f93fa
test: added test, test.native, runner
nirmaljb a00b9f3
Apply suggestion from @gunjjoshi
nirmaljb 2e13ea5
fix: added format for bench interpolation
nirmaljb 05814a9
fix: added powm1 instead of pow() - 1
nirmaljb 45bb984
test: added test for ibeta
nirmaljb 5281ab1
test: remove some the output.json and it's fixtures, because it range…
nirmaljb 49227ca
test: removed redundant test cases
nirmaljb de9851e
test: commented out assign method test
nirmaljb 4fc832d
test: changed to isAlmostEqual
nirmaljb 386b749
refactor: made some changes to the implementation
nirmaljb 17edfe9
test: moved from isAlmostEqual to isAlmostSameValue
nirmaljb 8165e41
fix: address changes suggestion
nirmaljb e6cb1fe
fix: update the namespace to correct convention
nirmaljb 21d3954
test: revert back the date to original file
nirmaljb e5fdc8d
docs: use correct example and spacing
nirmaljb 167fc92
bench: refactor C benchmark and update main.c formating
Neerajpathak07 8446c6a
chore: update macro name
Neerajpathak07 1876cc9
chore: add new line after description
Neerajpathak07 5e0173d
chore: add new line before C header files
Neerajpathak07 473126a
fix: address changes request
nirmaljb d69ba45
test: add fixtures and new test case from boost
nirmaljb 0748d54
Merge branch 'develop' into feat/kernel-betainc
nirmaljb 0eb23b4
docs: add missing Boost license notice
Planeshifter 8e38206
refactor: remove unused parameter
Planeshifter f4c729a
docs: fix comment for series helper function
Planeshifter a817e66
docs: add missing comment
Planeshifter eeece98
test: restore type tests for invalid output argument
Planeshifter 8ec6e82
test: increase ULP tolerances to account for FMA contraction
Planeshifter c6282ba
test: fix loop bound in monotonicity test
Planeshifter eddf8d2
bench: fix duplicated segment in benchmark name
Planeshifter 43004cc
docs: restore original copyright year
Planeshifter 785d15d
docs: fix interface name
Planeshifter 9510422
docs: fix parameter order in doc comments
Planeshifter 54e307a
docs: fix C function signature in README
Planeshifter cfa4d95
docs: remove unused types reference
Planeshifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
lib/node_modules/@stdlib/math/base/special/kernel-betainc/benchmark/benchmark.native.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2026 The Stdlib Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| // MODULES // | ||
|
|
||
| var resolve = require( 'path' ).resolve; | ||
| var bench = require( '@stdlib/bench' ); | ||
| var uniform = require( '@stdlib/random/array/uniform' ); | ||
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
| var tryRequire = require( '@stdlib/utils/try-require' ); | ||
| var format = require( '@stdlib/string/format' ); | ||
| var EPS = require( '@stdlib/constants/float64/eps' ); | ||
| var pkg = require( './../package.json' ).name; | ||
|
|
||
|
|
||
| // VARIABLES // | ||
|
|
||
| var kernelBetainc = tryRequire( resolve( __dirname, './../lib/native.js' ) ); | ||
| var opts = { | ||
| 'skip': ( kernelBetainc instanceof Error ) | ||
| }; | ||
|
|
||
|
|
||
| // MAIN // | ||
|
|
||
| bench( format( '%s::native:regularized=true,upper=true', pkg ), opts, function benchmark( assert ) { | ||
| var out; | ||
| var x; | ||
| var a; | ||
| var b; | ||
| var i; | ||
|
|
||
| x = uniform( 100, 0.0, 1.0 ); | ||
| a = uniform( 100, EPS, 1000.0 ); | ||
| b = uniform( 100, EPS, 1000.0 ); | ||
|
|
||
| out = [ 0.0, 0.0 ]; | ||
| assert.tic(); | ||
| for ( i = 0; i < assert.iterations; i++ ) { | ||
| out = kernelBetainc( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ], true, true ); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| assert.toc(); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| assert.pass( 'benchmark finished' ); | ||
| assert.end(); | ||
| }); | ||
|
|
||
| bench( format( '%s::native:regularized=false,upper=true', pkg ), opts, function benchmark( assert ) { | ||
| var out; | ||
| var x; | ||
| var a; | ||
| var b; | ||
| var i; | ||
|
|
||
| x = uniform( 100, 0.0, 1.0 ); | ||
| a = uniform( 100, EPS, 1000.0 ); | ||
| b = uniform( 100, EPS, 1000.0 ); | ||
|
|
||
| out = [ 0.0, 0.0 ]; | ||
| assert.tic(); | ||
| for ( i = 0; i < assert.iterations; i++ ) { | ||
| out = kernelBetainc( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ], false, true ); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| assert.toc(); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| assert.pass( 'benchmark finished' ); | ||
| assert.end(); | ||
| }); | ||
|
|
||
| bench( format( '%s::native:regularized=true,upper=false', pkg ), opts, function benchmark( assert ) { | ||
| var out; | ||
| var x; | ||
| var a; | ||
| var b; | ||
| var i; | ||
|
|
||
| x = uniform( 100, 0.0, 1.0 ); | ||
| a = uniform( 100, EPS, 1000.0 ); | ||
| b = uniform( 100, EPS, 1000.0 ); | ||
|
|
||
| out = [ 0.0, 0.0 ]; | ||
| assert.tic(); | ||
| for ( i = 0; i < assert.iterations; i++ ) { | ||
| out = kernelBetainc( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ], true, false ); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| assert.toc(); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| assert.pass( 'benchmark finished' ); | ||
| assert.end(); | ||
| }); | ||
|
|
||
| bench( format( '%s::native:regularized=false,upper=false', pkg ), opts, function benchmark( assert ) { | ||
| var out; | ||
| var x; | ||
| var a; | ||
| var b; | ||
| var i; | ||
|
|
||
| x = uniform( 100, 0.0, 1.0 ); | ||
| a = uniform( 100, EPS, 1000.0 ); | ||
| b = uniform( 100, EPS, 1000.0 ); | ||
|
|
||
| out = [ 0.0, 0.0 ]; | ||
| assert.tic(); | ||
| for ( i = 0; i < assert.iterations; i++ ) { | ||
| out = kernelBetainc( x[ i%x.length ], a[ i%a.length ], b[ i%b.length ], false, false ); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| assert.toc(); | ||
| if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
| assert.fail( 'should not return NaN' ); | ||
| } | ||
| assert.pass( 'benchmark finished' ); | ||
| assert.end(); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.