@stdlib/blas-base-cswap 0.1.0 → 0.2.1

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-2023 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -89,25 +89,22 @@ im = imagf( z );
89
89
  The function has the following parameters:
90
90
 
91
91
  - **N**: number of indexed elements.
92
- - **x**: input [`Complex64Array`][@stdlib/array/complex64].
92
+ - **x**: first input [`Complex64Array`][@stdlib/array/complex64].
93
93
  - **strideX**: index increment for `x`.
94
- - **y**: destination [`Complex64Array`][@stdlib/array/complex64].
94
+ - **y**: second input [`Complex64Array`][@stdlib/array/complex64].
95
95
  - **strideY**: index increment for `y`.
96
96
 
97
- The `N` and `stride` parameters determine how values from `x` are interchanged with values from `y`. For example, to interchange in reverse order every other value in `x` into the first `N` elements of `y`,
97
+ The `N` and stride parameters determine how values from `x` are interchanged with values from `y`. For example, to interchange in reverse order every other value in `x` into the first `N` elements of `y`,
98
98
 
99
99
  ```javascript
100
100
  var Complex64Array = require( '@stdlib/array-complex64' );
101
- var floor = require( '@stdlib/math-base-special-floor' );
102
101
  var realf = require( '@stdlib/complex-realf' );
103
102
  var imagf = require( '@stdlib/complex-imagf' );
104
103
 
105
104
  var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
106
105
  var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
107
106
 
108
- var N = floor( x.length / 2 );
109
-
110
- cswap( N, x, -2, y, 1 );
107
+ cswap( 2, x, -2, y, 1 );
111
108
 
112
109
  var z = y.get( 0 );
113
110
  // returns <Complex64>
@@ -205,7 +202,7 @@ The function has the following additional parameters:
205
202
  - **offsetX**: starting index for `x`.
206
203
  - **offsetY**: starting index for `y`.
207
204
 
208
- While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offsetX` and `offsetY` parameters support indexing semantics based on starting indices. For example, to interchange every other value in `x` starting from the second value into the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,...,
205
+ While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to interchange every other value in `x` starting from the second value into the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,...,
209
206
 
210
207
  ```javascript
211
208
  var Complex64Array = require( '@stdlib/array-complex64' );
@@ -259,24 +256,21 @@ im = imagf( z );
259
256
 
260
257
  ```javascript
261
258
  var discreteUniform = require( '@stdlib/random-base-discrete-uniform' );
262
- var Complex64Array = require( '@stdlib/array-complex64' );
259
+ var filledarrayBy = require( '@stdlib/array-filled-by' );
260
+ var Complex64 = require( '@stdlib/complex-float32' );
263
261
  var cswap = require( '@stdlib/blas-base-cswap' );
264
262
 
265
- var re = discreteUniform.factory( 0, 10 );
266
- var im = discreteUniform.factory( -5, 5 );
267
-
268
- var x = new Complex64Array( 10 );
269
- var y = new Complex64Array( 10 );
270
-
271
- var i;
272
- for ( i = 0; i < x.length; i++ ) {
273
- x.set( [ re(), im() ], i );
274
- y.set( [ re(), im() ], i );
263
+ function rand() {
264
+ return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
275
265
  }
266
+
267
+ var x = filledarrayBy( 10, 'complex64', rand );
276
268
  console.log( x.get( 0 ).toString() );
269
+
270
+ var y = filledarrayBy( 10, 'complex64', rand );
277
271
  console.log( y.get( 0 ).toString() );
278
272
 
279
- // Swap elements in `x` and `y` starting from the end of `y`:
273
+ // Swap elements in `x` into `y` starting from the end of `y`:
280
274
  cswap( x.length, x, 1, y, -1 );
281
275
  console.log( x.get( x.length-1 ).toString() );
282
276
  console.log( y.get( y.length-1 ).toString() );
@@ -326,7 +320,7 @@ See [LICENSE][stdlib-license].
326
320
 
327
321
  ## Copyright
328
322
 
329
- Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
323
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
330
324
 
331
325
  </section>
332
326
 
@@ -339,8 +333,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
339
333
  [npm-image]: http://img.shields.io/npm/v/@stdlib/blas-base-cswap.svg
340
334
  [npm-url]: https://npmjs.org/package/@stdlib/blas-base-cswap
341
335
 
342
- [test-image]: https://github.com/stdlib-js/blas-base-cswap/actions/workflows/test.yml/badge.svg?branch=v0.1.0
343
- [test-url]: https://github.com/stdlib-js/blas-base-cswap/actions/workflows/test.yml?query=branch:v0.1.0
336
+ [test-image]: https://github.com/stdlib-js/blas-base-cswap/actions/workflows/test.yml/badge.svg?branch=v0.2.1
337
+ [test-url]: https://github.com/stdlib-js/blas-base-cswap/actions/workflows/test.yml?query=branch:v0.2.1
344
338
 
345
339
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-base-cswap/main.svg
346
340
  [coverage-url]: https://codecov.io/github/stdlib-js/blas-base-cswap?branch=main
@@ -363,8 +357,11 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
363
357
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
364
358
 
365
359
  [deno-url]: https://github.com/stdlib-js/blas-base-cswap/tree/deno
360
+ [deno-readme]: https://github.com/stdlib-js/blas-base-cswap/blob/deno/README.md
366
361
  [umd-url]: https://github.com/stdlib-js/blas-base-cswap/tree/umd
362
+ [umd-readme]: https://github.com/stdlib-js/blas-base-cswap/blob/umd/README.md
367
363
  [esm-url]: https://github.com/stdlib-js/blas-base-cswap/tree/esm
364
+ [esm-readme]: https://github.com/stdlib-js/blas-base-cswap/blob/esm/README.md
368
365
  [branches-url]: https://github.com/stdlib-js/blas-base-cswap/blob/main/branches.md
369
366
 
370
367
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/blas-base-cswap/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).
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var q=function(f,a){return function(){return a||f((a={exports:{}}).exports,a),a.exports}};var O=q(function(I,y){
2
- var m=require('@stdlib/array-float32/dist');function _(f,a,c,o,n){var v,i,e,w,p,u,s,r,t;if(f<=0)return o;if(v=new m(a.buffer,a.byteOffset,a.length*2),i=new m(o.buffer,o.byteOffset,o.length*2),c===1&&n===1){for(r=0;r<f*2;r+=2)e=v[r],v[r]=i[r],i[r]=e,t=r+1,e=v[t],v[t]=i[t],i[t]=e;return o}for(c<0?u=2*(1-f)*c:u=0,n<0?s=2*(1-f)*n:s=0,w=c*2,p=n*2,r=0;r<f;r++)e=v[u],v[u]=i[s],i[s]=e,e=v[u+1],v[u+1]=i[s+1],i[s+1]=e,u+=w,s+=p;return o}y.exports=_
3
- });var j=q(function(J,h){
4
- var g=require('@stdlib/array-float32/dist');function E(f,a,c,o,n,v,i){var e,w,p,u,s,r,t,l;if(f<=0)return n;for(e=new g(a.buffer,a.byteOffset,a.length*2),w=new g(n.buffer,n.byteOffset,n.length*2),u=c*2,s=v*2,r=o*2,t=i*2,l=0;l<f;l++)p=e[r],e[r]=w[t],w[t]=p,p=e[r+1],e[r+1]=w[t+1],w[t+1]=p,r+=u,t+=s;return n}h.exports=E
5
- });var F=q(function(K,A){
6
- var k=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),x=O(),z=j();k(x,"ndarray",z);A.exports=x
7
- });var B=require("path").join,C=require('@stdlib/utils-try-require/dist'),D=require('@stdlib/assert-is-error/dist'),G=F(),b,R=C(B(__dirname,"./native.js"));D(R)?b=G:b=R;module.exports=b;
1
+ "use strict";var x=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var y=x(function(I,l){
2
+ var j=require('@stdlib/strided-base-reinterpret-complex64/dist');function k(t,n,c,q,p){var i,v,e,o,f,u,s,r,a;if(t<=0)return q;if(i=j(n,0),v=j(q,0),c===1&&p===1){for(r=0;r<t*2;r+=2)e=i[r],i[r]=v[r],v[r]=e,a=r+1,e=i[a],i[a]=v[a],v[a]=e;return q}for(c<0?u=2*(1-t)*c:u=0,p<0?s=2*(1-t)*p:s=0,o=c*2,f=p*2,r=0;r<t;r++)e=i[u],i[u]=v[s],v[s]=e,e=i[u+1],i[u+1]=v[s+1],v[s+1]=e,u+=o,s+=f;return q}l.exports=k
3
+ });var E=x(function(J,_){
4
+ var R=require('@stdlib/strided-base-reinterpret-complex64/dist');function z(t,n,c,q,p,i,v){var e,o,f,u,s,r,a,w;if(t<=0)return p;for(e=R(n,0),o=R(p,0),u=c*2,s=i*2,r=q*2,a=v*2,w=0;w<t;w++)f=e[r],e[r]=o[a],o[a]=f,f=e[r+1],e[r+1]=o[a+1],o[a+1]=f,r+=u,a+=s;return p}_.exports=z
5
+ });var g=x(function(K,b){
6
+ var A=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),O=y(),B=E();A(O,"ndarray",B);b.exports=O
7
+ });var C=require("path").join,D=require('@stdlib/utils-try-require/dist'),F=require('@stdlib/assert-is-error/dist'),G=g(),m,h=D(C(__dirname,"./native.js"));F(h)?m=G:m=h;module.exports=m;
8
8
  /** @license Apache-2.0 */
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/cswap.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 Float32Array = require( '@stdlib/array-float32' );\n\n\n// MAIN //\n\n/**\n* Interchanges two complex single-precision floating-point vectors.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {Complex64Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @returns {Complex64Array} `y`\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, y, 1 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*/\nfunction cswap( N, x, strideX, y, strideY ) {\n\tvar viewX;\n\tvar viewY;\n\tvar tmp;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\tvar j;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tviewX = new Float32Array( x.buffer, x.byteOffset, x.length*2 );\n\tviewY = new Float32Array( y.buffer, y.byteOffset, y.length*2 );\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tfor ( i = 0; i < N*2; i += 2 ) {\n\t\t\ttmp = viewX[ i ];\n\t\t\tviewX[ i ] = viewY[ i ];\n\t\t\tviewY[ i ] = tmp;\n\n\t\t\tj = i + 1;\n\t\t\ttmp = viewX[ j ];\n\t\t\tviewX[ j ] = viewY[ j ];\n\t\t\tviewY[ j ] = tmp;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = 2 * (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = 2 * (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tsx = strideX * 2;\n\tsy = strideY * 2;\n\tfor ( i = 0; i < N; i++ ) {\n\t\ttmp = viewX[ ix ];\n\t\tviewX[ ix ] = viewY[ iy ];\n\t\tviewY[ iy ] = tmp;\n\n\t\ttmp = viewX[ ix+1 ];\n\t\tviewX[ ix+1 ] = viewY[ iy+1 ];\n\t\tviewY[ iy+1 ] = tmp;\n\n\t\tix += sx;\n\t\tiy += sy;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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 Float32Array = require( '@stdlib/array-float32' );\n\n\n// MAIN //\n\n/**\n* Interchanges two complex single-precision floating-point vectors.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Complex64Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Complex64Array} `y`\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, 0, y, 1, 0 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*/\nfunction cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar viewX;\n\tvar viewY;\n\tvar tmp;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tviewX = new Float32Array( x.buffer, x.byteOffset, x.length*2 );\n\tviewY = new Float32Array( y.buffer, y.byteOffset, y.length*2 );\n\tsx = strideX * 2;\n\tsy = strideY * 2;\n\tix = offsetX * 2;\n\tiy = offsetY * 2;\n\tfor ( i = 0; i < N; i++ ) {\n\t\ttmp = viewX[ ix ];\n\t\tviewX[ ix ] = viewY[ iy ];\n\t\tviewY[ iy ] = tmp;\n\n\t\ttmp = viewX[ ix+1 ];\n\t\tviewX[ ix+1 ] = viewY[ iy+1 ];\n\t\tviewY[ iy+1 ] = tmp;\n\n\t\tix += sx;\n\t\tiy += sy;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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 cswap = require( './cswap.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( cswap, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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* BLAS level 1 routine to interchange two complex single-precision floating-point vectors.\n*\n* @module @stdlib/blas-base-cswap\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var cswap = require( '@stdlib/blas-base-cswap' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, y, 1 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var cswap = require( '@stdlib/blas-base-cswap' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap.ndarray( x.length, x, 1, 0, y, 1, 0 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.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 cswap;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tcswap = main;\n} else {\n\tcswap = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\n\n// exports: { \"ndarray\": \"cswap.ndarray\" }\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,uBAAwB,EA2CpD,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAAGC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKb,GAAK,EACT,OAAOG,EAIR,GAFAE,EAAQ,IAAIP,EAAcG,EAAE,OAAQA,EAAE,WAAYA,EAAE,OAAO,CAAE,EAC7DK,EAAQ,IAAIR,EAAcK,EAAE,OAAQA,EAAE,WAAYA,EAAE,OAAO,CAAE,EACxDD,IAAY,GAAKE,IAAY,EAAI,CACrC,IAAMQ,EAAI,EAAGA,EAAIZ,EAAE,EAAGY,GAAK,EAC1BL,EAAMF,EAAOO,CAAE,EACfP,EAAOO,CAAE,EAAIN,EAAOM,CAAE,EACtBN,EAAOM,CAAE,EAAIL,EAEbM,EAAID,EAAI,EACRL,EAAMF,EAAOQ,CAAE,EACfR,EAAOQ,CAAE,EAAIP,EAAOO,CAAE,EACtBP,EAAOO,CAAE,EAAIN,EAEd,OAAOJ,CACR,CAaA,IAZKD,EAAU,EACdQ,EAAK,GAAK,EAAEV,GAAKE,EAEjBQ,EAAK,EAEDN,EAAU,EACdO,EAAK,GAAK,EAAEX,GAAKI,EAEjBO,EAAK,EAENH,EAAKN,EAAU,EACfO,EAAKL,EAAU,EACTQ,EAAI,EAAGA,EAAIZ,EAAGY,IACnBL,EAAMF,EAAOK,CAAG,EAChBL,EAAOK,CAAG,EAAIJ,EAAOK,CAAG,EACxBL,EAAOK,CAAG,EAAIJ,EAEdA,EAAMF,EAAOK,EAAG,CAAE,EAClBL,EAAOK,EAAG,CAAE,EAAIJ,EAAOK,EAAG,CAAE,EAC5BL,EAAOK,EAAG,CAAE,EAAIJ,EAEhBG,GAAMF,EACNG,GAAMF,EAEP,OAAON,CACR,CAKAN,EAAO,QAAUE,IC5HjB,IAAAe,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,uBAAwB,EA6CpD,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKd,GAAK,EACT,OAAOI,EAQR,IANAG,EAAQ,IAAIT,EAAcG,EAAE,OAAQA,EAAE,WAAYA,EAAE,OAAO,CAAE,EAC7DO,EAAQ,IAAIV,EAAcM,EAAE,OAAQA,EAAE,WAAYA,EAAE,OAAO,CAAE,EAC7DM,EAAKR,EAAU,EACfS,EAAKN,EAAU,EACfO,EAAKT,EAAU,EACfU,EAAKP,EAAU,EACTQ,EAAI,EAAGA,EAAId,EAAGc,IACnBL,EAAMF,EAAOK,CAAG,EAChBL,EAAOK,CAAG,EAAIJ,EAAOK,CAAG,EACxBL,EAAOK,CAAG,EAAIJ,EAEdA,EAAMF,EAAOK,EAAG,CAAE,EAClBL,EAAOK,EAAG,CAAE,EAAIJ,EAAOK,EAAG,CAAE,EAC5BL,EAAOK,EAAG,CAAE,EAAIJ,EAEhBG,GAAMF,EACNG,GAAMF,EAEP,OAAOP,CACR,CAKAP,EAAO,QAAUE,ICxGjB,IAAAgB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAQ,IACRC,EAAU,IAKdF,EAAaC,EAAO,UAAWC,CAAQ,EAKvCH,EAAO,QAAUE,ICoDjB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAAQD,EAERC,EAAQC,EAMT,OAAO,QAAUD",
6
- "names": ["require_cswap", "__commonJSMin", "exports", "module", "Float32Array", "cswap", "N", "x", "strideX", "y", "strideY", "viewX", "viewY", "tmp", "sx", "sy", "ix", "iy", "i", "j", "require_ndarray", "__commonJSMin", "exports", "module", "Float32Array", "cswap", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "viewX", "viewY", "tmp", "sx", "sy", "ix", "iy", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "cswap", "ndarray", "join", "tryRequire", "isError", "main", "cswap", "tmp"]
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 reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// MAIN //\n\n/**\n* Interchanges two complex single-precision floating-point vectors.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {Complex64Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @returns {Complex64Array} `y`\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, y, 1 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*/\nfunction cswap( N, x, strideX, y, strideY ) {\n\tvar viewX;\n\tvar viewY;\n\tvar tmp;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\tvar j;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tviewX = reinterpret( x, 0 );\n\tviewY = reinterpret( y, 0 );\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tfor ( i = 0; i < N*2; i += 2 ) {\n\t\t\ttmp = viewX[ i ];\n\t\t\tviewX[ i ] = viewY[ i ];\n\t\t\tviewY[ i ] = tmp;\n\n\t\t\tj = i + 1;\n\t\t\ttmp = viewX[ j ];\n\t\t\tviewX[ j ] = viewY[ j ];\n\t\t\tviewY[ j ] = tmp;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = 2 * (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = 2 * (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tsx = strideX * 2;\n\tsy = strideY * 2;\n\tfor ( i = 0; i < N; i++ ) {\n\t\ttmp = viewX[ ix ];\n\t\tviewX[ ix ] = viewY[ iy ];\n\t\tviewY[ iy ] = tmp;\n\n\t\ttmp = viewX[ ix+1 ];\n\t\tviewX[ ix+1 ] = viewY[ iy+1 ];\n\t\tviewY[ iy+1 ] = tmp;\n\n\t\tix += sx;\n\t\tiy += sy;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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 reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// MAIN //\n\n/**\n* Interchanges two complex single-precision floating-point vectors.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - first input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Complex64Array} y - second input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Complex64Array} `y`\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, 0, y, 1, 0 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*/\nfunction cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar viewX;\n\tvar viewY;\n\tvar tmp;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tviewX = reinterpret( x, 0 );\n\tviewY = reinterpret( y, 0 );\n\tsx = strideX * 2;\n\tsy = strideY * 2;\n\tix = offsetX * 2;\n\tiy = offsetY * 2;\n\tfor ( i = 0; i < N; i++ ) {\n\t\ttmp = viewX[ ix ];\n\t\tviewX[ ix ] = viewY[ iy ];\n\t\tviewY[ iy ] = tmp;\n\n\t\ttmp = viewX[ ix+1 ];\n\t\tviewX[ ix+1 ] = viewY[ iy+1 ];\n\t\tviewY[ iy+1 ] = tmp;\n\n\t\tix += sx;\n\t\tiy += sy;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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 cswap = require( './cswap.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( cswap, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\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* BLAS level 1 routine to interchange two complex single-precision floating-point vectors.\n*\n* @module @stdlib/blas-base-cswap\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var cswap = require( '@stdlib/blas-base-cswap' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap( x.length, x, 1, y, 1 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.0\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var cswap = require( '@stdlib/blas-base-cswap' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n*\n* cswap.ndarray( x.length, x, 1, 0, y, 1, 0 );\n*\n* var z = y.get( 0 );\n* // returns <Complex64>\n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*\n* z = x.get( 0 );\n* // returns <Complex64>\n*\n* re = realf( z );\n* // returns 7.0\n*\n* im = imagf( z );\n* // returns 8.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 cswap;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tcswap = main;\n} else {\n\tcswap = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cswap;\n\n// exports: { \"ndarray\": \"cswap.ndarray\" }\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,4CAA6C,EA2CxE,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAAGC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKb,GAAK,EACT,OAAOG,EAIR,GAFAE,EAAQP,EAAaG,EAAG,CAAE,EAC1BK,EAAQR,EAAaK,EAAG,CAAE,EACrBD,IAAY,GAAKE,IAAY,EAAI,CACrC,IAAMQ,EAAI,EAAGA,EAAIZ,EAAE,EAAGY,GAAK,EAC1BL,EAAMF,EAAOO,CAAE,EACfP,EAAOO,CAAE,EAAIN,EAAOM,CAAE,EACtBN,EAAOM,CAAE,EAAIL,EAEbM,EAAID,EAAI,EACRL,EAAMF,EAAOQ,CAAE,EACfR,EAAOQ,CAAE,EAAIP,EAAOO,CAAE,EACtBP,EAAOO,CAAE,EAAIN,EAEd,OAAOJ,CACR,CAaA,IAZKD,EAAU,EACdQ,EAAK,GAAK,EAAEV,GAAKE,EAEjBQ,EAAK,EAEDN,EAAU,EACdO,EAAK,GAAK,EAAEX,GAAKI,EAEjBO,EAAK,EAENH,EAAKN,EAAU,EACfO,EAAKL,EAAU,EACTQ,EAAI,EAAGA,EAAIZ,EAAGY,IACnBL,EAAMF,EAAOK,CAAG,EAChBL,EAAOK,CAAG,EAAIJ,EAAOK,CAAG,EACxBL,EAAOK,CAAG,EAAIJ,EAEdA,EAAMF,EAAOK,EAAG,CAAE,EAClBL,EAAOK,EAAG,CAAE,EAAIJ,EAAOK,EAAG,CAAE,EAC5BL,EAAOK,EAAG,CAAE,EAAIJ,EAEhBG,GAAMF,EACNG,GAAMF,EAEP,OAAON,CACR,CAKAN,EAAO,QAAUE,IC5HjB,IAAAe,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,4CAA6C,EA6CxE,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKd,GAAK,EACT,OAAOI,EAQR,IANAG,EAAQT,EAAaG,EAAG,CAAE,EAC1BO,EAAQV,EAAaM,EAAG,CAAE,EAC1BM,EAAKR,EAAU,EACfS,EAAKN,EAAU,EACfO,EAAKT,EAAU,EACfU,EAAKP,EAAU,EACTQ,EAAI,EAAGA,EAAId,EAAGc,IACnBL,EAAMF,EAAOK,CAAG,EAChBL,EAAOK,CAAG,EAAIJ,EAAOK,CAAG,EACxBL,EAAOK,CAAG,EAAIJ,EAEdA,EAAMF,EAAOK,EAAG,CAAE,EAClBL,EAAOK,EAAG,CAAE,EAAIJ,EAAOK,EAAG,CAAE,EAC5BL,EAAOK,EAAG,CAAE,EAAIJ,EAEhBG,GAAMF,EACNG,GAAMF,EAEP,OAAOP,CACR,CAKAP,EAAO,QAAUE,ICxGjB,IAAAgB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAQ,IACRC,EAAU,IAKdF,EAAaC,EAAO,UAAWC,CAAQ,EAKvCH,EAAO,QAAUE,ICoDjB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAAQD,EAERC,EAAQC,EAMT,OAAO,QAAUD",
6
+ "names": ["require_cswap", "__commonJSMin", "exports", "module", "reinterpret", "cswap", "N", "x", "strideX", "y", "strideY", "viewX", "viewY", "tmp", "sx", "sy", "ix", "iy", "i", "j", "require_ndarray", "__commonJSMin", "exports", "module", "reinterpret", "cswap", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "viewX", "viewY", "tmp", "sx", "sy", "ix", "iy", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "cswap", "ndarray", "join", "tryRequire", "isError", "main", "cswap", "tmp"]
7
7
  }
@@ -37,9 +37,9 @@ interface Routine {
37
37
  * @returns `y`
38
38
  *
39
39
  * @example
40
- * var Complex64Array = require( `@stdlib/array/complex64` );
41
- * var realf = require( `@stdlib/complex/realf` );
42
- * var imagf = require( `@stdlib/complex/imagf` );
40
+ * var Complex64Array = require( '@stdlib/array-complex64' );
41
+ * var realf = require( '@stdlib/complex-realf' );
42
+ * var imagf = require( '@stdlib/complex-imagf' );
43
43
  *
44
44
  * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
45
45
  * var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
@@ -64,7 +64,7 @@ interface Routine {
64
64
  * im = imagf( z );
65
65
  * // returns 8.0
66
66
  */
67
- ( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64Array; // tslint:disable-line:max-line-length
67
+ ( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64Array;
68
68
 
69
69
  /**
70
70
  * Interchanges two complex single-precision floating-point vectors using alternative indexing semantics.
@@ -79,9 +79,9 @@ interface Routine {
79
79
  * @returns `y`
80
80
  *
81
81
  * @example
82
- * var Complex64Array = require( `@stdlib/array/complex64` );
83
- * var realf = require( `@stdlib/complex/realf` );
84
- * var imagf = require( `@stdlib/complex/imagf` );
82
+ * var Complex64Array = require( '@stdlib/array-complex64' );
83
+ * var realf = require( '@stdlib/complex-realf' );
84
+ * var imagf = require( '@stdlib/complex-imagf' );
85
85
  *
86
86
  * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
87
87
  * var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
@@ -106,7 +106,7 @@ interface Routine {
106
106
  * im = imagf( z );
107
107
  * // returns 8.0
108
108
  */
109
- ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64Array; // tslint:disable-line:max-line-length
109
+ ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64Array;
110
110
  }
111
111
 
112
112
  /**
@@ -120,9 +120,9 @@ interface Routine {
120
120
  * @returns `y`
121
121
  *
122
122
  * @example
123
- * var Complex64Array = require( `@stdlib/array/complex64` );
124
- * var realf = require( `@stdlib/complex/realf` );
125
- * var imagf = require( `@stdlib/complex/imagf` );
123
+ * var Complex64Array = require( '@stdlib/array-complex64' );
124
+ * var realf = require( '@stdlib/complex-realf' );
125
+ * var imagf = require( '@stdlib/complex-imagf' );
126
126
  *
127
127
  * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
128
128
  * var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
@@ -148,9 +148,9 @@ interface Routine {
148
148
  * // returns 8.0
149
149
  *
150
150
  * @example
151
- * var Complex64Array = require( `@stdlib/array/complex64` );
152
- * var realf = require( `@stdlib/complex/realf` );
153
- * var imagf = require( `@stdlib/complex/imagf` );
151
+ * var Complex64Array = require( '@stdlib/array-complex64' );
152
+ * var realf = require( '@stdlib/complex-realf' );
153
+ * var imagf = require( '@stdlib/complex-imagf' );
154
154
  *
155
155
  * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
156
156
  * var y = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
package/include.gypi CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
  # Source files:
54
54
  'src_files': [
55
- '<(src_dir)/addon.cpp',
55
+ '<(src_dir)/addon.c',
56
56
  '<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{\'os\':\'<(OS)\',\'blas\':\'<(blas)\'},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
57
57
  ],
58
58
 
package/lib/cswap.js CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var Float32Array = require( '@stdlib/array-float32' );
23
+ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
24
24
 
25
25
 
26
26
  // MAIN //
@@ -77,8 +77,8 @@ function cswap( N, x, strideX, y, strideY ) {
77
77
  if ( N <= 0 ) {
78
78
  return y;
79
79
  }
80
- viewX = new Float32Array( x.buffer, x.byteOffset, x.length*2 );
81
- viewY = new Float32Array( y.buffer, y.byteOffset, y.length*2 );
80
+ viewX = reinterpret( x, 0 );
81
+ viewY = reinterpret( y, 0 );
82
82
  if ( strideX === 1 && strideY === 1 ) {
83
83
  for ( i = 0; i < N*2; i += 2 ) {
84
84
  tmp = viewX[ i ];
@@ -20,7 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var Float32Array = require( '@stdlib/array-float32' );
23
+ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
24
24
  var addon = require( './../src/addon.node' );
25
25
 
26
26
 
@@ -65,8 +65,8 @@ var addon = require( './../src/addon.node' );
65
65
  * // returns 8.0
66
66
  */
67
67
  function cswap( N, x, strideX, y, strideY ) {
68
- var viewX = new Float32Array( x.buffer, x.byteOffset, x.length*2 );
69
- var viewY = new Float32Array( y.buffer, y.byteOffset, y.length*2 );
68
+ var viewX = reinterpret( x, 0 );
69
+ var viewY = reinterpret( y, 0 );
70
70
  addon( N, viewX, strideX, viewY, strideY );
71
71
  return y;
72
72
  }
package/lib/ndarray.js CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var Float32Array = require( '@stdlib/array-float32' );
23
+ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
24
24
 
25
25
 
26
26
  // MAIN //
@@ -78,8 +78,8 @@ function cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
78
78
  if ( N <= 0 ) {
79
79
  return y;
80
80
  }
81
- viewX = new Float32Array( x.buffer, x.byteOffset, x.length*2 );
82
- viewY = new Float32Array( y.buffer, y.byteOffset, y.length*2 );
81
+ viewX = reinterpret( x, 0 );
82
+ viewY = reinterpret( y, 0 );
83
83
  sx = strideX * 2;
84
84
  sy = strideY * 2;
85
85
  ix = offsetX * 2;
@@ -20,7 +20,8 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var Float32Array = require( '@stdlib/array-float32' );
23
+ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
24
+ var minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
24
25
  var addon = require( './../src/addon.node' );
25
26
 
26
27
 
@@ -69,14 +70,13 @@ var addon = require( './../src/addon.node' );
69
70
  function cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
70
71
  var viewX;
71
72
  var viewY;
72
- if ( strideX < 0 ) {
73
- offsetX += (N-1) * strideX;
74
- }
75
- if ( strideY < 0 ) {
76
- offsetY += (N-1) * strideY;
77
- }
78
- viewX = new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offsetX), 2*(x.length-offsetX) ); // eslint-disable-line max-len
79
- viewY = new Float32Array( y.buffer, y.byteOffset+(y.BYTES_PER_ELEMENT*offsetY), 2*(y.length-offsetY) ); // eslint-disable-line max-len
73
+
74
+ offsetX = minViewBufferIndex( N, strideX, offsetX );
75
+ offsetY = minViewBufferIndex( N, strideY, offsetY );
76
+
77
+ viewX = reinterpret( x, offsetX );
78
+ viewY = reinterpret( y, offsetY );
79
+
80
80
  addon( N, viewX, strideX, viewY, strideY );
81
81
  return y;
82
82
  }
package/manifest.json CHANGED
@@ -1,118 +1,169 @@
1
1
  {
2
- "options": {
3
- "os": "linux",
4
- "blas": ""
5
- },
6
- "fields": [
7
- {
8
- "field": "src",
9
- "resolve": true,
10
- "relative": true
11
- },
12
- {
13
- "field": "include",
14
- "resolve": true,
15
- "relative": true
16
- },
17
- {
18
- "field": "libraries",
19
- "resolve": false,
20
- "relative": false
21
- },
22
- {
23
- "field": "libpath",
24
- "resolve": true,
25
- "relative": false
26
- }
27
- ],
28
- "confs": [
29
- {
30
- "os": "linux",
31
- "blas": "",
32
- "src": [
33
- "./src/cswap.f",
34
- "./src/cswap_f.c"
35
- ],
36
- "include": [
37
- "./include"
38
- ],
39
- "libraries": [],
40
- "libpath": [],
41
- "dependencies": []
42
- },
43
- {
44
- "os": "linux",
45
- "blas": "openblas",
46
- "src": [
47
- "./src/cswap_cblas.c"
48
- ],
49
- "include": [
50
- "./include"
51
- ],
52
- "libraries": [
53
- "-lopenblas",
54
- "-lpthread"
55
- ],
56
- "libpath": [],
57
- "dependencies": []
58
- },
59
- {
60
- "os": "mac",
61
- "blas": "",
62
- "src": [
63
- "./src/cswap.f",
64
- "./src/cswap_f.c"
65
- ],
66
- "include": [
67
- "./include"
68
- ],
69
- "libraries": [],
70
- "libpath": [],
71
- "dependencies": []
72
- },
73
- {
74
- "os": "mac",
75
- "blas": "apple_accelerate_framework",
76
- "src": [
77
- "./src/cswap_cblas.c"
78
- ],
79
- "include": [
80
- "./include"
81
- ],
82
- "libraries": [
83
- "-lblas"
84
- ],
85
- "libpath": [],
86
- "dependencies": []
87
- },
88
- {
89
- "os": "mac",
90
- "blas": "openblas",
91
- "src": [
92
- "./src/cswap_cblas.c"
93
- ],
94
- "include": [
95
- "./include"
96
- ],
97
- "libraries": [
98
- "-lopenblas",
99
- "-lpthread"
100
- ],
101
- "libpath": [],
102
- "dependencies": []
103
- },
104
- {
105
- "os": "win",
106
- "blas": "",
107
- "src": [
108
- "./src/cswap.c"
109
- ],
110
- "include": [
111
- "./include"
112
- ],
113
- "libraries": [],
114
- "libpath": [],
115
- "dependencies": []
116
- }
117
- ]
2
+ "options": {
3
+ "os": "linux",
4
+ "blas": "",
5
+ "wasm": false
6
+ },
7
+ "fields": [
8
+ {
9
+ "field": "src",
10
+ "resolve": true,
11
+ "relative": true
12
+ },
13
+ {
14
+ "field": "include",
15
+ "resolve": true,
16
+ "relative": true
17
+ },
18
+ {
19
+ "field": "libraries",
20
+ "resolve": false,
21
+ "relative": false
22
+ },
23
+ {
24
+ "field": "libpath",
25
+ "resolve": true,
26
+ "relative": false
27
+ }
28
+ ],
29
+ "confs": [
30
+ {
31
+ "os": "linux",
32
+ "blas": "",
33
+ "wasm": false,
34
+ "src": [
35
+ "./src/cswap.f",
36
+ "./src/cswap_f.c"
37
+ ],
38
+ "include": [
39
+ "./include"
40
+ ],
41
+ "libraries": [],
42
+ "libpath": [],
43
+ "dependencies": [
44
+ "@stdlib/napi-export",
45
+ "@stdlib/napi-argv",
46
+ "@stdlib/napi-argv-int64",
47
+ "@stdlib/napi-argv-strided-complex64array"
48
+ ]
49
+ },
50
+ {
51
+ "os": "linux",
52
+ "blas": "openblas",
53
+ "wasm": false,
54
+ "src": [
55
+ "./src/cswap_cblas.c"
56
+ ],
57
+ "include": [
58
+ "./include"
59
+ ],
60
+ "libraries": [
61
+ "-lopenblas",
62
+ "-lpthread"
63
+ ],
64
+ "libpath": [],
65
+ "dependencies": [
66
+ "@stdlib/napi-export",
67
+ "@stdlib/napi-argv",
68
+ "@stdlib/napi-argv-int64",
69
+ "@stdlib/napi-argv-strided-complex64array"
70
+ ]
71
+ },
72
+ {
73
+ "os": "mac",
74
+ "blas": "",
75
+ "wasm": false,
76
+ "src": [
77
+ "./src/cswap.f",
78
+ "./src/cswap_f.c"
79
+ ],
80
+ "include": [
81
+ "./include"
82
+ ],
83
+ "libraries": [],
84
+ "libpath": [],
85
+ "dependencies": [
86
+ "@stdlib/napi-export",
87
+ "@stdlib/napi-argv",
88
+ "@stdlib/napi-argv-int64",
89
+ "@stdlib/napi-argv-strided-complex64array"
90
+ ]
91
+ },
92
+ {
93
+ "os": "mac",
94
+ "blas": "apple_accelerate_framework",
95
+ "wasm": false,
96
+ "src": [
97
+ "./src/cswap_cblas.c"
98
+ ],
99
+ "include": [
100
+ "./include"
101
+ ],
102
+ "libraries": [
103
+ "-lblas"
104
+ ],
105
+ "libpath": [],
106
+ "dependencies": [
107
+ "@stdlib/napi-export",
108
+ "@stdlib/napi-argv",
109
+ "@stdlib/napi-argv-int64",
110
+ "@stdlib/napi-argv-strided-complex64array"
111
+ ]
112
+ },
113
+ {
114
+ "os": "mac",
115
+ "blas": "openblas",
116
+ "wasm": false,
117
+ "src": [
118
+ "./src/cswap_cblas.c"
119
+ ],
120
+ "include": [
121
+ "./include"
122
+ ],
123
+ "libraries": [
124
+ "-lopenblas",
125
+ "-lpthread"
126
+ ],
127
+ "libpath": [],
128
+ "dependencies": [
129
+ "@stdlib/napi-export",
130
+ "@stdlib/napi-argv",
131
+ "@stdlib/napi-argv-int64",
132
+ "@stdlib/napi-argv-strided-complex64array"
133
+ ]
134
+ },
135
+ {
136
+ "os": "win",
137
+ "blas": "",
138
+ "wasm": false,
139
+ "src": [
140
+ "./src/cswap.c"
141
+ ],
142
+ "include": [
143
+ "./include"
144
+ ],
145
+ "libraries": [],
146
+ "libpath": [],
147
+ "dependencies": [
148
+ "@stdlib/napi-export",
149
+ "@stdlib/napi-argv",
150
+ "@stdlib/napi-argv-int64",
151
+ "@stdlib/napi-argv-strided-complex64array"
152
+ ]
153
+ },
154
+ {
155
+ "os": "",
156
+ "blas": "",
157
+ "wasm": true,
158
+ "src": [
159
+ "./src/cswap.c"
160
+ ],
161
+ "include": [
162
+ "./include"
163
+ ],
164
+ "libraries": [],
165
+ "libpath": [],
166
+ "dependencies": []
167
+ }
168
+ ]
118
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/blas-base-cswap",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Interchanges two complex single-precision floating-point vectors.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -17,21 +17,14 @@
17
17
  "browser": "./lib/main.js",
18
18
  "gypfile": false,
19
19
  "directories": {
20
- "benchmark": "./benchmark",
21
20
  "doc": "./docs",
22
- "example": "./examples",
23
21
  "include": "./include",
24
22
  "lib": "./lib",
25
23
  "src": "./src",
26
- "test": "./test"
24
+ "dist": "./dist"
27
25
  },
28
26
  "types": "./docs/types",
29
- "scripts": {
30
- "test": "make test",
31
- "test-cov": "make test-cov",
32
- "examples": "make examples",
33
- "benchmark": "make benchmark"
34
- },
27
+ "scripts": {},
35
28
  "homepage": "https://stdlib.io",
36
29
  "repository": {
37
30
  "type": "git",
@@ -41,28 +34,17 @@
41
34
  "url": "https://github.com/stdlib-js/stdlib/issues"
42
35
  },
43
36
  "dependencies": {
44
- "@stdlib/array-float32": "^0.1.0",
45
- "@stdlib/assert-is-error": "^0.1.0",
46
- "@stdlib/types": "^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"
50
- },
51
- "devDependencies": {
52
- "@stdlib/array-complex64": "^0.0.6",
53
- "@stdlib/assert-is-browser": "^0.1.0",
54
- "@stdlib/bench": "^0.1.0",
55
- "@stdlib/blas-base-scopy": "^0.1.0",
56
- "@stdlib/math-base-assert-is-nan": "^0.1.0",
57
- "@stdlib/math-base-special-floor": "^0.1.0",
58
- "@stdlib/math-base-special-pow": "^0.1.0",
59
- "@stdlib/random-base-discrete-uniform": "^0.0.6",
60
- "@stdlib/random-base-randu": "^0.0.8",
61
- "proxyquire": "^2.0.0",
62
- "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
63
- "istanbul": "^0.4.1",
64
- "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
37
+ "@stdlib/assert-is-error": "^0.2.1",
38
+ "@stdlib/napi-argv": "^0.2.1",
39
+ "@stdlib/napi-argv-int64": "^0.2.1",
40
+ "@stdlib/napi-argv-strided-complex64array": "^0.2.1",
41
+ "@stdlib/napi-export": "^0.2.1",
42
+ "@stdlib/strided-base-reinterpret-complex64": "^0.2.0",
43
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1",
44
+ "@stdlib/utils-library-manifest": "^0.2.1",
45
+ "@stdlib/utils-try-require": "^0.2.1"
65
46
  },
47
+ "devDependencies": {},
66
48
  "engines": {
67
49
  "node": ">=0.10.0",
68
50
  "npm": ">2.7.0"
@@ -103,6 +85,9 @@
103
85
  "single",
104
86
  "float32array"
105
87
  ],
88
+ "__stdlib__": {
89
+ "wasm": false
90
+ },
106
91
  "funding": {
107
92
  "type": "opencollective",
108
93
  "url": "https://opencollective.com/stdlib"
package/src/addon.c ADDED
@@ -0,0 +1,45 @@
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
+ #include "stdlib/blas/base/cswap.h"
20
+ #include "stdlib/napi/export.h"
21
+ #include "stdlib/napi/argv.h"
22
+ #include "stdlib/napi/argv_int64.h"
23
+ #include "stdlib/napi/argv_strided_complex64array.h"
24
+ #include <node_api.h>
25
+
26
+ /**
27
+ * Receives JavaScript callback invocation data.
28
+ *
29
+ * @private
30
+ * @param env environment under which the function is invoked
31
+ * @param info callback data
32
+ * @return Node-API value
33
+ */
34
+ static napi_value addon( napi_env env, napi_callback_info info ) {
35
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 5 );
36
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
37
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
38
+ STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 );
39
+ STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 );
40
+ STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 3 );
41
+ c_cswap( N, (void *)X, strideX, (void *)Y, strideY );
42
+ return NULL;
43
+ }
44
+
45
+ STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
package/CITATION.cff DELETED
@@ -1,30 +0,0 @@
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/src/addon.cpp DELETED
@@ -1,151 +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
- #include "stdlib/blas/base/cswap.h"
20
- #include <node_api.h>
21
- #include <stdint.h>
22
- #include <stdlib.h>
23
- #include <stdbool.h>
24
- #include <assert.h>
25
-
26
- /**
27
- * Add-on namespace.
28
- */
29
- namespace stdlib_blas_base_cswap {
30
-
31
- /**
32
- * Interchanges two complex single-precision floating-point vectors.
33
- *
34
- * ## Notes
35
- *
36
- * - When called from JavaScript, the function expects five arguments:
37
- *
38
- * - `N`: number of indexed elements
39
- * - `X`: first input array
40
- * - `strideX`: `X` stride length
41
- * - `Y`: second input array
42
- * - `strideY`: `Y` stride length
43
- */
44
- napi_value node_cswap( napi_env env, napi_callback_info info ) {
45
- napi_status status;
46
-
47
- size_t argc = 5;
48
- napi_value argv[ 5 ];
49
- status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr );
50
- assert( status == napi_ok );
51
-
52
- if ( argc < 5 ) {
53
- napi_throw_error( env, nullptr, "invalid invocation. Must provide 5 arguments." );
54
- return nullptr;
55
- }
56
-
57
- napi_valuetype vtype0;
58
- status = napi_typeof( env, argv[ 0 ], &vtype0 );
59
- assert( status == napi_ok );
60
- if ( vtype0 != napi_number ) {
61
- napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." );
62
- return nullptr;
63
- }
64
-
65
- bool res1;
66
- status = napi_is_typedarray( env, argv[ 1 ], &res1 );
67
- assert( status == napi_ok );
68
- if ( res1 == false ) {
69
- napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." );
70
- return nullptr;
71
- }
72
-
73
- napi_valuetype vtype2;
74
- status = napi_typeof( env, argv[ 2 ], &vtype2 );
75
- assert( status == napi_ok );
76
- if ( vtype2 != napi_number ) {
77
- napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a number." );
78
- return nullptr;
79
- }
80
-
81
- bool res3;
82
- status = napi_is_typedarray( env, argv[ 3 ], &res3 );
83
- assert( status == napi_ok );
84
- if ( res3 == false ) {
85
- napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a Float32Array." );
86
- return nullptr;
87
- }
88
-
89
- napi_valuetype vtype4;
90
- status = napi_typeof( env, argv[ 4 ], &vtype4 );
91
- assert( status == napi_ok );
92
- if ( vtype4 != napi_number ) {
93
- napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a number." );
94
- return nullptr;
95
- }
96
-
97
- int64_t N;
98
- status = napi_get_value_int64( env, argv[ 0 ], &N );
99
- assert( status == napi_ok );
100
-
101
- int64_t strideX;
102
- status = napi_get_value_int64( env, argv[ 2 ], &strideX );
103
- assert( status == napi_ok );
104
-
105
- int64_t strideY;
106
- status = napi_get_value_int64( env, argv[ 4 ], &strideY );
107
- assert( status == napi_ok );
108
-
109
- napi_typedarray_type vtype1;
110
- size_t xlen;
111
- void *X;
112
- status = napi_get_typedarray_info( env, argv[ 1 ], &vtype1, &xlen, &X, nullptr, nullptr );
113
- assert( status == napi_ok );
114
- if ( vtype1 != napi_float32_array ) {
115
- napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." );
116
- return nullptr;
117
- }
118
- if ( 2*(N-1)*llabs(strideX) >= (int64_t)xlen ) {
119
- napi_throw_range_error( env, nullptr, "invalid argument. Second argument has insufficient elements based on the associated stride and the number of indexed elements." );
120
- return nullptr;
121
- }
122
-
123
- napi_typedarray_type vtype3;
124
- size_t ylen;
125
- void *Y;
126
- status = napi_get_typedarray_info( env, argv[ 3 ], &vtype3, &ylen, &Y, nullptr, nullptr );
127
- assert( status == napi_ok );
128
- if ( vtype3 != napi_float32_array ) {
129
- napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a Float32Array." );
130
- return nullptr;
131
- }
132
- if ( 2*(N-1)*llabs(strideY) >= (int64_t)ylen ) {
133
- napi_throw_range_error( env, nullptr, "invalid argument. Fourth argument has insufficient elements based on the associated stride and the number of indexed elements." );
134
- return nullptr;
135
- }
136
-
137
- c_cswap( N, X, strideX, Y, strideY );
138
-
139
- return nullptr;
140
- }
141
-
142
- napi_value Init( napi_env env, napi_value exports ) {
143
- napi_status status;
144
- napi_value fcn;
145
- status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_cswap, NULL, &fcn );
146
- assert( status == napi_ok );
147
- return fcn;
148
- }
149
-
150
- NAPI_MODULE( NODE_GYP_MODULE_NAME, Init )
151
- } // end namespace stdlib_blas_base_cswap