@stdlib/blas-ext-base-dsortins 0.0.9 → 0.1.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/CITATION.cff +30 -0
- package/NOTICE +1 -1
- package/README.md +18 -7
- 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 +1 -1
- package/lib/index.js +2 -1
- package/package.json +22 -21
- package/docs/repl.txt +0 -123
- package/docs/types/test.ts +0 -187
package/CITATION.cff
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: stdlib
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
|
|
7
|
+
type: software
|
|
8
|
+
|
|
9
|
+
authors:
|
|
10
|
+
- name: The Stdlib Authors
|
|
11
|
+
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
+
|
|
13
|
+
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
+
url: https://stdlib.io
|
|
15
|
+
|
|
16
|
+
abstract: |
|
|
17
|
+
Standard library for JavaScript and Node.js.
|
|
18
|
+
|
|
19
|
+
keywords:
|
|
20
|
+
- JavaScript
|
|
21
|
+
- Node.js
|
|
22
|
+
- TypeScript
|
|
23
|
+
- standard library
|
|
24
|
+
- scientific computing
|
|
25
|
+
- numerical computing
|
|
26
|
+
- statistical computing
|
|
27
|
+
|
|
28
|
+
license: Apache-2.0 AND BSL-1.0
|
|
29
|
+
|
|
30
|
+
date-released: 2016
|
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2023 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
|
# dsortins
|
|
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] -->
|
|
@@ -187,9 +198,9 @@ console.log( x );
|
|
|
187
198
|
|
|
188
199
|
## See Also
|
|
189
200
|
|
|
190
|
-
- <span class="package-name">[`@stdlib/blas
|
|
191
|
-
- <span class="package-name">[`@stdlib/blas
|
|
192
|
-
- <span class="package-name">[`@stdlib/blas
|
|
201
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/dsort2ins`][@stdlib/blas/ext/base/dsort2ins]</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 insertion sort.</span>
|
|
202
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/gsortins`][@stdlib/blas/ext/base/gsortins]</span><span class="delimiter">: </span><span class="description">sort a strided array using insertion sort.</span>
|
|
203
|
+
- <span class="package-name">[`@stdlib/blas-ext/base/ssortins`][@stdlib/blas/ext/base/ssortins]</span><span class="delimiter">: </span><span class="description">sort a single-precision floating-point strided array using insertion sort.</span>
|
|
193
204
|
|
|
194
205
|
</section>
|
|
195
206
|
|
|
@@ -221,7 +232,7 @@ See [LICENSE][stdlib-license].
|
|
|
221
232
|
|
|
222
233
|
## Copyright
|
|
223
234
|
|
|
224
|
-
Copyright © 2016-
|
|
235
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
225
236
|
|
|
226
237
|
</section>
|
|
227
238
|
|
|
@@ -234,8 +245,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
234
245
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas-ext-base-dsortins.svg
|
|
235
246
|
[npm-url]: https://npmjs.org/package/@stdlib/blas-ext-base-dsortins
|
|
236
247
|
|
|
237
|
-
[test-image]: https://github.com/stdlib-js/blas-ext-base-dsortins/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
238
|
-
[test-url]: https://github.com/stdlib-js/blas-ext-base-dsortins/actions/workflows/test.yml?query=branch:v0.0
|
|
248
|
+
[test-image]: https://github.com/stdlib-js/blas-ext-base-dsortins/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
249
|
+
[test-url]: https://github.com/stdlib-js/blas-ext-base-dsortins/actions/workflows/test.yml?query=branch:v0.1.0
|
|
239
250
|
|
|
240
251
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-ext-base-dsortins/main.svg
|
|
241
252
|
[coverage-url]: https://codecov.io/github/stdlib-js/blas-ext-base-dsortins?branch=main
|
|
@@ -248,7 +259,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
248
259
|
-->
|
|
249
260
|
|
|
250
261
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
251
|
-
[chat-url]: https://gitter.im
|
|
262
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
252
263
|
|
|
253
264
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
254
265
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var p=function(l,q){return function(){return q||l((q={exports:{}}).exports,q),q.exports}};var y=p(function(K,k){
|
|
2
|
+
var c=require('@stdlib/math-base-assert-is-negative-zero/dist'),g=require('@stdlib/math-base-assert-is-nan/dist');function A(l,q,a,r){var h,i,e,v,o,n,f,u;if(l<=0||q===0)return a;if(q<0&&(r*=-1),r<0){for(v=(1-l)*r,o=0,i=v+r,u=1;u<l;u++)if(n=a[i],g(n)){for(e=i;e>o;)a[e]=a[e+r],e+=r;a[o]=n}else{for(h=c(n),e=i-r;e<=v&&(f=a[e],!(f<=n&&!(h&&f===n&&c(f)===!1)));)a[e+r]=f,e-=r;a[e+r]=n,i+=r}return a}for(v=0,o=(l-1)*r,i=v+r,u=1;u<l;u++)if(n=a[i],g(n)){for(e=i;e<o;)a[e]=a[e+r],e+=r;a[o]=n}else{for(h=c(n),e=i-r;e>=v&&(f=a[e],!(f<=n&&!(h&&f===n&&c(f)===!1)));)a[e+r]=f,e-=r;a[e+r]=n,i+=r}return a}k.exports=A
|
|
3
|
+
});var Z=p(function(L,R){
|
|
4
|
+
var j=require('@stdlib/math-base-assert-is-negative-zero/dist'),m=require('@stdlib/math-base-assert-is-nan/dist');function B(l,q,a,r,h){var i,e,v,o,n,f,u,w;if(l<=0||q===0)return a;if(q<0&&(r*=-1,h-=(l-1)*r),o=h,n=o+(l-1)*r,e=o+r,r<0){for(w=1;w<l;w++)if(f=a[e],m(f)){for(v=e;v>n;)a[v]=a[v+r],v+=r;a[n]=f}else{for(i=j(f),v=e-r;v<=o&&(u=a[v],!(u<=f&&!(i&&u===f&&j(u)===!1)));)a[v+r]=u,v-=r;a[v+r]=f,e+=r}return a}for(w=1;w<l;w++)if(f=a[e],m(f)){for(v=e;v<n;)a[v]=a[v+r],v+=r;a[n]=f}else{for(i=j(f),v=e-r;v>=o&&(u=a[v],!(u<=f&&!(i&&u===f&&j(u)===!1)));)a[v+r]=u,v-=r;a[v+r]=f,e+=r}return a}R.exports=B
|
|
5
|
+
});var O=p(function(M,E){
|
|
6
|
+
var C=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),_=y(),D=Z();C(_,"ndarray",D);E.exports=_
|
|
7
|
+
});var F=require("path").join,G=require('@stdlib/utils-try-require/dist'),H=require('@stdlib/assert-is-error/dist'),I=O(),b,z=G(F(__dirname,"./native.js"));H(z)?b=I:b=z;module.exports=b;
|
|
8
|
+
/** @license Apache-2.0 */
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/dsortins.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 isNegativeZero = require( '@stdlib/math-base-assert-is-negative-zero' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Sorts a double-precision floating-point strided array using insertion sort.\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* dsortins( x.length, 1.0, x, 1 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*/\nfunction dsortins( N, order, x, stride ) {\n\tvar flg;\n\tvar ix;\n\tvar jx;\n\tvar fx;\n\tvar lx;\n\tvar v;\n\tvar u;\n\tvar i;\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\t// Traverse the strided array from right-to-left...\n\t\tfx = (1-N) * stride; // first index\n\t\tlx = 0; // last index\n\t\tix = fx + stride;\n\n\t\t// Sort in increasing order...\n\t\tfor ( i = 1; i < N; i++ ) {\n\t\t\tv = x[ ix ];\n\n\t\t\t// Sort `NaN` values to the end (i.e., the left)...\n\t\t\tif ( isnan( v ) ) {\n\t\t\t\tjx = ix;\n\n\t\t\t\t// Shift all values (including NaNs) to the left of the current element to the right...\n\t\t\t\twhile ( jx > lx ) {\n\t\t\t\t\tx[ jx ] = x[ jx+stride ];\n\t\t\t\t\tjx += stride;\n\t\t\t\t}\n\t\t\t\tx[ lx ] = v;\n\t\t\t} else {\n\t\t\t\tflg = isNegativeZero( v );\n\t\t\t\tjx = ix - stride;\n\n\t\t\t\t// Shift all larger values to the right of the current element to the left...\n\t\t\t\twhile ( jx <= fx ) {\n\t\t\t\t\tu = x[ jx ];\n\t\t\t\t\tif ( u <= v && !(flg && u === v && isNegativeZero( u ) === false) ) { // eslint-disable-line max-len\n\t\t\t\t\t\t// Note: positive zeros (and NaNs (e.g., when last element is NaN)) are sorted to the left\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tx[ jx+stride ] = u;\n\t\t\t\t\tjx -= stride;\n\t\t\t\t}\n\t\t\t\tx[ jx+stride ] = v;\n\t\t\t\tix += stride;\n\t\t\t}\n\t\t}\n\t\treturn x;\n\t}\n\t// Traverse the strided array from left-to-right...\n\tfx = 0; // first index\n\tlx = (N-1) * stride; // last index\n\tix = fx + stride;\n\n\t// Sort in increasing order...\n\tfor ( i = 1; i < N; i++ ) {\n\t\tv = x[ ix ];\n\n\t\t// Sort `NaN` values to the end...\n\t\tif ( isnan( v ) ) {\n\t\t\tjx = ix;\n\n\t\t\t// Shift all values (including NaNs) to the right of the current element to the left...\n\t\t\twhile ( jx < lx ) {\n\t\t\t\tx[ jx ] = x[ jx+stride ];\n\t\t\t\tjx += stride;\n\t\t\t}\n\t\t\tx[ lx ] = v;\n\t\t} else {\n\t\t\tflg = isNegativeZero( v );\n\t\t\tjx = ix - stride;\n\n\t\t\t// Shift all larger values to the left of the current element to the right...\n\t\t\twhile ( jx >= fx ) {\n\t\t\t\tu = x[ jx ];\n\t\t\t\tif ( u <= v && !(flg && u === v && isNegativeZero( u ) === false) ) { // eslint-disable-line max-len\n\t\t\t\t\t// Note: positive zeros (and NaNs (e.g., when first element is NaN)) are sorted to the right\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tx[ jx+stride ] = u;\n\t\t\t\tjx -= stride;\n\t\t\t}\n\t\t\tx[ jx+stride ] = v;\n\t\t\tix += stride;\n\t\t}\n\t}\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsortins;\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 isNegativeZero = require( '@stdlib/math-base-assert-is-negative-zero' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Sorts a double-precision floating-point strided array using insertion sort.\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* dsortins( x.length, 1.0, x, 1, 0 );\n* // x => <Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]\n*/\nfunction dsortins( N, order, x, stride, offset ) {\n\tvar flg;\n\tvar ix;\n\tvar jx;\n\tvar fx;\n\tvar lx;\n\tvar v;\n\tvar u;\n\tvar i;\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\tfx = offset; // first index\n\tlx = fx + ((N-1)*stride); // last index\n\tix = fx + stride;\n\n\tif ( stride < 0 ) {\n\t\t// Traverse the strided array from right-to-left...\n\n\t\t// Sort in increasing order...\n\t\tfor ( i = 1; i < N; i++ ) {\n\t\t\tv = x[ ix ];\n\n\t\t\t// Sort `NaN` values to the end (i.e., the left)...\n\t\t\tif ( isnan( v ) ) {\n\t\t\t\tjx = ix;\n\n\t\t\t\t// Shift all values (including NaNs) to the left of the current element to the right...\n\t\t\t\twhile ( jx > lx ) {\n\t\t\t\t\tx[ jx ] = x[ jx+stride ];\n\t\t\t\t\tjx += stride;\n\t\t\t\t}\n\t\t\t\tx[ lx ] = v;\n\t\t\t} else {\n\t\t\t\tflg = isNegativeZero( v );\n\t\t\t\tjx = ix - stride;\n\n\t\t\t\t// Shift all larger values to the right of the current element to the left...\n\t\t\t\twhile ( jx <= fx ) {\n\t\t\t\t\tu = x[ jx ];\n\t\t\t\t\tif ( u <= v && !(flg && u === v && isNegativeZero( u ) === false) ) { // eslint-disable-line max-len\n\t\t\t\t\t\t// Note: positive zeros (and NaNs (e.g., when last element is NaN)) are sorted to the left\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tx[ jx+stride ] = u;\n\t\t\t\t\tjx -= stride;\n\t\t\t\t}\n\t\t\t\tx[ jx+stride ] = v;\n\t\t\t\tix += stride;\n\t\t\t}\n\t\t}\n\t\treturn x;\n\t}\n\t// Traverse the strided array from left-to-right...\n\n\t// Sort in increasing order...\n\tfor ( i = 1; i < N; i++ ) {\n\t\tv = x[ ix ];\n\n\t\t// Sort `NaN` values to the end...\n\t\tif ( isnan( v ) ) {\n\t\t\tjx = ix;\n\n\t\t\t// Shift all values (including NaNs) to the right of the current element to the left...\n\t\t\twhile ( jx < lx ) {\n\t\t\t\tx[ jx ] = x[ jx+stride ];\n\t\t\t\tjx += stride;\n\t\t\t}\n\t\t\tx[ lx ] = v;\n\t\t} else {\n\t\t\tflg = isNegativeZero( v );\n\t\t\tjx = ix - stride;\n\n\t\t\t// Shift all larger values to the left of the current element to the right...\n\t\t\twhile ( jx >= fx ) {\n\t\t\t\tu = x[ jx ];\n\t\t\t\tif ( u <= v && !(flg && u === v && isNegativeZero( u ) === false) ) { // eslint-disable-line max-len\n\t\t\t\t\t// Note: positive zeros (and NaNs (e.g., when first element is NaN)) are sorted to the right\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tx[ jx+stride ] = u;\n\t\t\t\tjx -= stride;\n\t\t\t}\n\t\t\tx[ jx+stride ] = v;\n\t\t\tix += stride;\n\t\t}\n\t}\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsortins;\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 dsortins = require( './dsortins.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dsortins, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dsortins;\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 insertion sort.\n*\n* @module @stdlib/blas-ext-base-dsortins\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dsortins = require( '@stdlib/blas-ext-base-dsortins' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsortins( 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 dsortins = require( '@stdlib/blas-ext-base-dsortins' );\n*\n* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );\n*\n* dsortins.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 dsortins;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdsortins = main;\n} else {\n\tdsortins = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dsortins;\n\n// exports: { \"ndarray\": \"dsortins.ndarray\" }\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_dsortins", "__commonJSMin", "exports", "module", "isNegativeZero", "isnan", "dsortins", "N", "order", "x", "stride", "flg", "ix", "jx", "fx", "lx", "v", "u", "i", "require_ndarray", "__commonJSMin", "exports", "module", "isNegativeZero", "isnan", "dsortins", "N", "order", "x", "stride", "offset", "flg", "ix", "jx", "fx", "lx", "v", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dsortins", "ndarray", "join", "tryRequire", "isError", "main", "dsortins", "tmp"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
var join = require( 'path' ).join;
|
|
48
48
|
var tryRequire = require( '@stdlib/utils-try-require' );
|
|
49
|
+
var isError = require( '@stdlib/assert-is-error' );
|
|
49
50
|
var main = require( './main.js' );
|
|
50
51
|
|
|
51
52
|
|
|
@@ -53,7 +54,7 @@ var main = require( './main.js' );
|
|
|
53
54
|
|
|
54
55
|
var dsortins;
|
|
55
56
|
var tmp = tryRequire( join( __dirname, './native.js' ) );
|
|
56
|
-
if ( tmp
|
|
57
|
+
if ( isError( tmp ) ) {
|
|
57
58
|
dsortins = main;
|
|
58
59
|
} else {
|
|
59
60
|
dsortins = tmp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-ext-base-dsortins",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Sort a double-precision floating-point strided array using insertion sort.",
|
|
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/
|
|
45
|
-
"@stdlib/math-base-assert-is-
|
|
46
|
-
"@stdlib/
|
|
47
|
-
"@stdlib/utils-
|
|
48
|
-
"@stdlib/utils-
|
|
44
|
+
"@stdlib/assert-is-error": "^0.1.0",
|
|
45
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.0",
|
|
46
|
+
"@stdlib/math-base-assert-is-negative-zero": "^0.1.0",
|
|
47
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0",
|
|
48
|
+
"@stdlib/utils-library-manifest": "^0.1.0",
|
|
49
|
+
"@stdlib/utils-try-require": "^0.1.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@stdlib/array-float64": "^0.0.
|
|
52
|
-
"@stdlib/assert-is-browser": "^0.0
|
|
53
|
-
"@stdlib/bench": "^0.0
|
|
54
|
-
"@stdlib/blas-base-dcopy": "^0.0.
|
|
55
|
-
"@stdlib/math-base-assert-is-positive-zero": "^0.0
|
|
56
|
-
"@stdlib/math-base-special-floor": "^0.0.
|
|
57
|
-
"@stdlib/math-base-special-pow": "^0.0.
|
|
58
|
-
"@stdlib/math-base-special-round": "^0.0
|
|
59
|
-
"@stdlib/math-base-special-sqrt": "^0.0.
|
|
60
|
-
"@stdlib/random-base-discrete-uniform": "^0.0.
|
|
61
|
-
"@stdlib/random-base-randu": "^0.0.
|
|
62
|
-
"@stdlib/random-base-uniform": "^0.0.
|
|
52
|
+
"@stdlib/array-float64": "^0.0.6",
|
|
53
|
+
"@stdlib/assert-is-browser": "^0.1.0",
|
|
54
|
+
"@stdlib/bench": "^0.1.0",
|
|
55
|
+
"@stdlib/blas-base-dcopy": "^0.0.10",
|
|
56
|
+
"@stdlib/math-base-assert-is-positive-zero": "^0.1.0",
|
|
57
|
+
"@stdlib/math-base-special-floor": "^0.0.8",
|
|
58
|
+
"@stdlib/math-base-special-pow": "^0.0.7",
|
|
59
|
+
"@stdlib/math-base-special-round": "^0.1.0",
|
|
60
|
+
"@stdlib/math-base-special-sqrt": "^0.0.8",
|
|
61
|
+
"@stdlib/random-base-discrete-uniform": "^0.0.6",
|
|
62
|
+
"@stdlib/random-base-randu": "^0.0.8",
|
|
63
|
+
"@stdlib/random-base-uniform": "^0.0.6",
|
|
63
64
|
"proxyquire": "^2.0.0",
|
|
64
65
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
65
66
|
"istanbul": "^0.4.1",
|
|
66
|
-
"tap-
|
|
67
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
67
68
|
},
|
|
68
69
|
"engines": {
|
|
69
70
|
"node": ">=0.10.0",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
],
|
|
102
103
|
"__stdlib__": {},
|
|
103
104
|
"funding": {
|
|
104
|
-
"type": "
|
|
105
|
-
"url": "https://
|
|
105
|
+
"type": "opencollective",
|
|
106
|
+
"url": "https://opencollective.com/stdlib"
|
|
106
107
|
}
|
|
107
108
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( N, order, x, stride )
|
|
3
|
-
Sorts a double-precision floating-point strided array using insertion sort.
|
|
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 worst case time complexity
|
|
22
|
-
O(N^2).
|
|
23
|
-
|
|
24
|
-
The algorithm is efficient for *small* strided arrays (typically N <= 20)
|
|
25
|
-
and is particularly efficient for sorting strided arrays which are already
|
|
26
|
-
substantially sorted.
|
|
27
|
-
|
|
28
|
-
The algorithm is *stable*, meaning that the algorithm does *not* change the
|
|
29
|
-
order of strided array elements which are equal or equivalent (e.g., `NaN`
|
|
30
|
-
values).
|
|
31
|
-
|
|
32
|
-
The input strided array is sorted *in-place* (i.e., the input strided array
|
|
33
|
-
is *mutated*).
|
|
34
|
-
|
|
35
|
-
Parameters
|
|
36
|
-
----------
|
|
37
|
-
N: integer
|
|
38
|
-
Number of indexed elements.
|
|
39
|
-
|
|
40
|
-
order: number
|
|
41
|
-
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
|
|
42
|
-
If `order > 0`, the function sorts `x` in increasing order.
|
|
43
|
-
|
|
44
|
-
x: Float64Array
|
|
45
|
-
Input array.
|
|
46
|
-
|
|
47
|
-
stride: integer
|
|
48
|
-
Index increment for `x`.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
x: Float64Array
|
|
53
|
-
Input array `x`.
|
|
54
|
-
|
|
55
|
-
Examples
|
|
56
|
-
--------
|
|
57
|
-
// Standard Usage:
|
|
58
|
-
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
59
|
-
> {{alias}}( x.length, 1, x, 1 )
|
|
60
|
-
<Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
61
|
-
|
|
62
|
-
// Using `N` and `stride` parameters:
|
|
63
|
-
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
64
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
65
|
-
> {{alias}}( N, -1, x, 2 )
|
|
66
|
-
<Float64Array>[ 3.0, -2.0, 1.0, -4.0 ]
|
|
67
|
-
|
|
68
|
-
// Using view offsets:
|
|
69
|
-
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
70
|
-
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
|
71
|
-
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
|
|
72
|
-
> {{alias}}( N, 1, x1, 2 )
|
|
73
|
-
<Float64Array>[ -4.0, 3.0, -2.0 ]
|
|
74
|
-
> x0
|
|
75
|
-
<Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
|
|
76
|
-
|
|
77
|
-
{{alias}}.ndarray( N, order, x, stride, offset )
|
|
78
|
-
Sorts a double-precision floating-point strided array using insertion sort
|
|
79
|
-
and alternative indexing semantics.
|
|
80
|
-
|
|
81
|
-
While typed array views mandate a view offset based on the underlying
|
|
82
|
-
buffer, the `offset` parameter supports indexing semantics based on a
|
|
83
|
-
starting index.
|
|
84
|
-
|
|
85
|
-
Parameters
|
|
86
|
-
----------
|
|
87
|
-
N: integer
|
|
88
|
-
Number of indexed elements.
|
|
89
|
-
|
|
90
|
-
order: number
|
|
91
|
-
Sort order. If `order < 0`, the function sorts `x` in decreasing order.
|
|
92
|
-
If `order > 0`, the function sorts `x` in increasing order.
|
|
93
|
-
|
|
94
|
-
x: Float64Array
|
|
95
|
-
Input array.
|
|
96
|
-
|
|
97
|
-
stride: integer
|
|
98
|
-
Index increment for `x`.
|
|
99
|
-
|
|
100
|
-
offset: integer
|
|
101
|
-
Starting index of `x`.
|
|
102
|
-
|
|
103
|
-
Returns
|
|
104
|
-
-------
|
|
105
|
-
x: Float64Array
|
|
106
|
-
Input array `x`.
|
|
107
|
-
|
|
108
|
-
Examples
|
|
109
|
-
--------
|
|
110
|
-
// Standard Usage:
|
|
111
|
-
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
112
|
-
> {{alias}}.ndarray( x.length, 1, x, 1, 0 )
|
|
113
|
-
<Float64Array>[ -4.0, -2.0, 1.0, 3.0 ]
|
|
114
|
-
|
|
115
|
-
// Using an index offset:
|
|
116
|
-
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] );
|
|
117
|
-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
|
|
118
|
-
> {{alias}}.ndarray( N, 1, x, 2, 1 )
|
|
119
|
-
<Float64Array>[ 1.0, -4.0, 3.0, -2.0 ]
|
|
120
|
-
|
|
121
|
-
See Also
|
|
122
|
-
--------
|
|
123
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -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 dsortins = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a Float64Array...
|
|
25
|
-
{
|
|
26
|
-
const x = new Float64Array( 10 );
|
|
27
|
-
|
|
28
|
-
dsortins( 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
|
-
dsortins( '10', 1, x, 1 ); // $ExpectError
|
|
36
|
-
dsortins( true, 1, x, 1 ); // $ExpectError
|
|
37
|
-
dsortins( false, 1, x, 1 ); // $ExpectError
|
|
38
|
-
dsortins( null, 1, x, 1 ); // $ExpectError
|
|
39
|
-
dsortins( undefined, 1, x, 1 ); // $ExpectError
|
|
40
|
-
dsortins( [], 1, x, 1 ); // $ExpectError
|
|
41
|
-
dsortins( {}, 1, x, 1 ); // $ExpectError
|
|
42
|
-
dsortins( ( 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
|
-
dsortins( x.length, '10', x, 1 ); // $ExpectError
|
|
50
|
-
dsortins( x.length, true, x, 1 ); // $ExpectError
|
|
51
|
-
dsortins( x.length, false, x, 1 ); // $ExpectError
|
|
52
|
-
dsortins( x.length, null, x, 1 ); // $ExpectError
|
|
53
|
-
dsortins( x.length, undefined, x, 1 ); // $ExpectError
|
|
54
|
-
dsortins( x.length, [], x, 1 ); // $ExpectError
|
|
55
|
-
dsortins( x.length, {}, x, 1 ); // $ExpectError
|
|
56
|
-
dsortins( 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
|
-
dsortins( x.length, 1, 10, 1 ); // $ExpectError
|
|
64
|
-
dsortins( x.length, 1, '10', 1 ); // $ExpectError
|
|
65
|
-
dsortins( x.length, 1, true, 1 ); // $ExpectError
|
|
66
|
-
dsortins( x.length, 1, false, 1 ); // $ExpectError
|
|
67
|
-
dsortins( x.length, 1, null, 1 ); // $ExpectError
|
|
68
|
-
dsortins( x.length, 1, undefined, 1 ); // $ExpectError
|
|
69
|
-
dsortins( x.length, 1, [], 1 ); // $ExpectError
|
|
70
|
-
dsortins( x.length, 1, {}, 1 ); // $ExpectError
|
|
71
|
-
dsortins( 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
|
-
dsortins( x.length, 1, x, '10' ); // $ExpectError
|
|
79
|
-
dsortins( x.length, 1, x, true ); // $ExpectError
|
|
80
|
-
dsortins( x.length, 1, x, false ); // $ExpectError
|
|
81
|
-
dsortins( x.length, 1, x, null ); // $ExpectError
|
|
82
|
-
dsortins( x.length, 1, x, undefined ); // $ExpectError
|
|
83
|
-
dsortins( x.length, 1, x, [] ); // $ExpectError
|
|
84
|
-
dsortins( x.length, 1, x, {} ); // $ExpectError
|
|
85
|
-
dsortins( 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
|
-
dsortins(); // $ExpectError
|
|
93
|
-
dsortins( x.length ); // $ExpectError
|
|
94
|
-
dsortins( x.length, 1 ); // $ExpectError
|
|
95
|
-
dsortins( x.length, 1, x ); // $ExpectError
|
|
96
|
-
dsortins( 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
|
-
dsortins.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
|
-
dsortins.ndarray( '10', 1, x, 1, 0 ); // $ExpectError
|
|
111
|
-
dsortins.ndarray( true, 1, x, 1, 0 ); // $ExpectError
|
|
112
|
-
dsortins.ndarray( false, 1, x, 1, 0 ); // $ExpectError
|
|
113
|
-
dsortins.ndarray( null, 1, x, 1, 0 ); // $ExpectError
|
|
114
|
-
dsortins.ndarray( undefined, 1, x, 1, 0 ); // $ExpectError
|
|
115
|
-
dsortins.ndarray( [], 1, x, 1, 0 ); // $ExpectError
|
|
116
|
-
dsortins.ndarray( {}, 1, x, 1, 0 ); // $ExpectError
|
|
117
|
-
dsortins.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
|
-
dsortins.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError
|
|
125
|
-
dsortins.ndarray( x.length, true, x, 1, 0 ); // $ExpectError
|
|
126
|
-
dsortins.ndarray( x.length, false, x, 1, 0 ); // $ExpectError
|
|
127
|
-
dsortins.ndarray( x.length, null, x, 1, 0 ); // $ExpectError
|
|
128
|
-
dsortins.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError
|
|
129
|
-
dsortins.ndarray( x.length, [], x, 1, 0 ); // $ExpectError
|
|
130
|
-
dsortins.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError
|
|
131
|
-
dsortins.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
|
-
dsortins.ndarray( x.length, 1, 10, 1, 0 ); // $ExpectError
|
|
139
|
-
dsortins.ndarray( x.length, 1, '10', 1, 0 ); // $ExpectError
|
|
140
|
-
dsortins.ndarray( x.length, 1, true, 1, 0 ); // $ExpectError
|
|
141
|
-
dsortins.ndarray( x.length, 1, false, 1, 0 ); // $ExpectError
|
|
142
|
-
dsortins.ndarray( x.length, 1, null, 1, 0 ); // $ExpectError
|
|
143
|
-
dsortins.ndarray( x.length, 1, undefined, 1, 0 ); // $ExpectError
|
|
144
|
-
dsortins.ndarray( x.length, 1, [], 1, 0 ); // $ExpectError
|
|
145
|
-
dsortins.ndarray( x.length, 1, {}, 1, 0 ); // $ExpectError
|
|
146
|
-
dsortins.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
|
-
dsortins.ndarray( x.length, 1, x, '10', 0 ); // $ExpectError
|
|
154
|
-
dsortins.ndarray( x.length, 1, x, true, 0 ); // $ExpectError
|
|
155
|
-
dsortins.ndarray( x.length, 1, x, false, 0 ); // $ExpectError
|
|
156
|
-
dsortins.ndarray( x.length, 1, x, null, 0 ); // $ExpectError
|
|
157
|
-
dsortins.ndarray( x.length, 1, x, undefined, 0 ); // $ExpectError
|
|
158
|
-
dsortins.ndarray( x.length, 1, x, [], 0 ); // $ExpectError
|
|
159
|
-
dsortins.ndarray( x.length, 1, x, {}, 0 ); // $ExpectError
|
|
160
|
-
dsortins.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
|
-
dsortins.ndarray( x.length, 1, x, 1, '10' ); // $ExpectError
|
|
168
|
-
dsortins.ndarray( x.length, 1, x, 1, true ); // $ExpectError
|
|
169
|
-
dsortins.ndarray( x.length, 1, x, 1, false ); // $ExpectError
|
|
170
|
-
dsortins.ndarray( x.length, 1, x, 1, null ); // $ExpectError
|
|
171
|
-
dsortins.ndarray( x.length, 1, x, 1, undefined ); // $ExpectError
|
|
172
|
-
dsortins.ndarray( x.length, 1, x, 1, [] ); // $ExpectError
|
|
173
|
-
dsortins.ndarray( x.length, 1, x, 1, {} ); // $ExpectError
|
|
174
|
-
dsortins.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
|
-
dsortins.ndarray(); // $ExpectError
|
|
182
|
-
dsortins.ndarray( x.length ); // $ExpectError
|
|
183
|
-
dsortins.ndarray( x.length, 1 ); // $ExpectError
|
|
184
|
-
dsortins.ndarray( x.length, 1, x ); // $ExpectError
|
|
185
|
-
dsortins.ndarray( x.length, 1, x, 1 ); // $ExpectError
|
|
186
|
-
dsortins.ndarray( x.length, 1, x, 1, 0, 10 ); // $ExpectError
|
|
187
|
-
}
|