@stdlib/blas-ext-base-dsorthp 0.0.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # dsorthp
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -199,9 +210,9 @@ console.log( x );
199
210
 
200
211
  ## See Also
201
212
 
202
- - <span class="package-name">[`@stdlib/blas/ext/base/dsort2hp`][@stdlib/blas/ext/base/dsort2hp]</span><span class="delimiter">: </span><span class="description">simultaneously sort two double-precision floating-point strided arrays based on the sort order of the first array using heapsort.</span>
203
- - <span class="package-name">[`@stdlib/blas/ext/base/gsorthp`][@stdlib/blas/ext/base/gsorthp]</span><span class="delimiter">: </span><span class="description">sort a strided array using heapsort.</span>
204
- - <span class="package-name">[`@stdlib/blas/ext/base/ssorthp`][@stdlib/blas/ext/base/ssorthp]</span><span class="delimiter">: </span><span class="description">sort a single-precision floating-point strided array using heapsort.</span>
213
+ - <span class="package-name">[`@stdlib/blas-ext/base/dsort2hp`][@stdlib/blas/ext/base/dsort2hp]</span><span class="delimiter">: </span><span class="description">simultaneously sort two double-precision floating-point strided arrays based on the sort order of the first array using heapsort.</span>
214
+ - <span class="package-name">[`@stdlib/blas-ext/base/gsorthp`][@stdlib/blas/ext/base/gsorthp]</span><span class="delimiter">: </span><span class="description">sort a strided array using heapsort.</span>
215
+ - <span class="package-name">[`@stdlib/blas-ext/base/ssorthp`][@stdlib/blas/ext/base/ssorthp]</span><span class="delimiter">: </span><span class="description">sort a single-precision floating-point strided array using heapsort.</span>
205
216
 
206
217
  </section>
207
218
 
@@ -233,7 +244,7 @@ See [LICENSE][stdlib-license].
233
244
 
234
245
  ## Copyright
235
246
 
236
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
247
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
237
248
 
238
249
  </section>
239
250
 
@@ -246,8 +257,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
246
257
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsorthp.svg
247
258
  [npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsorthp
248
259
 
249
- [test-image]: https://github.com/stdlib-js/blas-ext-base-dsorthp/actions/workflows/test.yml/badge.svg?branch=v0.0.10
250
- [test-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/actions/workflows/test.yml?query=branch:v0.0.10
260
+ [test-image]: https://github.com/stdlib-js/blas-ext-base-dsorthp/actions/workflows/test.yml/badge.svg?branch=v0.2.0
261
+ [test-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/actions/workflows/test.yml?query=branch:v0.2.0
251
262
 
252
263
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsorthp/main.svg
253
264
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsorthp?branch=main
@@ -260,7 +271,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
260
271
  -->
261
272
 
262
273
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
263
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
274
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
264
275
 
265
276
  [stdlib]: https://github.com/stdlib-js/stdlib
266
277
 
@@ -270,8 +281,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
270
281
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
271
282
 
272
283
  [deno-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/tree/deno
284
+ [deno-readme]: https://github.com/stdlib-js/blas-ext-base-dsorthp/blob/deno/README.md
273
285
  [umd-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/tree/umd
286
+ [umd-readme]: https://github.com/stdlib-js/blas-ext-base-dsorthp/blob/umd/README.md
274
287
  [esm-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/tree/esm
288
+ [esm-readme]: https://github.com/stdlib-js/blas-ext-base-dsorthp/blob/esm/README.md
275
289
  [branches-url]: https://github.com/stdlib-js/blas-ext-base-dsorthp/blob/main/branches.md
276
290
 
277
291
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-dsorthp/main/LICENSE
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import dsorthp from '../docs/types/index';
3
+ export = dsorthp;
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";var s=function(l,p){return function(){return p||l((p={exports:{}}).exports,p),p.exports}};var y=s(function(K,w){
2
+ var j=require('@stdlib/math-base-assert-is-positive-zero/dist'),k=require('@stdlib/math-base-assert-is-nan/dist'),g=require('@stdlib/math-base-special-floor/dist');function z(l,p,r,e){var i,q,v,a,h,u,o,t,n,c;if(l<=0||p===0)return r;for(p<0&&(e*=-1),e<0?i=(1-l)*e:i=0,u=l,q=g(l/2);;){if(q>0)q-=1,o=r[i+q*e];else{if(u-=1,u===0)return r;t=i+u*e,o=r[t],r[t]=r[i]}for(n=q,v=n*2+1;v<u&&(c=v+1,c<u&&(a=r[i+c*e],h=r[i+v*e],(a>h||k(a)||a===h&&j(a))&&(v+=1)),a=r[i+v*e],a>o||k(a)||a===o&&j(a));)r[i+n*e]=a,n=v,v=n*2+1;r[i+n*e]=o}}w.exports=z
3
+ });var R=s(function(L,P){
4
+ var m=require('@stdlib/math-base-assert-is-positive-zero/dist'),b=require('@stdlib/math-base-assert-is-nan/dist'),A=require('@stdlib/math-base-special-floor/dist');function B(l,p,r,e,i){var q,v,a,h,u,o,t,n,c;if(l<=0||p===0)return r;for(p<0&&(e*=-1,i-=(l-1)*e),u=l,q=A(l/2);;){if(q>0)q-=1,o=r[i+q*e];else{if(u-=1,u===0)return r;t=i+u*e,o=r[t],r[t]=r[i]}for(n=q,v=n*2+1;v<u&&(c=v+1,c<u&&(a=r[i+c*e],h=r[i+v*e],(a>h||b(a)||a===h&&m(a))&&(v+=1)),a=r[i+v*e],a>o||b(a)||a===o&&m(a));)r[i+n*e]=a,n=v,v=n*2+1;r[i+n*e]=o}}P.exports=B
5
+ });var E=s(function(M,_){
6
+ var C=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),Z=y(),D=R();C(Z,"ndarray",D);_.exports=Z
7
+ });var F=require("path").join,G=require('@stdlib/utils-try-require/dist'),H=require('@stdlib/assert-is-error/dist'),I=E(),f,O=G(F(__dirname,"./native.js"));H(O)?f=I:f=O;module.exports=f;
8
+ /** @license Apache-2.0 */
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/dsorthp.js", "../lib/ndarray.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isPositiveZero = require( '@stdlib/math-base-assert-is-positive-zero' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Sorts a double-precision floating-point strided array using heapsort.\n*\n* ## Notes\n*\n* - This implementation uses an in-place algorithm derived from the work of Floyd (1964).\n*\n* ## References\n*\n* - Williams, John William Joseph. 1964. \"Algorithm 232: Heapsort.\" _Communications of the ACM_ 7 (6). New York, NY, USA: Association for Computing Machinery: 347\u201349. doi:[10.1145/512274.512284](https://doi.org/10.1145/512274.512284).\n* - Floyd, Robert W. 1964. \"Algorithm 245: Treesort.\" _Communications of the ACM_ 7 (12). New York, NY, USA: Association for Computing Machinery: 701. doi:[10.1145/355588.365103](https://doi.org/10.1145/355588.365103).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} order - sort order\n* @param {Float64Array} x - input array\n* @param {integer} stride - index increment\n* @returns {Float64Array} input array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsorthp( x.length, 1.0, x, 1 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*/\nfunction dsorthp( N, order, x, stride ) {\n\tvar offset;\n\tvar parent;\n\tvar child;\n\tvar v1;\n\tvar v2;\n\tvar n;\n\tvar t;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tif ( N <= 0 || order === 0.0 ) {\n\t\treturn x;\n\t}\n\t// For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order...\n\tif ( order < 0.0 ) {\n\t\tstride *= -1;\n\t}\n\tif ( stride < 0 ) {\n\t\toffset = (1-N) * stride;\n\t} else {\n\t\toffset = 0;\n\t}\n\t// Set the initial heap size:\n\tn = N;\n\n\t// Specify an initial \"parent\" index for building the heap:\n\tparent = floor( N / 2 );\n\n\t// Continue looping until the array is sorted...\n\twhile ( true ) {\n\t\tif ( parent > 0 ) {\n\t\t\t// We need to build the heap...\n\t\t\tparent -= 1;\n\t\t\tt = x[ offset+(parent*stride) ];\n\t\t} else {\n\t\t\t// Reduce the heap size:\n\t\t\tn -= 1;\n\n\t\t\t// Check if the heap is empty, and, if so, we are finished sorting...\n\t\t\tif ( n === 0 ) {\n\t\t\t\treturn x;\n\t\t\t}\n\t\t\t// Store the last heap value in a temporary variable in order to make room for the heap root being placed into its sorted position:\n\t\t\ti = offset + (n*stride);\n\t\t\tt = x[ i ];\n\n\t\t\t// Move the heap root to its sorted position:\n\t\t\tx[ i ] = x[ offset ];\n\t\t}\n\t\t// We need to \"sift down\", pushing `t` down the heap to in order to replace the parent and satisfy the heap property...\n\n\t\t// Start at the parent index:\n\t\tj = parent;\n\n\t\t// Get the \"left\" child index:\n\t\tchild = (j*2) + 1;\n\n\t\twhile ( child < n ) {\n\t\t\t// Find the largest child...\n\t\t\tk = child + 1;\n\t\t\tif ( k < n ) {\n\t\t\t\tv1 = x[ offset+(k*stride) ];\n\t\t\t\tv2 = x[ offset+(child*stride) ];\n\n\t\t\t\t// Check if a \"right\" child exists and is \"bigger\"...\n\t\t\t\tif ( v1 > v2 || isnan( v1 ) || (v1 === v2 && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t\tchild += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check if the largest child is bigger than `t`...\n\t\t\tv1 = x[ offset+(child*stride) ];\n\t\t\tif ( v1 > t || isnan( v1 ) || ( v1 === t && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t// Insert the larger child value:\n\t\t\t\tx[ offset+(j*stride) ] = v1;\n\n\t\t\t\t// Update `j` to point to the child index:\n\t\t\t\tj = child;\n\n\t\t\t\t// Get the \"left\" child index and repeat...\n\t\t\t\tchild = (j*2) + 1;\n\t\t\t} else {\n\t\t\t\t// We've found `t`'s place in the heap...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Insert `t` into the heap:\n\t\tx[ offset+(j*stride) ] = t;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsorthp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isPositiveZero = require( '@stdlib/math-base-assert-is-positive-zero' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Sorts a double-precision floating-point strided array using heapsort.\n*\n* ## Notes\n*\n* - This implementation uses an in-place algorithm derived from the work of Floyd (1964).\n*\n* ## References\n*\n* - Williams, John William Joseph. 1964. \"Algorithm 232: Heapsort.\" _Communications of the ACM_ 7 (6). New York, NY, USA: Association for Computing Machinery: 347\u201349. doi:[10.1145/512274.512284](https://doi.org/10.1145/512274.512284).\n* - Floyd, Robert W. 1964. \"Algorithm 245: Treesort.\" _Communications of the ACM_ 7 (12). New York, NY, USA: Association for Computing Machinery: 701. doi:[10.1145/355588.365103](https://doi.org/10.1145/355588.365103).\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {number} order - sort order\n* @param {Float64Array} x - input array\n* @param {integer} stride - index increment\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float64Array} input array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsorthp( x.length, 1.0, x, 1, 0 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*/\nfunction dsorthp( N, order, x, stride, offset ) {\n\tvar parent;\n\tvar child;\n\tvar v1;\n\tvar v2;\n\tvar n;\n\tvar t;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tif ( N <= 0 || order === 0.0 ) {\n\t\treturn x;\n\t}\n\t// For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order...\n\tif ( order < 0.0 ) {\n\t\tstride *= -1;\n\t\toffset -= (N-1) * stride;\n\t}\n\t// Set the initial heap size:\n\tn = N;\n\n\t// Specify an initial \"parent\" index for building the heap:\n\tparent = floor( N / 2 );\n\n\t// Continue looping until the array is sorted...\n\twhile ( true ) {\n\t\tif ( parent > 0 ) {\n\t\t\t// We need to build the heap...\n\t\t\tparent -= 1;\n\t\t\tt = x[ offset+(parent*stride) ];\n\t\t} else {\n\t\t\t// Reduce the heap size:\n\t\t\tn -= 1;\n\n\t\t\t// Check if the heap is empty, and, if so, we are finished sorting...\n\t\t\tif ( n === 0 ) {\n\t\t\t\treturn x;\n\t\t\t}\n\t\t\t// Store the last heap value in a temporary variable in order to make room for the heap root being placed into its sorted position:\n\t\t\ti = offset + (n*stride);\n\t\t\tt = x[ i ];\n\n\t\t\t// Move the heap root to its sorted position:\n\t\t\tx[ i ] = x[ offset ];\n\t\t}\n\t\t// We need to \"sift down\", pushing `t` down the heap to in order to replace the parent and satisfy the heap property...\n\n\t\t// Start at the parent index:\n\t\tj = parent;\n\n\t\t// Get the \"left\" child index:\n\t\tchild = (j*2) + 1;\n\n\t\twhile ( child < n ) {\n\t\t\t// Find the largest child...\n\t\t\tk = child + 1;\n\t\t\tif ( k < n ) {\n\t\t\t\tv1 = x[ offset+(k*stride) ];\n\t\t\t\tv2 = x[ offset+(child*stride) ];\n\n\t\t\t\t// Check if a \"right\" child exists and is \"bigger\"...\n\t\t\t\tif ( v1 > v2 || isnan( v1 ) || (v1 === v2 && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t\tchild += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check if the largest child is bigger than `t`...\n\t\t\tv1 = x[ offset+(child*stride) ];\n\t\t\tif ( v1 > t || isnan( v1 ) || ( v1 === t && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t// Insert the larger child value:\n\t\t\t\tx[ offset+(j*stride) ] = v1;\n\n\t\t\t\t// Update `j` to point to the child index:\n\t\t\t\tj = child;\n\n\t\t\t\t// Get the \"left\" child index and repeat...\n\t\t\t\tchild = (j*2) + 1;\n\t\t\t} else {\n\t\t\t\t// We've found `t`'s place in the heap...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Insert `t` into the heap:\n\t\tx[ offset+(j*stride) ] = t;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsorthp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dsorthp = require( './dsorthp.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsorthp, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsorthp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Sort a double-precision floating-point strided array using heapsort.\n*\n* @module @stdlib/blas-ext-base-dsorthp\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dsorthp = require( '@stdlib/blas-ext-base-dsorthp' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsorthp( x.length, 1.0, x, 1 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dsorthp = require( '@stdlib/blas-ext-base-dsorthp' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsorthp.ndarray( x.length, 1.0, x, 1, 0 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dsorthp;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsorthp = main;\n} else {\n\tdsorthp = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsorthp;\n\n// exports: { \"ndarray\": \"dsorthp.ndarray\" }\n"],
5
+ "mappings": "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",
6
+ "names": ["require_dsorthp", "__commonJSMin", "exports", "module", "isPositiveZero", "isnan", "floor", "dsorthp", "N", "order", "x", "stride", "offset", "parent", "child", "v1", "v2", "n", "t", "i", "j", "k", "require_ndarray", "__commonJSMin", "exports", "module", "isPositiveZero", "isnan", "floor", "dsorthp", "N", "order", "x", "stride", "offset", "parent", "child", "v1", "v2", "n", "t", "i", "j", "k", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsorthp", "ndarray", "join", "tryRequire", "isError", "main", "dsorthp", "tmp"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Interface describing `dsorthp`.
@@ -32,7 +32,7 @@ interface Routine {
32
32
  * @returns `x`
33
33
  *
34
34
  * @example
35
- * var Float64Array = require( `@stdlib/array/float64` );
35
+ * var Float64Array = require( '@stdlib/array-float64' );
36
36
  *
37
37
  * var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
38
38
  *
@@ -52,14 +52,14 @@ interface Routine {
52
52
  * @returns `x`
53
53
  *
54
54
  * @example
55
- * var Float64Array = require( `@stdlib/array/float64` );
55
+ * var Float64Array = require( '@stdlib/array-float64' );
56
56
  *
57
57
  * var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
58
58
  *
59
59
  * dsorthp.ndarray( x.length, 1, x, 1, 0 );
60
60
  * // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
61
61
  */
62
- ndarray( N: number, order: number, x: Float64Array, stride: number, offset: number ): Float64Array; // tslint:disable-line:max-line-length
62
+ ndarray( N: number, order: number, x: Float64Array, stride: number, offset: number ): Float64Array;
63
63
  }
64
64
 
65
65
  /**
@@ -72,7 +72,7 @@ interface Routine {
72
72
  * @returns `x`
73
73
  *
74
74
  * @example
75
- * var Float64Array = require( `@stdlib/array/float64` );
75
+ * var Float64Array = require( '@stdlib/array-float64' );
76
76
  *
77
77
  * var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
78
78
  *
@@ -80,7 +80,7 @@ interface Routine {
80
80
  * // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
81
81
  *
82
82
  * @example
83
- * var Float64Array = require( `@stdlib/array/float64` );
83
+ * var Float64Array = require( '@stdlib/array-float64' );
84
84
  *
85
85
  * var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
86
86
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-ext-base-dsorthp",
3
- "version": "0.0.10",
3
+ "version": "0.2.0",
4
4
  "description": "Sort a double-precision floating-point strided array using heapsort.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -41,29 +41,30 @@
41
41
  "url": "https://github.com/stdlib-js/stdlib/issues"
42
42
  },
43
43
  "dependencies": {
44
- "@stdlib/assert-is-error": "^0.0.x",
45
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
46
- "@stdlib/math-base-assert-is-positive-zero": "^0.0.x",
47
- "@stdlib/math-base-special-floor": "^0.0.x",
48
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
49
- "@stdlib/utils-library-manifest": "^0.0.x",
50
- "@stdlib/utils-try-require": "^0.0.x"
44
+ "@stdlib/assert-is-error": "^0.2.0",
45
+ "@stdlib/math-base-assert-is-nan": "^0.2.0",
46
+ "@stdlib/math-base-assert-is-positive-zero": "^0.2.0",
47
+ "@stdlib/math-base-special-floor": "^0.2.0",
48
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0",
49
+ "@stdlib/utils-library-manifest": "^0.2.0",
50
+ "@stdlib/utils-try-require": "^0.2.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@stdlib/array-float64": "^0.0.x",
54
- "@stdlib/assert-is-browser": "^0.0.x",
55
- "@stdlib/bench": "^0.0.x",
56
- "@stdlib/blas-base-dcopy": "^0.0.x",
57
- "@stdlib/math-base-assert-is-negative-zero": "^0.0.x",
58
- "@stdlib/math-base-special-pow": "^0.0.x",
59
- "@stdlib/math-base-special-round": "^0.0.x",
60
- "@stdlib/random-base-discrete-uniform": "^0.0.x",
61
- "@stdlib/random-base-randu": "^0.0.x",
62
- "@stdlib/random-base-uniform": "^0.0.x",
53
+ "@stdlib/array-float64": "^0.1.1",
54
+ "@stdlib/assert-is-browser": "^0.1.1",
55
+ "@stdlib/blas-base-dcopy": "^0.1.1",
56
+ "@stdlib/math-base-assert-is-negative-zero": "^0.1.1",
57
+ "@stdlib/math-base-special-pow": "^0.1.0",
58
+ "@stdlib/math-base-special-round": "^0.1.1",
59
+ "@stdlib/random-base-discrete-uniform": "^0.1.0",
60
+ "@stdlib/random-base-randu": "^0.1.0",
61
+ "@stdlib/random-base-uniform": "^0.1.0",
63
62
  "proxyquire": "^2.0.0",
64
63
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
65
64
  "istanbul": "^0.4.1",
66
- "tap-spec": "5.x.x"
65
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
66
+ "@stdlib/bench-harness": "^0.2.0",
67
+ "@stdlib/bench": "^0.3.1"
67
68
  },
68
69
  "engines": {
69
70
  "node": ">=0.10.0",
@@ -102,7 +103,7 @@
102
103
  ],
103
104
  "__stdlib__": {},
104
105
  "funding": {
105
- "type": "patreon",
106
- "url": "https://www.patreon.com/athan"
106
+ "type": "opencollective",
107
+ "url": "https://opencollective.com/stdlib"
107
108
  }
108
109
  }
package/docs/repl.txt DELETED
@@ -1,118 +0,0 @@
1
-
2
- {{alias}}( N, order, x, stride )
3
- Sorts a double-precision floating-point strided array using heapsort.
4
-
5
- The `N` and `stride` parameters determine which elements in `x` are accessed
6
- at runtime.
7
-
8
- Indexing is relative to the first index. To introduce an offset, use typed
9
- array views.
10
-
11
- If `N <= 0` or `order == 0`, the function returns `x` unchanged.
12
-
13
- The algorithm distinguishes between `-0` and `+0`. When sorted in increasing
14
- order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is
15
- sorted after `+0`.
16
-
17
- The algorithm sorts `NaN` values to the end. When sorted in increasing
18
- order, `NaN` values are sorted last. When sorted in decreasing order, `NaN`
19
- values are sorted first.
20
-
21
- The algorithm has space complexity O(1) and time complexity O(N log2 N).
22
-
23
- The algorithm is *unstable*, meaning that the algorithm may change the order
24
- of strided array elements which are equal or equivalent (e.g., `NaN`
25
- values).
26
-
27
- The input strided array is sorted *in-place* (i.e., the input strided array
28
- is *mutated*).
29
-
30
- Parameters
31
- ----------
32
- N: integer
33
- Number of indexed elements.
34
-
35
- order: number
36
- Sort order. If `order < 0`, the function sorts `x` in decreasing order.
37
- If `order > 0`, the function sorts `x` in increasing order.
38
-
39
- x: Float64Array
40
- Input array.
41
-
42
- stride: integer
43
- Index increment for `x`.
44
-
45
- Returns
46
- -------
47
- x: Float64Array
48
- Input array `x`.
49
-
50
- Examples
51
- --------
52
- // Standard Usage:
53
- > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
54
- > {{alias}}( x.length, 1, x, 1 )
55
- <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
56
-
57
- // Using `N` and `stride` parameters:
58
- > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
59
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
60
- > {{alias}}( N, -1, x, 2 )
61
- <Float64Array>[ 3.0, -2.0, 1.0, -4.0 ]
62
-
63
- // Using view offsets:
64
- > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
65
- > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
66
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
67
- > {{alias}}( N, 1, x1, 2 )
68
- <Float64Array>[ -4.0, 3.0, -2.0 ]
69
- > x0
70
- <Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
71
-
72
- {{alias}}.ndarray( N, order, x, stride, offset )
73
- Sorts a double-precision floating-point strided array using heapsort and
74
- alternative indexing semantics.
75
-
76
- While typed array views mandate a view offset based on the underlying
77
- buffer, the `offset` parameter supports indexing semantics based on a
78
- starting index.
79
-
80
- Parameters
81
- ----------
82
- N: integer
83
- Number of indexed elements.
84
-
85
- order: number
86
- Sort order. If `order < 0`, the function sorts `x` in decreasing order.
87
- If `order > 0`, the function sorts `x` in increasing order.
88
-
89
- x: Float64Array
90
- Input array.
91
-
92
- stride: integer
93
- Index increment for `x`.
94
-
95
- offset: integer
96
- Starting index of `x`.
97
-
98
- Returns
99
- -------
100
- x: Float64Array
101
- Input array `x`.
102
-
103
- Examples
104
- --------
105
- // Standard Usage:
106
- > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
107
- > {{alias}}.ndarray( x.length, 1, x, 1, 0 )
108
- <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
109
-
110
- // Using an index offset:
111
- > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
112
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
113
- > {{alias}}.ndarray( N, 1, x, 2, 1 )
114
- <Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
115
-
116
- See Also
117
- --------
118
-
@@ -1,187 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2020 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import dsorthp = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a Float64Array...
25
- {
26
- const x = new Float64Array( 10 );
27
-
28
- dsorthp( x.length, 1, x, 1 ); // $ExpectType Float64Array
29
- }
30
-
31
- // The compiler throws an error if the function is provided a first argument which is not a number...
32
- {
33
- const x = new Float64Array( 10 );
34
-
35
- dsorthp( '10', 1, x, 1 ); // $ExpectError
36
- dsorthp( true, 1, x, 1 ); // $ExpectError
37
- dsorthp( false, 1, x, 1 ); // $ExpectError
38
- dsorthp( null, 1, x, 1 ); // $ExpectError
39
- dsorthp( undefined, 1, x, 1 ); // $ExpectError
40
- dsorthp( [], 1, x, 1 ); // $ExpectError
41
- dsorthp( {}, 1, x, 1 ); // $ExpectError
42
- dsorthp( ( x: number ): number => x, 1, x, 1 ); // $ExpectError
43
- }
44
-
45
- // The compiler throws an error if the function is provided a second argument which is not a number...
46
- {
47
- const x = new Float64Array( 10 );
48
-
49
- dsorthp( x.length, '10', x, 1 ); // $ExpectError
50
- dsorthp( x.length, true, x, 1 ); // $ExpectError
51
- dsorthp( x.length, false, x, 1 ); // $ExpectError
52
- dsorthp( x.length, null, x, 1 ); // $ExpectError
53
- dsorthp( x.length, undefined, x, 1 ); // $ExpectError
54
- dsorthp( x.length, [], x, 1 ); // $ExpectError
55
- dsorthp( x.length, {}, x, 1 ); // $ExpectError
56
- dsorthp( x.length, ( x: number ): number => x, x, 1 ); // $ExpectError
57
- }
58
-
59
- // The compiler throws an error if the function is provided a third argument which is not a Float64Array...
60
- {
61
- const x = new Float64Array( 10 );
62
-
63
- dsorthp( x.length, 1, 10, 1 ); // $ExpectError
64
- dsorthp( x.length, 1, '10', 1 ); // $ExpectError
65
- dsorthp( x.length, 1, true, 1 ); // $ExpectError
66
- dsorthp( x.length, 1, false, 1 ); // $ExpectError
67
- dsorthp( x.length, 1, null, 1 ); // $ExpectError
68
- dsorthp( x.length, 1, undefined, 1 ); // $ExpectError
69
- dsorthp( x.length, 1, [], 1 ); // $ExpectError
70
- dsorthp( x.length, 1, {}, 1 ); // $ExpectError
71
- dsorthp( x.length, 1, ( x: number ): number => x, 1 ); // $ExpectError
72
- }
73
-
74
- // The compiler throws an error if the function is provided a fourth argument which is not a number...
75
- {
76
- const x = new Float64Array( 10 );
77
-
78
- dsorthp( x.length, 1, x, '10' ); // $ExpectError
79
- dsorthp( x.length, 1, x, true ); // $ExpectError
80
- dsorthp( x.length, 1, x, false ); // $ExpectError
81
- dsorthp( x.length, 1, x, null ); // $ExpectError
82
- dsorthp( x.length, 1, x, undefined ); // $ExpectError
83
- dsorthp( x.length, 1, x, [] ); // $ExpectError
84
- dsorthp( x.length, 1, x, {} ); // $ExpectError
85
- dsorthp( x.length, 1, x, ( x: number ): number => x ); // $ExpectError
86
- }
87
-
88
- // The compiler throws an error if the function is provided an unsupported number of arguments...
89
- {
90
- const x = new Float64Array( 10 );
91
-
92
- dsorthp(); // $ExpectError
93
- dsorthp( x.length ); // $ExpectError
94
- dsorthp( x.length, 1 ); // $ExpectError
95
- dsorthp( x.length, 1, x ); // $ExpectError
96
- dsorthp( x.length, 1, x, 1, 10 ); // $ExpectError
97
- }
98
-
99
- // Attached to main export is an `ndarray` method which returns a Float64Array...
100
- {
101
- const x = new Float64Array( 10 );
102
-
103
- dsorthp.ndarray( x.length, 1, x, 1, 0 ); // $ExpectType Float64Array
104
- }
105
-
106
- // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
107
- {
108
- const x = new Float64Array( 10 );
109
-
110
- dsorthp.ndarray( '10', 1, x, 1, 0 ); // $ExpectError
111
- dsorthp.ndarray( true, 1, x, 1, 0 ); // $ExpectError
112
- dsorthp.ndarray( false, 1, x, 1, 0 ); // $ExpectError
113
- dsorthp.ndarray( null, 1, x, 1, 0 ); // $ExpectError
114
- dsorthp.ndarray( undefined, 1, x, 1, 0 ); // $ExpectError
115
- dsorthp.ndarray( [], 1, x, 1, 0 ); // $ExpectError
116
- dsorthp.ndarray( {}, 1, x, 1, 0 ); // $ExpectError
117
- dsorthp.ndarray( ( x: number ): number => x, 1, x, 1, 0 ); // $ExpectError
118
- }
119
-
120
- // The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
121
- {
122
- const x = new Float64Array( 10 );
123
-
124
- dsorthp.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError
125
- dsorthp.ndarray( x.length, true, x, 1, 0 ); // $ExpectError
126
- dsorthp.ndarray( x.length, false, x, 1, 0 ); // $ExpectError
127
- dsorthp.ndarray( x.length, null, x, 1, 0 ); // $ExpectError
128
- dsorthp.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError
129
- dsorthp.ndarray( x.length, [], x, 1, 0 ); // $ExpectError
130
- dsorthp.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError
131
- dsorthp.ndarray( x.length, ( x: number ): number => x, x, 1, 0 ); // $ExpectError
132
- }
133
-
134
- // The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float64Array...
135
- {
136
- const x = new Float64Array( 10 );
137
-
138
- dsorthp.ndarray( x.length, 1, 10, 1, 0 ); // $ExpectError
139
- dsorthp.ndarray( x.length, 1, '10', 1, 0 ); // $ExpectError
140
- dsorthp.ndarray( x.length, 1, true, 1, 0 ); // $ExpectError
141
- dsorthp.ndarray( x.length, 1, false, 1, 0 ); // $ExpectError
142
- dsorthp.ndarray( x.length, 1, null, 1, 0 ); // $ExpectError
143
- dsorthp.ndarray( x.length, 1, undefined, 1, 0 ); // $ExpectError
144
- dsorthp.ndarray( x.length, 1, [], 1, 0 ); // $ExpectError
145
- dsorthp.ndarray( x.length, 1, {}, 1, 0 ); // $ExpectError
146
- dsorthp.ndarray( x.length, 1, ( x: number ): number => x, 1, 0 ); // $ExpectError
147
- }
148
-
149
- // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
150
- {
151
- const x = new Float64Array( 10 );
152
-
153
- dsorthp.ndarray( x.length, 1, x, '10', 0 ); // $ExpectError
154
- dsorthp.ndarray( x.length, 1, x, true, 0 ); // $ExpectError
155
- dsorthp.ndarray( x.length, 1, x, false, 0 ); // $ExpectError
156
- dsorthp.ndarray( x.length, 1, x, null, 0 ); // $ExpectError
157
- dsorthp.ndarray( x.length, 1, x, undefined, 0 ); // $ExpectError
158
- dsorthp.ndarray( x.length, 1, x, [], 0 ); // $ExpectError
159
- dsorthp.ndarray( x.length, 1, x, {}, 0 ); // $ExpectError
160
- dsorthp.ndarray( x.length, 1, x, ( x: number ): number => x, 0 ); // $ExpectError
161
- }
162
-
163
- // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
164
- {
165
- const x = new Float64Array( 10 );
166
-
167
- dsorthp.ndarray( x.length, 1, x, 1, '10' ); // $ExpectError
168
- dsorthp.ndarray( x.length, 1, x, 1, true ); // $ExpectError
169
- dsorthp.ndarray( x.length, 1, x, 1, false ); // $ExpectError
170
- dsorthp.ndarray( x.length, 1, x, 1, null ); // $ExpectError
171
- dsorthp.ndarray( x.length, 1, x, 1, undefined ); // $ExpectError
172
- dsorthp.ndarray( x.length, 1, x, 1, [] ); // $ExpectError
173
- dsorthp.ndarray( x.length, 1, x, 1, {} ); // $ExpectError
174
- dsorthp.ndarray( x.length, 1, x, 1, ( x: number ): number => x ); // $ExpectError
175
- }
176
-
177
- // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
178
- {
179
- const x = new Float64Array( 10 );
180
-
181
- dsorthp.ndarray(); // $ExpectError
182
- dsorthp.ndarray( x.length ); // $ExpectError
183
- dsorthp.ndarray( x.length, 1 ); // $ExpectError
184
- dsorthp.ndarray( x.length, 1, x ); // $ExpectError
185
- dsorthp.ndarray( x.length, 1, x, 1 ); // $ExpectError
186
- dsorthp.ndarray( x.length, 1, x, 1, 0, 10 ); // $ExpectError
187
- }