-
-
Notifications
You must be signed in to change notification settings - Fork 906
feat: add protocol support to stats/base/range
#5779
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
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c2ce045
refactor benchmark
jalajk3004 ccc1cd0
refactor
jalajk3004 d74bbfd
approved
jalajk3004 5d543ed
lint error
jalajk3004 165db04
changes
jalajk3004 ac356d1
check
jalajk3004 34f7be0
check
jalajk3004 888de28
linting error
jalajk3004 7bbc2db
repl
jalajk3004 dca37eb
done
jalajk3004 a9cc5fd
edit
jalajk3004 5bad41c
check
jalajk3004 81e2b19
repl
jalajk3004 73a5b99
check
jalajk3004 df60874
lint
jalajk3004 3fe3a45
license
jalajk3004 ef9646e
check
jalajk3004 a4b6e5a
repl
jalajk3004 74aaf56
-
jalajk3004 9d2bcd9
done
jalajk3004 0bc61fe
Merge branch 'develop' into range
kgryte 1eefcb5
Merge remote-tracking branch 'upstream/develop' into range
stdlib-bot 82df0a0
docs: clean-up examples
gururaj1512 76705e6
docs: clean repl
gururaj1512 b39d76f
fix: update implementation
gururaj1512 0130b73
bench: update benchmarks
gururaj1512 33f08ed
fix: test cases
gururaj1512 4c14dc9
docs: minor clean-ups
gururaj1512 56a1fd8
Update accessors.js
gururaj1512 051cb6c
Update ndarray.js
gururaj1512 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,124 @@ | ||
{{alias}}( N, x, strideX ) | ||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
{{alias}}( N, x, stride ) | ||
Computes the range of a strided array. | ||
|
||
The `N` and `stride` parameters determine which elements in `x` are accessed | ||
at runtime. | ||
|
||
Indexing is relative to the first index. To introduce an offset, use a typed | ||
array view. | ||
The `N` and stride parameters determine which elements in the strided | ||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
array are accessed at runtime. | ||
|
||
|
||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Indexing is relative to the first index. To introduce an offset, use a | ||
typed array view. | ||
|
||
|
||
If `N <= 0`, the function returns `NaN`. | ||
|
||
|
||
Parameters | ||
---------- | ||
|
||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
N: integer | ||
Number of indexed elements. | ||
|
||
|
||
x: Array<number>|TypedArray | ||
Input array. | ||
|
||
stride: integer | ||
Index increment. | ||
|
||
strideX: integer | ||
Stride length. | ||
|
||
|
||
Returns | ||
------- | ||
|
||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
out: number | ||
Range. | ||
|
||
|
||
Examples | ||
-------- | ||
|
||
|
||
// Standard Usage: | ||
> var x = [ 1.0, -2.0, 2.0 ]; | ||
> {{alias}}( x.length, x, 1 ) | ||
4.0 | ||
|
||
// Using `N` and `stride` parameters: | ||
|
||
gururaj1512 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
// Using `N` and stride parameters: | ||
> x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ]; | ||
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); | ||
> var stride = 2; | ||
> {{alias}}( N, x, stride ) | ||
> {{alias}}( 3, x, stride ) | ||
4.0 | ||
|
||
|
||
// Using view offsets: | ||
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); | ||
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); | ||
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); | ||
> stride = 2; | ||
> {{alias}}( N, x1, stride ) | ||
> {{alias}}( 3, x1, stride ) | ||
4.0 | ||
|
||
{{alias}}.ndarray( N, x, stride, offset ) | ||
Computes the range of a strided array using alternative indexing semantics. | ||
|
||
{{alias}}.ndarray( N, x, strideX, offsetX ) | ||
|
||
|
||
Computes the range of a strided array using alternative indexing | ||
semantics. | ||
|
||
|
||
While typed array views mandate a view offset based on the underlying | ||
buffer, the `offset` parameter supports indexing semantics based on a | ||
starting index. | ||
|
||
|
||
Parameters | ||
---------- | ||
|
||
|
||
N: integer | ||
Number of indexed elements. | ||
|
||
|
||
x: Array<number>|TypedArray | ||
Input array. | ||
|
||
stride: integer | ||
Index increment. | ||
|
||
offset: integer | ||
strideX: integer | ||
Stride length. | ||
|
||
|
||
offsetX: integer | ||
Starting index. | ||
|
||
|
||
Returns | ||
------- | ||
|
||
|
||
out: number | ||
Range. | ||
|
||
|
||
Examples | ||
-------- | ||
|
||
|
||
// Standard Usage: | ||
> var x = [ 1.0, -2.0, 2.0 ]; | ||
> {{alias}}.ndarray( x.length, x, 1, 0 ) | ||
4.0 | ||
|
||
|
||
// Using offset parameter: | ||
> var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ]; | ||
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); | ||
> {{alias}}.ndarray( N, x, 2, 1 ) | ||
> {{alias}}.ndarray( 3, x, 2, 1 ) | ||
4.0 | ||
|
||
See Also | ||
-------- | ||
|
||
See Also | ||
-------- |
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
Oops, something went wrong.
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.