-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: refactor to remove
out
argument and add C implementation
This commits removes support for providing an `out` argument and now operates on complex number objects. BREAKING CHANGE: remove support for `out` argument and use complex number objects To migrate, consumers need to use complex number objects. PR-URL: #981 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Private-ref: stdlib-js/todo#1454
- Loading branch information
Showing
25 changed files
with
1,984 additions
and
412 deletions.
There are no files selected for viewing
This file contains 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 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
67 changes: 67 additions & 0 deletions
67
lib/node_modules/@stdlib/math/base/special/cinv/benchmark/benchmark.native.js
This file contains 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,67 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2023 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/base/uniform' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var real = require( '@stdlib/complex/real' ); | ||
var imag = require( '@stdlib/complex/imag' ); | ||
var Complex128 = require( '@stdlib/complex/float64' ); | ||
var tryRequire = require( '@stdlib/utils/try-require' ); | ||
var pkg = require( './../package.json' ).name; | ||
|
||
|
||
// VARIABLES // | ||
|
||
var cinv = tryRequire( resolve( __dirname, './../lib/native.js' ) ); | ||
var opts = { | ||
'skip': ( cinv instanceof Error ) | ||
}; | ||
|
||
|
||
// MAIN // | ||
|
||
bench( pkg+'::native', opts, function benchmark( b ) { | ||
var values; | ||
var y; | ||
var i; | ||
|
||
values = [ | ||
new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), | ||
new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) | ||
]; | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
y = cinv( values[ i%values.length ] ); | ||
if ( isnan( real( y ) ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
} | ||
b.toc(); | ||
if ( isnan( imag( y ) ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
}); |
Oops, something went wrong.