Skip to content

feat: add C implementation for @stdlib/math/base/special/erfcx #2040

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
merged 24 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aee180e
feat(math): c implementation of `@stdlib/math/base/special/erfcx
USERSATOSHI Mar 21, 2024
0eb6f10
style: updated readme.md for @stdlib/math/base/special/erfcx
USERSATOSHI Mar 25, 2024
b714b73
fix: added missing semicolon and fixed dependecies in manifest.json
USERSATOSHI Mar 25, 2024
b39d36e
style: converted missed @returns to @return
USERSATOSHI Mar 25, 2024
6ab0b8e
style: removed @private
USERSATOSHI Mar 25, 2024
4fda9a4
Apply suggestions from code review
kgryte Mar 25, 2024
2b40a3b
Apply suggestions from code review
kgryte Mar 25, 2024
dc27930
Apply suggestions from code review
kgryte Mar 25, 2024
bd9b4e5
Apply suggestions from code review
kgryte Mar 25, 2024
210228c
Apply suggestions from code review
kgryte Mar 25, 2024
2f2b3b1
style: fixed main.c style, updating copyrights in benchmark and added…
USERSATOSHI Mar 25, 2024
1b9d45b
style: applied style changes according to review
USERSATOSHI Mar 26, 2024
00e5f99
Merge branch 'stdlib-js:develop' into erfcx
USERSATOSHI Apr 10, 2024
18a5d4e
Update lib/node_modules/@stdlib/math/base/special/erfcx/benchmark/c/n…
gunjjoshi Aug 23, 2024
98b4052
Update lib/node_modules/@stdlib/math/base/special/erfcx/benchmark/c/n…
gunjjoshi Aug 23, 2024
dc8da04
chore: update benchmarks
gunjjoshi Aug 23, 2024
d74088a
Update lib/node_modules/@stdlib/math/base/special/erfcx/benchmark/ben…
gunjjoshi Aug 23, 2024
a817c42
style: style changes, use isnan in main.js, correct function name
gunjjoshi Aug 23, 2024
4d9ba5d
docs: update tests
gunjjoshi Aug 23, 2024
b1bf893
bench: use correct function name
gunjjoshi Aug 23, 2024
efa7e5d
docs: include function signature in README.md
gunjjoshi Aug 23, 2024
2e00169
docs: remove unused stdint include
gunjjoshi Aug 23, 2024
e3a2854
test: decrease tolerances
gunjjoshi Aug 23, 2024
3d53747
docs: fix function name in example code
Planeshifter Sep 2, 2024
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
Next Next commit
chore: update benchmarks
  • Loading branch information
gunjjoshi committed Aug 23, 2024
commit dc8da047cc726c24c487b6660d140dc68297da67
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var randu = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var erfcx = require( './../lib' );
Expand All @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) {
var y;
var i;

x = randu( 100, -100.0, 100.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = erfcx( x );
y = erfcx( x[ i % x.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var randu = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( '@stdlib/math/base/special/erfcx/package.json' ).name;
var tryRequire = require( '@stdlib/utils/try-require' );
Expand All @@ -43,10 +43,11 @@ bench( pkg, opts, function benchmark( b ) {
var y;
var i;

x = randu( 100, -100.0, 100.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = erfcx( x );
y = erfcx( x[ i % x.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void print_version( void ) {
* @param total total number of tests
* @param passing total number of passing tests
*/
void print_summary( int total, int passing ) {
static void print_summary( int total, int passing ) {
printf( "#\n" );
printf( "1..%d\n", total ); // TAP plan
printf( "# total %d\n", total );
Expand All @@ -54,7 +54,7 @@ void print_summary( int total, int passing ) {
*
* @param elapsed elapsed time in seconds
*/
void print_results( double elapsed ) {
static void print_results( double elapsed ) {
double rate = (double)ITERATIONS / elapsed;
printf( " ---\n" );
printf( " iterations: %d\n", ITERATIONS );
Expand All @@ -68,7 +68,7 @@ void print_results( double elapsed ) {
*
* @return clock time
*/
double tic() {
static double tic( void ) {
struct timeval now;
gettimeofday( &now, NULL );
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
Expand All @@ -79,7 +79,7 @@ double tic() {
*
* @return random number
*/
double rand_double() {
static double rand_double( void ) {
int r = rand();
return (double)r / ( (double)RAND_MAX + 1.0 );
}
Expand All @@ -89,17 +89,20 @@ double rand_double() {
*
* @return elapsed time in seconds
*/
double benchmark() {
static double benchmark( void ) {
double elapsed;
double x;
double x[ 100 ];
double y;
double t;
int i;

for ( i = 0; i < 100; i++ ) {
x[ i ] = ( 1000.0f * rand_float() ) - 500.0f;
}

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( 2.0 * rand_double() ) - 0.0;
y = stdlib_base_erfcx( x );
y = stdlib_base_erfcx( x[ i % 100 ] );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
Expand Down
Loading