@stdlib/blas-ext-base-dsort2hp 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 +1 -1
- package/README.md +21 -7
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +7 -7
- package/lib/index.js +2 -1
- package/package.json +22 -20
- package/docs/repl.txt +0 -151
- package/docs/types/test.ts +0 -280
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
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
|
# dsort2hp
|
|
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] -->
|
|
@@ -238,9 +249,9 @@ console.log( y );
|
|
|
238
249
|
|
|
239
250
|
## See Also
|
|
240
251
|
|
|
241
|
-
- <span class="package-name">[`@stdlib/blas
|
|
242
|
-
- <span class="package-name">[`@stdlib/blas
|
|
243
|
-
- <span class="package-name">[`@stdlib/blas
|
|
252
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/dsorthp`][@stdlib/blas/ext/base/dsorthp]</span><span class="delimiter">: </span><span class="description">sort a double-precision floating-point strided array using heapsort.</span>
|
|
253
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/gsort2hp`][@stdlib/blas/ext/base/gsort2hp]</span><span class="delimiter">: </span><span class="description">simultaneously sort two strided arrays based on the sort order of the first array using heapsort.</span>
|
|
254
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/ssort2hp`][@stdlib/blas/ext/base/ssort2hp]</span><span class="delimiter">: </span><span class="description">simultaneously sort two single-precision floating-point strided arrays based on the sort order of the first array using heapsort.</span>
|
|
244
255
|
|
|
245
256
|
</section>
|
|
246
257
|
|
|
@@ -272,7 +283,7 @@ See [LICENSE][stdlib-license].
|
|
|
272
283
|
|
|
273
284
|
## Copyright
|
|
274
285
|
|
|
275
|
-
Copyright © 2016-
|
|
286
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
276
287
|
|
|
277
288
|
</section>
|
|
278
289
|
|
|
@@ -285,8 +296,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
285
296
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsort2hp.svg
|
|
286
297
|
[npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsort2hp
|
|
287
298
|
|
|
288
|
-
[test-image]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
289
|
-
[test-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/actions/workflows/test.yml?query=branch:v0.0
|
|
299
|
+
[test-image]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
300
|
+
[test-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/actions/workflows/test.yml?query=branch:v0.2.0
|
|
290
301
|
|
|
291
302
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsort2hp/main.svg
|
|
292
303
|
[coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsort2hp?branch=main
|
|
@@ -299,7 +310,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
299
310
|
-->
|
|
300
311
|
|
|
301
312
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
302
|
-
[chat-url]: https://gitter.im
|
|
313
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
303
314
|
|
|
304
315
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
305
316
|
|
|
@@ -309,8 +320,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
309
320
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
310
321
|
|
|
311
322
|
[deno-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/tree/deno
|
|
323
|
+
[deno-readme]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/blob/deno/README.md
|
|
312
324
|
[umd-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/tree/umd
|
|
325
|
+
[umd-readme]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/blob/umd/README.md
|
|
313
326
|
[esm-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/tree/esm
|
|
327
|
+
[esm-readme]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/blob/esm/README.md
|
|
314
328
|
[branches-url]: https://github.com/stdlib-js/blas-ext-base-dsort2hp/blob/main/branches.md
|
|
315
329
|
|
|
316
330
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-ext-base-dsort2hp/main/LICENSE
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var R=function(h,j){return function(){return j||h((j={exports:{}}).exports,j),j.exports}};var g=R(function($,O){
|
|
2
|
+
var _=require('@stdlib/math-base-assert-is-positive-zero/dist'),E=require('@stdlib/math-base-assert-is-nan/dist'),I=require('@stdlib/math-base-special-floor/dist');function J(h,j,r,v,u,l){var e,q,c,i,a,k,o,w,m,b,p,n,P;if(h<=0||j===0)return r;for(j<0&&(v*=-1,l*=-1),v<0?e=(1-h)*v:e=0,l<0?q=(1-h)*l:q=0,p=h,c=I(h/2);;){if(c>0)c-=1,o=r[e+c*v],w=u[q+c*l];else{if(p-=1,p===0)return r;m=e+p*v,o=r[m],b=q+p*l,w=u[b],r[m]=r[e],u[b]=u[q]}for(n=c,i=n*2+1;i<p&&(P=i+1,P<p&&(a=r[e+P*v],k=r[e+i*v],(a>k||E(a)||a===k&&_(a))&&(i+=1)),a=r[e+i*v],a>o||E(a)||a===o&&_(a));)r[e+n*v]=a,u[q+n*l]=u[q+i*l],n=i,i=n*2+1;r[e+n*v]=o,u[q+n*l]=w}}O.exports=J
|
|
3
|
+
});var C=R(function(f,B){
|
|
4
|
+
var z=require('@stdlib/math-base-assert-is-positive-zero/dist'),A=require('@stdlib/math-base-assert-is-nan/dist'),K=require('@stdlib/math-base-special-floor/dist');function L(h,j,r,v,u,l,e,q){var c,i,a,k,o,w,m,b,p,n,P;if(h<=0||j===0)return r;for(j<0&&(v*=-1,e*=-1,u-=(h-1)*v,q-=(h-1)*e),p=h,c=K(h/2);;){if(c>0)c-=1,o=r[u+c*v],w=l[q+c*e];else{if(p-=1,p===0)return r;m=u+p*v,o=r[m],b=q+p*e,w=l[b],r[m]=r[u],l[b]=l[q]}for(n=c,i=n*2+1;i<p&&(P=i+1,P<p&&(a=r[u+P*v],k=r[u+i*v],(a>k||A(a)||a===k&&z(a))&&(i+=1)),a=r[u+i*v],a>o||A(a)||a===o&&z(a));)r[u+n*v]=a,l[q+n*e]=l[q+i*e],n=i,i=n*2+1;r[u+n*v]=o,l[q+n*e]=w}}B.exports=L
|
|
5
|
+
});var G=R(function(y,F){
|
|
6
|
+
var M=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),D=g(),Q=C();M(D,"ndarray",Q);F.exports=D
|
|
7
|
+
});var S=require("path").join,T=require('@stdlib/utils-try-require/dist'),U=require('@stdlib/assert-is-error/dist'),V=G(),Z,H=T(S(__dirname,"./native.js"));U(H)?Z=V:Z=H;module.exports=Z;
|
|
8
|
+
/** @license Apache-2.0 */
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/dsort2hp.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* Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first 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 - first input array\n* @param {integer} strideX - `x` index increment\n* @param {Float64Array} y - second input array\n* @param {integer} strideY - `y` index increment\n* @returns {Float64Array} `x`\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* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );\n*\n* dsort2hp( x.length, 1.0, x, 1, y, 1 );\n*\n* console.log( x );\n* // => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*\n* console.log( y );\n* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]\n*/\nfunction dsort2hp( N, order, x, strideX, y, strideY ) {\n\tvar offsetX;\n\tvar offsetY;\n\tvar parent;\n\tvar child;\n\tvar v1;\n\tvar v2;\n\tvar tx;\n\tvar ty;\n\tvar ix;\n\tvar iy;\n\tvar n;\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\tstrideX *= -1;\n\t\tstrideY *= -1;\n\t}\n\tif ( strideX < 0 ) {\n\t\toffsetX = (1-N) * strideX;\n\t} else {\n\t\toffsetX = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\toffsetY = (1-N) * strideY;\n\t} else {\n\t\toffsetY = 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\ttx = x[ offsetX+(parent*strideX) ];\n\t\t\tty = y[ offsetY+(parent*strideY) ];\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\tix = offsetX + (n*strideX);\n\t\t\ttx = x[ ix ];\n\t\t\tiy = offsetY + (n*strideY);\n\t\t\tty = y[ iy ];\n\n\t\t\t// Move the heap root to its sorted position:\n\t\t\tx[ ix ] = x[ offsetX ];\n\t\t\ty[ iy ] = y[ offsetY ];\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[ offsetX+(k*strideX) ];\n\t\t\t\tv2 = x[ offsetX+(child*strideX) ];\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[ offsetX+(child*strideX) ];\n\t\t\tif ( v1 > tx || isnan( v1 ) || ( v1 === tx && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t// Insert the larger child value:\n\t\t\t\tx[ offsetX+(j*strideX) ] = v1;\n\t\t\t\ty[ offsetY+(j*strideY) ] = y[ offsetY+(child*strideY) ];\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[ offsetX+(j*strideX) ] = tx;\n\t\ty[ offsetY+(j*strideY) ] = ty;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsort2hp;\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* Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first 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 - first input array\n* @param {integer} strideX - `x` index increment\n* @param {NonNegativeInteger} offsetX - `x` starting index\n* @param {Float64Array} y - second input array\n* @param {integer} strideY - `y` index increment\n* @param {NonNegativeInteger} offsetY - `y` starting index\n* @returns {Float64Array} `x`\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* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );\n*\n* dsort2hp( x.length, 1.0, x, 1, 0, y, 1, 0 );\n*\n* console.log( x );\n* // => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*\n* console.log( y );\n* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]\n*/\nfunction dsort2hp( N, order, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar parent;\n\tvar child;\n\tvar v1;\n\tvar v2;\n\tvar tx;\n\tvar ty;\n\tvar ix;\n\tvar iy;\n\tvar n;\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\tstrideX *= -1;\n\t\tstrideY *= -1;\n\t\toffsetX -= (N-1) * strideX;\n\t\toffsetY -= (N-1) * strideY;\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\ttx = x[ offsetX+(parent*strideX) ];\n\t\t\tty = y[ offsetY+(parent*strideY) ];\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\tix = offsetX + (n*strideX);\n\t\t\ttx = x[ ix ];\n\t\t\tiy = offsetY + (n*strideY);\n\t\t\tty = y[ iy ];\n\n\t\t\t// Move the heap root to its sorted position:\n\t\t\tx[ ix ] = x[ offsetX ];\n\t\t\ty[ iy ] = y[ offsetY ];\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[ offsetX+(k*strideX) ];\n\t\t\t\tv2 = x[ offsetX+(child*strideX) ];\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[ offsetX+(child*strideX) ];\n\t\t\tif ( v1 > tx || isnan( v1 ) || ( v1 === tx && isPositiveZero( v1 ) ) ) { // eslint-disable-line max-len\n\t\t\t\t// Insert the larger child value:\n\t\t\t\tx[ offsetX+(j*strideX) ] = v1;\n\t\t\t\ty[ offsetY+(j*strideY) ] = y[ offsetY+(child*strideY) ];\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[ offsetX+(j*strideX) ] = tx;\n\t\ty[ offsetY+(j*strideY) ] = ty;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsort2hp;\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 dsort2hp = require( './dsort2hp.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsort2hp, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsort2hp;\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* Simultaneously sort two double-precision floating-point strided arrays based on the sort order of the first array using heapsort.\n*\n* @module @stdlib/blas-ext-base-dsort2hp\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dsort2hp = require( '@stdlib/blas-ext-base-dsort2hp' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );\n*\n* dsort2hp( x.length, 1.0, x, 1, y, 1 );\n*\n* console.log( x );\n* // => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*\n* console.log( y );\n* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dsort2hp = require( '@stdlib/blas-ext-base-dsort2hp' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );\n*\n* dsort2hp( x.length, 1.0, x, 1, 0, y, 1, 0 );\n*\n* console.log( x );\n* // => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*\n* console.log( y );\n* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.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 dsort2hp;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsort2hp = main;\n} else {\n\tdsort2hp = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsort2hp;\n\n// exports: { \"ndarray\": \"dsort2hp.ndarray\" }\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_dsort2hp", "__commonJSMin", "exports", "module", "isPositiveZero", "isnan", "floor", "dsort2hp", "N", "order", "x", "strideX", "y", "strideY", "offsetX", "offsetY", "parent", "child", "v1", "v2", "tx", "ty", "ix", "iy", "n", "j", "k", "require_ndarray", "__commonJSMin", "exports", "module", "isPositiveZero", "isnan", "floor", "dsort2hp", "N", "order", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "parent", "child", "v1", "v2", "tx", "ty", "ix", "iy", "n", "j", "k", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsort2hp", "ndarray", "join", "tryRequire", "isError", "main", "dsort2hp", "tmp"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
// TypeScript Version:
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Interface describing `dsort2hp`.
|
|
@@ -34,7 +34,7 @@ interface Routine {
|
|
|
34
34
|
* @returns `x`
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
|
-
* var Float64Array = require(
|
|
37
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
38
38
|
*
|
|
39
39
|
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
40
40
|
* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
@@ -47,7 +47,7 @@ interface Routine {
|
|
|
47
47
|
* console.log( y );
|
|
48
48
|
* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
|
|
49
49
|
*/
|
|
50
|
-
( N: number, order: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number ): Float64Array;
|
|
50
|
+
( N: number, order: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number ): Float64Array;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Simultaneously sorts two double-precision floating-point strided arrays based on the sort order of the first array using heapsort and alternative indexing semantics.
|
|
@@ -63,7 +63,7 @@ interface Routine {
|
|
|
63
63
|
* @returns `x`
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
66
|
-
* var Float64Array = require(
|
|
66
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
67
67
|
*
|
|
68
68
|
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
69
69
|
* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
@@ -76,7 +76,7 @@ interface Routine {
|
|
|
76
76
|
* console.log( y );
|
|
77
77
|
* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
|
|
78
78
|
*/
|
|
79
|
-
ndarray( N: number, order: number, x: Float64Array, strideX: number, offsetX: number, y: Float64Array, strideY: number, offsetY: number ): Float64Array;
|
|
79
|
+
ndarray( N: number, order: number, x: Float64Array, strideX: number, offsetX: number, y: Float64Array, strideY: number, offsetY: number ): Float64Array;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -91,7 +91,7 @@ interface Routine {
|
|
|
91
91
|
* @returns `x`
|
|
92
92
|
*
|
|
93
93
|
* @example
|
|
94
|
-
* var Float64Array = require(
|
|
94
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
95
95
|
*
|
|
96
96
|
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
97
97
|
* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
@@ -105,7 +105,7 @@ interface Routine {
|
|
|
105
105
|
* // => <Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
|
-
* var Float64Array = require(
|
|
108
|
+
* var Float64Array = require( '@stdlib/array-float64' );
|
|
109
109
|
*
|
|
110
110
|
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
111
111
|
* var y = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
|
package/lib/index.js
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
|
|
59
59
|
var join = require( 'path' ).join;
|
|
60
60
|
var tryRequire = require( '@stdlib/utils-try-require' );
|
|
61
|
+
var isError = require( '@stdlib/assert-is-error' );
|
|
61
62
|
var main = require( './main.js' );
|
|
62
63
|
|
|
63
64
|
|
|
@@ -65,7 +66,7 @@ var main = require( './main.js' );
|
|
|
65
66
|
|
|
66
67
|
var dsort2hp;
|
|
67
68
|
var tmp = tryRequire( join( __dirname, './native.js' ) );
|
|
68
|
-
if ( tmp
|
|
69
|
+
if ( isError( tmp ) ) {
|
|
69
70
|
dsort2hp = main;
|
|
70
71
|
} else {
|
|
71
72
|
dsort2hp = tmp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-ext-base-dsort2hp",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Simultaneously sort two double-precision floating-point strided arrays based on the sort order of the first array using heapsort.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -41,28 +41,30 @@
|
|
|
41
41
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@stdlib/
|
|
45
|
-
"@stdlib/math-base-assert-is-
|
|
46
|
-
"@stdlib/math-base-
|
|
47
|
-
"@stdlib/
|
|
48
|
-
"@stdlib/utils-
|
|
49
|
-
"@stdlib/utils-
|
|
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"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@stdlib/array-float64": "^0.
|
|
53
|
-
"@stdlib/assert-is-browser": "^0.
|
|
54
|
-
"@stdlib/
|
|
55
|
-
"@stdlib/
|
|
56
|
-
"@stdlib/math-base-
|
|
57
|
-
"@stdlib/math-base-special-
|
|
58
|
-
"@stdlib/
|
|
59
|
-
"@stdlib/random-base-
|
|
60
|
-
"@stdlib/random-base-
|
|
61
|
-
"@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",
|
|
62
62
|
"proxyquire": "^2.0.0",
|
|
63
63
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
64
64
|
"istanbul": "^0.4.1",
|
|
65
|
-
"tap-
|
|
65
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
66
|
+
"@stdlib/bench-harness": "^0.2.0",
|
|
67
|
+
"@stdlib/bench": "^0.3.1"
|
|
66
68
|
},
|
|
67
69
|
"engines": {
|
|
68
70
|
"node": ">=0.10.0",
|
|
@@ -101,7 +103,7 @@
|
|
|
101
103
|
],
|
|
102
104
|
"__stdlib__": {},
|
|
103
105
|
"funding": {
|
|
104
|
-
"type": "
|
|
105
|
-
"url": "https://
|
|
106
|
+
"type": "opencollective",
|
|
107
|
+
"url": "https://opencollective.com/stdlib"
|
|
106
108
|
}
|
|
107
109
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( N, order, x, strideX, y, strideY )
|
|
3
|
-
Simultaneously sorts two double-precision floating-point strided arrays
|
|
4
|
-
based on the sort order of the first array using heapsort.
|
|
5
|
-
|
|
6
|
-
The `N` and `stride` parameters determine which elements in `x` and `y` are
|
|
7
|
-
accessed at runtime.
|
|
8
|
-
|
|
9
|
-
Indexing is relative to the first index. To introduce an offset, use typed
|
|
10
|
-
array views.
|
|
11
|
-
|
|
12
|
-
If `N <= 0` or `order == 0`, the function leaves `x` and `y` unchanged.
|
|
13
|
-
|
|
14
|
-
The algorithm distinguishes between `-0` and `+0`. When sorted in increasing
|
|
15
|
-
order, `-0` is sorted before `+0`. When sorted in decreasing order, `-0` is
|
|
16
|
-
sorted after `+0`.
|
|
17
|
-
|
|
18
|
-
The algorithm sorts `NaN` values to the end. When sorted in increasing
|
|
19
|
-
order, `NaN` values are sorted last. When sorted in decreasing order, `NaN`
|
|
20
|
-
values are sorted first.
|
|
21
|
-
|
|
22
|
-
The algorithm has space complexity O(1) and time complexity O(N log2 N).
|
|
23
|
-
|
|
24
|
-
The algorithm is *unstable*, meaning that the algorithm may change the order
|
|
25
|
-
of strided array elements which are equal or equivalent (e.g., `NaN`
|
|
26
|
-
values).
|
|
27
|
-
|
|
28
|
-
The input strided arrays are sorted *in-place* (i.e., the input strided
|
|
29
|
-
arrays are *mutated*).
|
|
30
|
-
|
|
31
|
-
Parameters
|
|
32
|
-
----------
|
|
33
|
-
N: integer
|
|
34
|
-
Number of indexed elements.
|
|
35
|
-
|
|
36
|
-
order: number
|
|
37
|
-
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
|
|
38
|
-
If `order > 0`, the function sorts `x` in increasing order.
|
|
39
|
-
|
|
40
|
-
x: Float64Array
|
|
41
|
-
First input array.
|
|
42
|
-
|
|
43
|
-
strideX: integer
|
|
44
|
-
Index increment for `x`.
|
|
45
|
-
|
|
46
|
-
y: Float64Array
|
|
47
|
-
Second input array.
|
|
48
|
-
|
|
49
|
-
strideY: integer
|
|
50
|
-
Index increment for `y`.
|
|
51
|
-
|
|
52
|
-
Returns
|
|
53
|
-
-------
|
|
54
|
-
x: Float64Array
|
|
55
|
-
Input array `x`.
|
|
56
|
-
|
|
57
|
-
Examples
|
|
58
|
-
--------
|
|
59
|
-
// Standard Usage:
|
|
60
|
-
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
61
|
-
> var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
62
|
-
> {{alias}}( x.length, 1, x, 1, y, 1 )
|
|
63
|
-
<Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
64
|
-
> y
|
|
65
|
-
<Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
|
|
66
|
-
|
|
67
|
-
// Using `N` and `stride` parameters:
|
|
68
|
-
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
69
|
-
> y = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
70
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
71
|
-
> {{alias}}( N, -1, x, 2, y, 2 )
|
|
72
|
-
<Float64Array>[ 3.0, -2.0, 1.0, -4.0 ]
|
|
73
|
-
> y
|
|
74
|
-
<Float64Array>[ 2.0, 1.0, 0.0, 3.0 ]
|
|
75
|
-
|
|
76
|
-
// Using view offsets:
|
|
77
|
-
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
78
|
-
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
|
79
|
-
> var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
80
|
-
> var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 );
|
|
81
|
-
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
|
|
82
|
-
> {{alias}}( N, 1, x1, 2, y1, 2 )
|
|
83
|
-
<Float64Array>[ -4.0, 3.0, -2.0 ]
|
|
84
|
-
> x0
|
|
85
|
-
<Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
|
|
86
|
-
> y0
|
|
87
|
-
<Float64Array>[ 0.0, 3.0, 2.0, 1.0 ]
|
|
88
|
-
|
|
89
|
-
{{alias}}.ndarray( N, order, x, strideX, offsetX, y, strideY, offsetY )
|
|
90
|
-
Simultaneously sorts two double-precision floating-point strided arrays
|
|
91
|
-
based on the sort order of the first array using heapsort and alternative
|
|
92
|
-
indexing semantics.
|
|
93
|
-
|
|
94
|
-
While typed array views mandate a view offset based on the underlying
|
|
95
|
-
buffer, the `offset` parameter supports indexing semantics based on a
|
|
96
|
-
starting index.
|
|
97
|
-
|
|
98
|
-
Parameters
|
|
99
|
-
----------
|
|
100
|
-
N: integer
|
|
101
|
-
Number of indexed elements.
|
|
102
|
-
|
|
103
|
-
order: number
|
|
104
|
-
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
|
|
105
|
-
If `order > 0`, the function sorts `x` in increasing order.
|
|
106
|
-
|
|
107
|
-
x: Float64Array
|
|
108
|
-
First input array.
|
|
109
|
-
|
|
110
|
-
strideX: integer
|
|
111
|
-
Index increment for `x`.
|
|
112
|
-
|
|
113
|
-
offsetX: integer
|
|
114
|
-
Starting index of `x`.
|
|
115
|
-
|
|
116
|
-
y: Float64Array
|
|
117
|
-
Second input array.
|
|
118
|
-
|
|
119
|
-
strideY: integer
|
|
120
|
-
Index increment for `y`.
|
|
121
|
-
|
|
122
|
-
offsetY: integer
|
|
123
|
-
Starting index of `y`.
|
|
124
|
-
|
|
125
|
-
Returns
|
|
126
|
-
-------
|
|
127
|
-
x: Float64Array
|
|
128
|
-
Input array `x`.
|
|
129
|
-
|
|
130
|
-
Examples
|
|
131
|
-
--------
|
|
132
|
-
// Standard Usage:
|
|
133
|
-
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
134
|
-
> var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
135
|
-
> {{alias}}.ndarray( x.length, 1, x, 1, 0, y, 1, 0 )
|
|
136
|
-
<Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
137
|
-
> y
|
|
138
|
-
<Float64Array>[ 3.0, 1.0, 0.0, 2.0 ]
|
|
139
|
-
|
|
140
|
-
// Using an index offset:
|
|
141
|
-
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
142
|
-
> y = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
|
|
143
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
144
|
-
> {{alias}}.ndarray( N, 1, x, 2, 1, y, 2, 1 )
|
|
145
|
-
<Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
|
|
146
|
-
> y
|
|
147
|
-
<Float64Array>[ 0.0, 3.0, 2.0, 1.0 ]
|
|
148
|
-
|
|
149
|
-
See Also
|
|
150
|
-
--------
|
|
151
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,280 +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 dsort2hp = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a Float64Array...
|
|
25
|
-
{
|
|
26
|
-
const x = new Float64Array( 10 );
|
|
27
|
-
const y = new Float64Array( 10 );
|
|
28
|
-
|
|
29
|
-
dsort2hp( x.length, 1, x, 1, y, 1 ); // $ExpectType Float64Array
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// The compiler throws an error if the function is provided a first argument which is not a number...
|
|
33
|
-
{
|
|
34
|
-
const x = new Float64Array( 10 );
|
|
35
|
-
const y = new Float64Array( 10 );
|
|
36
|
-
|
|
37
|
-
dsort2hp( '10', 1, x, 1, y, 1 ); // $ExpectError
|
|
38
|
-
dsort2hp( true, 1, x, 1, y, 1 ); // $ExpectError
|
|
39
|
-
dsort2hp( false, 1, x, 1, y, 1 ); // $ExpectError
|
|
40
|
-
dsort2hp( null, 1, x, 1, y, 1 ); // $ExpectError
|
|
41
|
-
dsort2hp( undefined, 1, x, 1, y, 1 ); // $ExpectError
|
|
42
|
-
dsort2hp( [], 1, x, 1, y, 1 ); // $ExpectError
|
|
43
|
-
dsort2hp( {}, 1, x, 1, y, 1 ); // $ExpectError
|
|
44
|
-
dsort2hp( ( x: number ): number => x, 1, x, 1, y, 1 ); // $ExpectError
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// The compiler throws an error if the function is provided a second argument which is not a number...
|
|
48
|
-
{
|
|
49
|
-
const x = new Float64Array( 10 );
|
|
50
|
-
const y = new Float64Array( 10 );
|
|
51
|
-
|
|
52
|
-
dsort2hp( x.length, '10', x, 1, y, 1 ); // $ExpectError
|
|
53
|
-
dsort2hp( x.length, true, x, 1, y, 1 ); // $ExpectError
|
|
54
|
-
dsort2hp( x.length, false, x, 1, y, 1 ); // $ExpectError
|
|
55
|
-
dsort2hp( x.length, null, x, 1, y, 1 ); // $ExpectError
|
|
56
|
-
dsort2hp( x.length, undefined, x, 1, y, 1 ); // $ExpectError
|
|
57
|
-
dsort2hp( x.length, [], x, 1, y, 1 ); // $ExpectError
|
|
58
|
-
dsort2hp( x.length, {}, x, 1, y, 1 ); // $ExpectError
|
|
59
|
-
dsort2hp( x.length, ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// The compiler throws an error if the function is provided a third argument which is not a Float64Array...
|
|
63
|
-
{
|
|
64
|
-
const x = new Float64Array( 10 );
|
|
65
|
-
const y = new Float64Array( 10 );
|
|
66
|
-
|
|
67
|
-
dsort2hp( x.length, 1, 10, 1, y, 1 ); // $ExpectError
|
|
68
|
-
dsort2hp( x.length, 1, '10', 1, y, 1 ); // $ExpectError
|
|
69
|
-
dsort2hp( x.length, 1, true, 1, y, 1 ); // $ExpectError
|
|
70
|
-
dsort2hp( x.length, 1, false, 1, y, 1 ); // $ExpectError
|
|
71
|
-
dsort2hp( x.length, 1, null, 1, y, 1 ); // $ExpectError
|
|
72
|
-
dsort2hp( x.length, 1, undefined, 1, y, 1 ); // $ExpectError
|
|
73
|
-
dsort2hp( x.length, 1, [], 1, y, 1 ); // $ExpectError
|
|
74
|
-
dsort2hp( x.length, 1, {}, 1, y, 1 ); // $ExpectError
|
|
75
|
-
dsort2hp( x.length, 1, ( x: number ): number => x, 1, y, 1 ); // $ExpectError
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// The compiler throws an error if the function is provided a fourth argument which is not a number...
|
|
79
|
-
{
|
|
80
|
-
const x = new Float64Array( 10 );
|
|
81
|
-
const y = new Float64Array( 10 );
|
|
82
|
-
|
|
83
|
-
dsort2hp( x.length, 1, x, '10', y, 1 ); // $ExpectError
|
|
84
|
-
dsort2hp( x.length, 1, x, true, y, 1 ); // $ExpectError
|
|
85
|
-
dsort2hp( x.length, 1, x, false, y, 1 ); // $ExpectError
|
|
86
|
-
dsort2hp( x.length, 1, x, null, y, 1 ); // $ExpectError
|
|
87
|
-
dsort2hp( x.length, 1, x, undefined, y, 1 ); // $ExpectError
|
|
88
|
-
dsort2hp( x.length, 1, x, [], y, 1 ); // $ExpectError
|
|
89
|
-
dsort2hp( x.length, 1, x, {}, y, 1 ); // $ExpectError
|
|
90
|
-
dsort2hp( x.length, 1, x, ( x: number ): number => x, y, 1 ); // $ExpectError
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array...
|
|
94
|
-
{
|
|
95
|
-
const x = new Float64Array( 10 );
|
|
96
|
-
|
|
97
|
-
dsort2hp( x.length, 1, x, 1, 10, 1 ); // $ExpectError
|
|
98
|
-
dsort2hp( x.length, 1, x, 1, '10', 1 ); // $ExpectError
|
|
99
|
-
dsort2hp( x.length, 1, x, 1, true, 1 ); // $ExpectError
|
|
100
|
-
dsort2hp( x.length, 1, x, 1, false, 1 ); // $ExpectError
|
|
101
|
-
dsort2hp( x.length, 1, x, 1, null, 1 ); // $ExpectError
|
|
102
|
-
dsort2hp( x.length, 1, x, 1, undefined, 1 ); // $ExpectError
|
|
103
|
-
dsort2hp( x.length, 1, x, 1, [], 1 ); // $ExpectError
|
|
104
|
-
dsort2hp( x.length, 1, x, 1, {}, 1 ); // $ExpectError
|
|
105
|
-
dsort2hp( x.length, 1, x, 1, ( x: number ): number => x, 1 ); // $ExpectError
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// The compiler throws an error if the function is provided a sixth argument which is not a number...
|
|
109
|
-
{
|
|
110
|
-
const x = new Float64Array( 10 );
|
|
111
|
-
const y = new Float64Array( 10 );
|
|
112
|
-
|
|
113
|
-
dsort2hp( x.length, 1, x, 1, y, '10' ); // $ExpectError
|
|
114
|
-
dsort2hp( x.length, 1, x, 1, y, true ); // $ExpectError
|
|
115
|
-
dsort2hp( x.length, 1, x, 1, y, false ); // $ExpectError
|
|
116
|
-
dsort2hp( x.length, 1, x, 1, y, null ); // $ExpectError
|
|
117
|
-
dsort2hp( x.length, 1, x, 1, y, undefined ); // $ExpectError
|
|
118
|
-
dsort2hp( x.length, 1, x, 1, y, [] ); // $ExpectError
|
|
119
|
-
dsort2hp( x.length, 1, x, 1, y, {} ); // $ExpectError
|
|
120
|
-
dsort2hp( x.length, 1, x, 1, y, ( x: number ): number => x ); // $ExpectError
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
124
|
-
{
|
|
125
|
-
const x = new Float64Array( 10 );
|
|
126
|
-
const y = new Float64Array( 10 );
|
|
127
|
-
|
|
128
|
-
dsort2hp(); // $ExpectError
|
|
129
|
-
dsort2hp( x.length ); // $ExpectError
|
|
130
|
-
dsort2hp( x.length, 1 ); // $ExpectError
|
|
131
|
-
dsort2hp( x.length, 1, x ); // $ExpectError
|
|
132
|
-
dsort2hp( x.length, 1, x, 1 ); // $ExpectError
|
|
133
|
-
dsort2hp( x.length, 1, x, 1, y ); // $ExpectError
|
|
134
|
-
dsort2hp( x.length, 1, x, 1, y, 1, 10 ); // $ExpectError
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Attached to main export is an `ndarray` method which returns a Float64Array...
|
|
138
|
-
{
|
|
139
|
-
const x = new Float64Array( 10 );
|
|
140
|
-
const y = new Float64Array( 10 );
|
|
141
|
-
|
|
142
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, 0 ); // $ExpectType Float64Array
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
|
|
146
|
-
{
|
|
147
|
-
const x = new Float64Array( 10 );
|
|
148
|
-
const y = new Float64Array( 10 );
|
|
149
|
-
|
|
150
|
-
dsort2hp.ndarray( '10', 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
151
|
-
dsort2hp.ndarray( true, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
152
|
-
dsort2hp.ndarray( false, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
153
|
-
dsort2hp.ndarray( null, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
154
|
-
dsort2hp.ndarray( undefined, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
155
|
-
dsort2hp.ndarray( [], 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
156
|
-
dsort2hp.ndarray( {}, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
157
|
-
dsort2hp.ndarray( ( x: number ): number => x, 1, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
|
|
161
|
-
{
|
|
162
|
-
const x = new Float64Array( 10 );
|
|
163
|
-
const y = new Float64Array( 10 );
|
|
164
|
-
|
|
165
|
-
dsort2hp.ndarray( x.length, '10', x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
166
|
-
dsort2hp.ndarray( x.length, true, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
167
|
-
dsort2hp.ndarray( x.length, false, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
168
|
-
dsort2hp.ndarray( x.length, null, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
169
|
-
dsort2hp.ndarray( x.length, undefined, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
170
|
-
dsort2hp.ndarray( x.length, [], x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
171
|
-
dsort2hp.ndarray( x.length, {}, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
172
|
-
dsort2hp.ndarray( x.length, ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float64Array...
|
|
176
|
-
{
|
|
177
|
-
const x = new Float64Array( 10 );
|
|
178
|
-
const y = new Float64Array( 10 );
|
|
179
|
-
|
|
180
|
-
dsort2hp.ndarray( x.length, 1, 10, 1, 0, y, 1, 0 ); // $ExpectError
|
|
181
|
-
dsort2hp.ndarray( x.length, 1, '10', 1, 0, y, 1, 0 ); // $ExpectError
|
|
182
|
-
dsort2hp.ndarray( x.length, 1, true, 1, 0, y, 1, 0 ); // $ExpectError
|
|
183
|
-
dsort2hp.ndarray( x.length, 1, false, 1, 0, y, 1, 0 ); // $ExpectError
|
|
184
|
-
dsort2hp.ndarray( x.length, 1, null, 1, 0, y, 1, 0 ); // $ExpectError
|
|
185
|
-
dsort2hp.ndarray( x.length, 1, undefined, 1, 0, y, 1, 0 ); // $ExpectError
|
|
186
|
-
dsort2hp.ndarray( x.length, 1, [], 1, 0, y, 1, 0 ); // $ExpectError
|
|
187
|
-
dsort2hp.ndarray( x.length, 1, {}, 1, 0, y, 1, 0 ); // $ExpectError
|
|
188
|
-
dsort2hp.ndarray( x.length, 1, ( x: number ): number => x, 1, 0, y, 1, 0 ); // $ExpectError
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
|
|
192
|
-
{
|
|
193
|
-
const x = new Float64Array( 10 );
|
|
194
|
-
const y = new Float64Array( 10 );
|
|
195
|
-
|
|
196
|
-
dsort2hp.ndarray( x.length, 1, x, '10', 0, y, 1, 0 ); // $ExpectError
|
|
197
|
-
dsort2hp.ndarray( x.length, 1, x, true, 0, y, 1, 0 ); // $ExpectError
|
|
198
|
-
dsort2hp.ndarray( x.length, 1, x, false, 0, y, 1, 0 ); // $ExpectError
|
|
199
|
-
dsort2hp.ndarray( x.length, 1, x, null, 0, y, 1, 0 ); // $ExpectError
|
|
200
|
-
dsort2hp.ndarray( x.length, 1, x, undefined, 0, y, 1, 0 ); // $ExpectError
|
|
201
|
-
dsort2hp.ndarray( x.length, 1, x, [], 0, y, 1, 0 ); // $ExpectError
|
|
202
|
-
dsort2hp.ndarray( x.length, 1, x, {}, 0, y, 1, 0 ); // $ExpectError
|
|
203
|
-
dsort2hp.ndarray( x.length, 1, x, ( x: number ): number => x, 0, y, 1, 0 ); // $ExpectError
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
|
|
207
|
-
{
|
|
208
|
-
const x = new Float64Array( 10 );
|
|
209
|
-
const y = new Float64Array( 10 );
|
|
210
|
-
|
|
211
|
-
dsort2hp.ndarray( x.length, 1, x, 1, '10', y, 1, 0 ); // $ExpectError
|
|
212
|
-
dsort2hp.ndarray( x.length, 1, x, 1, true, y, 1, 0 ); // $ExpectError
|
|
213
|
-
dsort2hp.ndarray( x.length, 1, x, 1, false, y, 1, 0 ); // $ExpectError
|
|
214
|
-
dsort2hp.ndarray( x.length, 1, x, 1, null, y, 1, 0 ); // $ExpectError
|
|
215
|
-
dsort2hp.ndarray( x.length, 1, x, 1, undefined, y, 1, 0 ); // $ExpectError
|
|
216
|
-
dsort2hp.ndarray( x.length, 1, x, 1, [], y, 1, 0 ); // $ExpectError
|
|
217
|
-
dsort2hp.ndarray( x.length, 1, x, 1, {}, y, 1, 0 ); // $ExpectError
|
|
218
|
-
dsort2hp.ndarray( x.length, 1, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Float64Array...
|
|
222
|
-
{
|
|
223
|
-
const x = new Float64Array( 10 );
|
|
224
|
-
|
|
225
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, 10, 1, 0 ); // $ExpectError
|
|
226
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, '10', 1, 0 ); // $ExpectError
|
|
227
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, true, 1, 0 ); // $ExpectError
|
|
228
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, false, 1, 0 ); // $ExpectError
|
|
229
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, null, 1, 0 ); // $ExpectError
|
|
230
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, undefined, 1, 0 ); // $ExpectError
|
|
231
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, [], 1, 0 ); // $ExpectError
|
|
232
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, {}, 1, 0 ); // $ExpectError
|
|
233
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
|
|
237
|
-
{
|
|
238
|
-
const x = new Float64Array( 10 );
|
|
239
|
-
const y = new Float64Array( 10 );
|
|
240
|
-
|
|
241
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, '10', 0 ); // $ExpectError
|
|
242
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, true, 0 ); // $ExpectError
|
|
243
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, false, 0 ); // $ExpectError
|
|
244
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, null, 0 ); // $ExpectError
|
|
245
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, undefined, 0 ); // $ExpectError
|
|
246
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, [], 0 ); // $ExpectError
|
|
247
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, {}, 0 ); // $ExpectError
|
|
248
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number...
|
|
252
|
-
{
|
|
253
|
-
const x = new Float64Array( 10 );
|
|
254
|
-
const y = new Float64Array( 10 );
|
|
255
|
-
|
|
256
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, '10' ); // $ExpectError
|
|
257
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, true ); // $ExpectError
|
|
258
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, false ); // $ExpectError
|
|
259
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, null ); // $ExpectError
|
|
260
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, undefined ); // $ExpectError
|
|
261
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, [] ); // $ExpectError
|
|
262
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, {} ); // $ExpectError
|
|
263
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
|
|
267
|
-
{
|
|
268
|
-
const x = new Float64Array( 10 );
|
|
269
|
-
const y = new Float64Array( 10 );
|
|
270
|
-
|
|
271
|
-
dsort2hp.ndarray(); // $ExpectError
|
|
272
|
-
dsort2hp.ndarray( x.length ); // $ExpectError
|
|
273
|
-
dsort2hp.ndarray( x.length, 1 ); // $ExpectError
|
|
274
|
-
dsort2hp.ndarray( x.length, 1, x ); // $ExpectError
|
|
275
|
-
dsort2hp.ndarray( x.length, 1, x, 1 ); // $ExpectError
|
|
276
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0 ); // $ExpectError
|
|
277
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y ); // $ExpectError
|
|
278
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1 ); // $ExpectError
|
|
279
|
-
dsort2hp.ndarray( x.length, 1, x, 1, 0, y, 1, 0, 10 ); // $ExpectError
|
|
280
|
-
}
|