-
-
Notifications
You must be signed in to change notification settings - Fork 839
feat: add assign and strided methods to csignumf #7331
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
Open
Deepak91168
wants to merge
15
commits into
stdlib-js:develop
Choose a base branch
from
Deepak91168:assign/stride
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
165c4a2
chore: test empty commit for push functionality
Deepak91168 3916b0e
chore: fix EditorConfig lint errors (issue #7296)
Deepak91168 f42f40d
feat: add assign for csignumf
Deepak91168 418d3f9
feat: add assign for csignumf in index
Deepak91168 acc04d2
feat: add strided for csignumf function
Deepak91168 2e59850
test: add tests for package csignumf-assign
Deepak91168 eac64a6
test: add test for csignumf strided
Deepak91168 4b3c2bf
test: add edge case tests for csignumf.assign including infinities
Deepak91168 bfd26de
bench: add benchmarking for assign and strided
Deepak91168 bd6f38c
refactor: strided.js variables
Deepak91168 28f9780
docs: update for assign and stride
Deepak91168 0b1a520
docs: update test.ts for assign and stride
Deepak91168 10a506a
docs: update README.md for csignumf usage and examples
Deepak91168 f06e5e0
docs: update repl for csignum assign and strided
Deepak91168 2caf4de
fix: addresses comments for csignumf
Deepak91168 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
69 changes: 69 additions & 0 deletions
69
lib/node_modules/@stdlib/math/base/special/csignumf/benchmark/benchmark.assign.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,69 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2025 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 bench = require( '@stdlib/bench' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); | ||
var Float32Array = require( '@stdlib/array/float32' ); | ||
var pkg = require( './../package.json' ).name; | ||
var csignumf = require( './../lib' ); | ||
|
||
|
||
// VARIABLES // | ||
|
||
var options = { | ||
'dtype': 'float32' | ||
}; | ||
|
||
|
||
// MAIN // | ||
|
||
bench( pkg+':assign', function benchmark( b ) { | ||
var out; | ||
var re; | ||
var im; | ||
var N; | ||
var i; | ||
var j; | ||
|
||
N = 100; | ||
re = uniform( N, -500.0, 500.0, options ); | ||
im = uniform( N, -500.0, 500.0, options ); | ||
|
||
out = new Float32Array( 2 ); | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
j = i % N; | ||
out = csignumf.assign( re[ j ], im[ j ], out, 1, 0 ); | ||
if ( typeof out !== 'object' ) { | ||
b.fail( 'should return an object' ); | ||
} | ||
} | ||
b.toc(); | ||
|
||
if ( isnanf( out[ 0 ] ) || isnanf( out[ 1 ] ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
}); |
65 changes: 65 additions & 0 deletions
65
lib/node_modules/@stdlib/math/base/special/csignumf/benchmark/benchmark.strided.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,65 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2025 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 bench = require( '@stdlib/bench' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var Float32Array = require( '@stdlib/array/float32' ); | ||
var pkg = require( './../package.json' ).name; | ||
var csignumf = require( './../lib' ); | ||
|
||
|
||
// VARIABLES // | ||
|
||
var options = { | ||
'dtype': 'float32' | ||
}; | ||
|
||
|
||
// MAIN // | ||
|
||
bench( pkg+':strided', function benchmark( b ) { | ||
var out; | ||
var z; | ||
var N; | ||
var i; | ||
var j; | ||
|
||
N = 50; | ||
z = uniform( N*2, -500.0, 500.0, options ); | ||
out = new Float32Array( 2 ); | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
j = ( i % N ) * 2; | ||
out = csignumf.strided( z, 1, j, out, 1, 0 ); | ||
if ( typeof out !== 'object' ) { | ||
b.fail( 'should return an object' ); | ||
} | ||
} | ||
b.toc(); | ||
if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
}); |
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
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.