Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Apr 27, 2024
1 parent c939361 commit 9509b59
Show file tree
Hide file tree
Showing 22 changed files with 178 additions and 271 deletions.
29 changes: 23 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,27 @@
*.mov binary

# Override what is considered "vendored" by GitHub's linguist:
/deps/** linguist-vendored=false
/lib/node_modules/** linguist-vendored=false linguist-generated=false
test/fixtures/** linguist-vendored=false
tools/** linguist-vendored=false
/lib/node_modules/** -linguist-vendored -linguist-generated

# Override what is considered "documentation" by GitHub's linguist:
examples/** linguist-documentation=false
# Configure directories which should *not* be included in GitHub language statistics:
/deps/** linguist-vendored
/dist/** linguist-generated
/workshops/** linguist-vendored

benchmark/** linguist-vendored
docs/* linguist-documentation
etc/** linguist-vendored
examples/** linguist-documentation
scripts/** linguist-vendored
test/** linguist-vendored
tools/** linguist-vendored

# Configure files which should *not* be included in GitHub language statistics:
Makefile linguist-vendored
*.mk linguist-vendored
*.jl linguist-vendored
*.py linguist-vendored
*.R linguist-vendored

# Configure files which should be included in GitHub language statistics:
docs/types/*.d.ts -linguist-documentation
3 changes: 0 additions & 3 deletions .github/workflows/productionize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down Expand Up @@ -518,7 +517,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down Expand Up @@ -698,7 +696,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,5 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()
3 changes: 0 additions & 3 deletions .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down Expand Up @@ -139,7 +138,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down Expand Up @@ -184,6 +182,5 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()
1 change: 0 additions & 1 deletion .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,5 @@ jobs:
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()
5 changes: 5 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Adarsh Palaskar <adarshpalaskar99@gmail.com>
Aditya Sapra <adityaework@gmail.com>
AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>
Aleksandr <112382387+alextes90@users.noreply.github.com>
Ali Salesi <ali_sal1381@yahoo.com>
Aman Bhansali <bhansali.1@iitj.ac.in>
Amit Jimiwal <amitjimiwal45@gmail.com>
Expand All @@ -18,6 +19,7 @@ Chinmay Joshi <86140365+JawHawk@users.noreply.github.com>
Christopher Dambamuromo <chridam@gmail.com>
Dan Rose <danoftheroses@gmail.com>
Daniel Killenberger <daniel.killenberger@gmail.com>
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
Dominik Moritz <domoritz@gmail.com>
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
Expand Down Expand Up @@ -69,8 +71,10 @@ Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
Shivam <11shivam00@gmail.com>
Shraddheya Shendre <shendreshraddheya@gmail.com>
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
Shubham Mishra <shubh622005@gmail.com>
Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
Spandan Barve <contact@marsian.dev>
Stephannie Jiménez Gacha <steff456@hotmail.com>
Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com>
Expand All @@ -83,4 +87,5 @@ Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
naveen <stupiddint@gmail.com>
nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
orimiles5 <97595296+orimiles5@users.noreply.github.com>
rainn <88160429+AmCodesLame@users.noreply.github.com>
rei2hu <reimu@reimu.ws>
44 changes: 13 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var ssorthp = require( '@stdlib/blas-ext-base-ssorthp' );

#### ssorthp( N, order, x, stride )

Sorts a single-precision floating-point strided array `x` using heapsort.
Sorts a single-precision floating-point strided array using heapsort.

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -83,40 +83,36 @@ The function has the following parameters:
- **x**: input [`Float32Array`][@stdlib/array/float32].
- **stride**: index increment.

The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to sort every other element
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to sort every other element

```javascript
var Float32Array = require( '@stdlib/array-float32' );
var floor = require( '@stdlib/math-base-special-floor' );

var x = new Float32Array( [ 1.0, -2.0, 3.0, -4.0 ] );
var N = floor( x.length / 2 );

ssorthp( N, -1.0, x, 2 );
ssorthp( 2, -1.0, x, 2 );
// x => <Float32Array>[ 3.0, -2.0, 1.0, -4.0 ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.

```javascript
var Float32Array = require( '@stdlib/array-float32' );
var floor = require( '@stdlib/math-base-special-floor' );

// Initial array...
var x0 = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] );

// Create an offset view...
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var N = floor( x0.length/2 );
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 );

// Sort every other element...
ssorthp( N, -1.0, x1, 2 );
ssorthp( 2, -1.0, x1, 2 );
// x0 => <Float32Array>[ 1.0, 4.0, 3.0, 2.0 ]
```

#### ssorthp.ndarray( N, order, x, stride, offset )

Sorts a single-precision floating-point strided array `x` using heapsort and alternative indexing semantics.
Sorts a single-precision floating-point strided array using heapsort and alternative indexing semantics.

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -131,7 +127,7 @@ The function has the following additional parameters:

- **offset**: starting index.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of `x`
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of the strided array

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -150,7 +146,7 @@ ssorthp.ndarray( 3, 1.0, x, 1, x.length-3 );

## Notes

- If `N <= 0` or `order == 0.0`, both functions return `x` unchanged.
- If `N <= 0` or `order == 0.0`, both functions return the strided array unchanged.
- The algorithm distinguishes between `-0` and `+0`. When sorted in increasing order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is sorted after `+0`.
- The algorithm sorts `NaN` values to the end. When sorted in increasing order, `NaN` values are sorted last. When sorted in decreasing order, `NaN` values are sorted first.
- The algorithm has space complexity `O(1)` and time complexity `O(N log2 N)`.
Expand All @@ -168,27 +164,13 @@ ssorthp.ndarray( 3, 1.0, x, 1, x.length-3 );
<!-- eslint no-undef: "error" -->

```javascript
var round = require( '@stdlib/math-base-special-round' );
var randu = require( '@stdlib/random-base-randu' );
var Float32Array = require( '@stdlib/array-float32' );
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
var filledarrayBy = require( '@stdlib/array-filled-by' );
var ssorthp = require( '@stdlib/blas-ext-base-ssorthp' );

var rand;
var sign;
var x;
var i;

x = new Float32Array( 10 );
for ( i = 0; i < x.length; i++ ) {
rand = round( randu()*100.0 );
sign = randu();
if ( sign < 0.5 ) {
sign = -1.0;
} else {
sign = 1.0;
}
x[ i ] = sign * rand;
}
var rand = discreteUniform( -100, 100 );
var x = filledarrayBy( 10, 'float32', rand );

console.log( x );

ssorthp( x.length, -1.0, x, -1 );
Expand Down
38 changes: 20 additions & 18 deletions docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
{{alias}}( N, order, x, stride )
Sorts a single-precision floating-point strided array using heapsort.

The `N` and `stride` parameters determine which elements in `x` are accessed
The `N` and stride parameters determine which elements in the strided
array are accessed
at runtime.

Indexing is relative to the first index. To introduce an offset, use typed
array views.

If `N <= 0` or `order == 0`, the function returns `x` unchanged.
If `N <= 0` or `order == 0`, the function returns the strided
array unchanged.

The algorithm distinguishes between `-0` and `+0`. When sorted in increasing
order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is
Expand All @@ -33,19 +35,20 @@
Number of indexed elements.

order: number
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
If `order > 0`, the function sorts `x` in increasing order.
Sort order. If `order < 0`, the function sorts the strided array in
decreasing order. If `order > 0`, the function sorts the strided array
in increasing order.

x: Float32Array
Input array.

stride: integer
Index increment for `x`.
Index increment for the strided array.

Returns
-------
x: Float32Array
Input array `x`.
Input array the strided array.

Examples
--------
Expand All @@ -54,21 +57,20 @@
> {{alias}}( x.length, 1, x, 1 )
<Float32Array>[ -4.0, -2.0, 1.0, 3.0 ]

// Using `N` and `stride` parameters:
// Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, -4.0 ] );
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
> {{alias}}( N, -1, x, 2 )
> {{alias}}( 2, -1, x, 2 )
<Float32Array>[ 3.0, -2.0, 1.0, -4.0 ]

// Using view offsets:
> var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, -4.0 ] );
> var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
> {{alias}}( N, 1, x1, 2 )
> {{alias}}( 2, 1, x1, 2 )
<Float32Array>[ -4.0, 3.0, -2.0 ]
> x0
<Float32Array>[ 1.0, -4.0, 3.0, -2.0 ]


{{alias}}.ndarray( N, order, x, stride, offset )
Sorts a single-precision floating-point strided array using heapsort and
alternative indexing semantics.
Expand All @@ -83,22 +85,23 @@
Number of indexed elements.

order: number
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
If `order > 0`, the function sorts `x` in increasing order.
Sort order. If `order < 0`, the function sorts the strided array in
decreasing order. If `order > 0`, the function sorts the strided array
in increasing order.

x: Float32Array
Input array.

stride: integer
Index increment for `x`.
Index increment for the strided array.

offset: integer
Starting index of `x`.
Starting index of the strided array.

Returns
-------
x: Float32Array
Input array `x`.
Output array.

Examples
--------
Expand All @@ -109,8 +112,7 @@

// Using an index offset:
> x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, -4.0 ] );
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
> {{alias}}.ndarray( N, 1, x, 2, 1 )
> {{alias}}.ndarray( 2, 1, x, 2, 1 )
<Float32Array>[ 1.0, -4.0, 3.0, -2.0 ]

See Also
Expand Down
6 changes: 3 additions & 3 deletions docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface Routine {
* @param order - sort order
* @param x - input array
* @param stride - stride length
* @returns `x`
* @returns input array
*
* @example
* var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -49,7 +49,7 @@ interface Routine {
* @param x - input array
* @param stride - stride length
* @param offset - starting index
* @returns `x`
* @returns input array
*
* @example
* var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -69,7 +69,7 @@ interface Routine {
* @param order - sort order
* @param x - input array
* @param stride - stride length
* @returns `x`
* @returns input array
*
* @example
* var Float32Array = require( '@stdlib/array-float32' );
Expand Down
Loading

0 comments on commit 9509b59

Please sign in to comment.