@stdlib/blas-base-cswap 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +43 -108
- package/dist/index.js +7 -7
- package/dist/index.js.map +4 -4
- package/docs/types/index.d.ts +12 -84
- package/include/stdlib/blas/base/cswap.h +8 -3
- package/include/stdlib/blas/base/cswap_cblas.h +3 -3
- package/include/stdlib/blas/base/cswap_fortran.h +3 -3
- package/lib/cswap.js +8 -75
- package/lib/cswap.native.js +3 -21
- package/lib/index.js +6 -42
- package/lib/ndarray.js +3 -21
- package/lib/ndarray.native.js +6 -32
- package/manifest.json +64 -26
- package/package.json +9 -9
- package/src/addon.c +21 -1
- package/src/cswap.c +4 -47
- package/src/cswap_cblas.c +22 -0
- package/src/cswap_f.c +22 -0
- package/src/cswap_ndarray.c +63 -0
package/lib/cswap.native.js
CHANGED
|
@@ -38,31 +38,13 @@ var addon = require( './../src/addon.node' );
|
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
41
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
42
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
43
41
|
*
|
|
44
42
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
45
|
-
* var y = new Complex64Array( [
|
|
43
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
46
44
|
*
|
|
47
45
|
* cswap( x.length, x, 1, y, 1 );
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* // returns <Complex64>
|
|
51
|
-
*
|
|
52
|
-
* var re = realf( z );
|
|
53
|
-
* // returns 1.0
|
|
54
|
-
*
|
|
55
|
-
* var im = imagf( z );
|
|
56
|
-
* // returns 2.0
|
|
57
|
-
*
|
|
58
|
-
* z = x.get( 0 );
|
|
59
|
-
* // returns <Complex64>
|
|
60
|
-
*
|
|
61
|
-
* re = realf( z );
|
|
62
|
-
* // returns 7.0
|
|
63
|
-
*
|
|
64
|
-
* im = imagf( z );
|
|
65
|
-
* // returns 8.0
|
|
46
|
+
* // x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
47
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
66
48
|
*/
|
|
67
49
|
function cswap( N, x, strideX, y, strideY ) {
|
|
68
50
|
var viewX = reinterpret( x, 0 );
|
package/lib/index.js
CHANGED
|
@@ -25,61 +25,25 @@
|
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
28
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
29
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
30
28
|
* var cswap = require( '@stdlib/blas-base-cswap' );
|
|
31
29
|
*
|
|
32
30
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
33
|
-
* var y = new Complex64Array( [
|
|
31
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
34
32
|
*
|
|
35
33
|
* cswap( x.length, x, 1, y, 1 );
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* // returns <Complex64>
|
|
39
|
-
*
|
|
40
|
-
* var re = realf( z );
|
|
41
|
-
* // returns 1.0
|
|
42
|
-
*
|
|
43
|
-
* var im = imagf( z );
|
|
44
|
-
* // returns 2.0
|
|
45
|
-
*
|
|
46
|
-
* z = x.get( 0 );
|
|
47
|
-
* // returns <Complex64>
|
|
48
|
-
*
|
|
49
|
-
* re = realf( z );
|
|
50
|
-
* // returns 7.0
|
|
51
|
-
*
|
|
52
|
-
* im = imagf( z );
|
|
53
|
-
* // returns 8.0
|
|
34
|
+
* // x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
35
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
54
36
|
*
|
|
55
37
|
* @example
|
|
56
38
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
57
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
58
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
59
39
|
* var cswap = require( '@stdlib/blas-base-cswap' );
|
|
60
40
|
*
|
|
61
41
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
62
|
-
* var y = new Complex64Array( [
|
|
42
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
63
43
|
*
|
|
64
44
|
* cswap.ndarray( x.length, x, 1, 0, y, 1, 0 );
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* // returns <Complex64>
|
|
68
|
-
*
|
|
69
|
-
* var re = realf( z );
|
|
70
|
-
* // returns 1.0
|
|
71
|
-
*
|
|
72
|
-
* var im = imagf( z );
|
|
73
|
-
* // returns 2.0
|
|
74
|
-
*
|
|
75
|
-
* z = x.get( 0 );
|
|
76
|
-
* // returns <Complex64>
|
|
77
|
-
*
|
|
78
|
-
* re = realf( z );
|
|
79
|
-
* // returns 7.0
|
|
80
|
-
*
|
|
81
|
-
* im = imagf( z );
|
|
82
|
-
* // returns 8.0
|
|
45
|
+
* // x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
46
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
83
47
|
*/
|
|
84
48
|
|
|
85
49
|
// MODULES //
|
package/lib/ndarray.js
CHANGED
|
@@ -39,31 +39,13 @@ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
42
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
43
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
44
42
|
*
|
|
45
43
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
46
|
-
* var y = new Complex64Array( [
|
|
44
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
47
45
|
*
|
|
48
46
|
* cswap( x.length, x, 1, 0, y, 1, 0 );
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* // returns <Complex64>
|
|
52
|
-
*
|
|
53
|
-
* var re = realf( z );
|
|
54
|
-
* // returns 1.0
|
|
55
|
-
*
|
|
56
|
-
* var im = imagf( z );
|
|
57
|
-
* // returns 2.0
|
|
58
|
-
*
|
|
59
|
-
* z = x.get( 0 );
|
|
60
|
-
* // returns <Complex64>
|
|
61
|
-
*
|
|
62
|
-
* re = realf( z );
|
|
63
|
-
* // returns 7.0
|
|
64
|
-
*
|
|
65
|
-
* im = imagf( z );
|
|
66
|
-
* // returns 8.0
|
|
47
|
+
* // x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
48
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
67
49
|
*/
|
|
68
50
|
function cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
|
|
69
51
|
var viewX;
|
package/lib/ndarray.native.js
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
23
|
var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
24
|
-
var minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
|
|
25
24
|
var addon = require( './../src/addon.node' );
|
|
26
25
|
|
|
27
26
|
|
|
@@ -41,43 +40,18 @@ var addon = require( './../src/addon.node' );
|
|
|
41
40
|
*
|
|
42
41
|
* @example
|
|
43
42
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
44
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
45
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
46
43
|
*
|
|
47
44
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
48
|
-
* var y = new Complex64Array( [
|
|
45
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
49
46
|
*
|
|
50
47
|
* cswap( x.length, x, 1, 0, y, 1, 0 );
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* // returns <Complex64>
|
|
54
|
-
*
|
|
55
|
-
* var re = realf( z );
|
|
56
|
-
* // returns 1.0
|
|
57
|
-
*
|
|
58
|
-
* var im = imagf( z );
|
|
59
|
-
* // returns 2.0
|
|
60
|
-
*
|
|
61
|
-
* z = x.get( 0 );
|
|
62
|
-
* // returns <Complex64>
|
|
63
|
-
*
|
|
64
|
-
* re = realf( z );
|
|
65
|
-
* // returns 7.0
|
|
66
|
-
*
|
|
67
|
-
* im = imagf( z );
|
|
68
|
-
* // returns 8.0
|
|
48
|
+
* // x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
49
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
69
50
|
*/
|
|
70
51
|
function cswap( N, x, strideX, offsetX, y, strideY, offsetY ) {
|
|
71
|
-
var viewX;
|
|
72
|
-
var viewY;
|
|
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
|
-
addon( N, viewX, strideX, viewY, strideY );
|
|
52
|
+
var viewX = reinterpret( x, 0 );
|
|
53
|
+
var viewY = reinterpret( y, 0 );
|
|
54
|
+
addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY );
|
|
81
55
|
return y;
|
|
82
56
|
}
|
|
83
57
|
|
package/manifest.json
CHANGED
|
@@ -45,9 +45,11 @@
|
|
|
45
45
|
"dependencies": [
|
|
46
46
|
"@stdlib/napi-export",
|
|
47
47
|
"@stdlib/napi-argv",
|
|
48
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
48
49
|
"@stdlib/napi-argv-int64",
|
|
49
50
|
"@stdlib/napi-argv-strided-complex64array",
|
|
50
|
-
"@stdlib/blas-base-shared"
|
|
51
|
+
"@stdlib/blas-base-shared",
|
|
52
|
+
"@stdlib/complex-float32-ctor"
|
|
51
53
|
]
|
|
52
54
|
},
|
|
53
55
|
{
|
|
@@ -56,7 +58,8 @@
|
|
|
56
58
|
"blas": "",
|
|
57
59
|
"wasm": false,
|
|
58
60
|
"src": [
|
|
59
|
-
"./src/cswap.c"
|
|
61
|
+
"./src/cswap.c",
|
|
62
|
+
"./src/cswap_ndarray.c"
|
|
60
63
|
],
|
|
61
64
|
"include": [
|
|
62
65
|
"./include"
|
|
@@ -64,7 +67,8 @@
|
|
|
64
67
|
"libraries": [],
|
|
65
68
|
"libpath": [],
|
|
66
69
|
"dependencies": [
|
|
67
|
-
"@stdlib/blas-base-shared"
|
|
70
|
+
"@stdlib/blas-base-shared",
|
|
71
|
+
"@stdlib/strided-base-stride2offset"
|
|
68
72
|
]
|
|
69
73
|
},
|
|
70
74
|
{
|
|
@@ -73,7 +77,8 @@
|
|
|
73
77
|
"blas": "",
|
|
74
78
|
"wasm": false,
|
|
75
79
|
"src": [
|
|
76
|
-
"./src/cswap.c"
|
|
80
|
+
"./src/cswap.c",
|
|
81
|
+
"./src/cswap_ndarray.c"
|
|
77
82
|
],
|
|
78
83
|
"include": [
|
|
79
84
|
"./include"
|
|
@@ -81,7 +86,8 @@
|
|
|
81
86
|
"libraries": [],
|
|
82
87
|
"libpath": [],
|
|
83
88
|
"dependencies": [
|
|
84
|
-
"@stdlib/blas-base-shared"
|
|
89
|
+
"@stdlib/blas-base-shared",
|
|
90
|
+
"@stdlib/strided-base-stride2offset"
|
|
85
91
|
]
|
|
86
92
|
},
|
|
87
93
|
|
|
@@ -104,9 +110,11 @@
|
|
|
104
110
|
"dependencies": [
|
|
105
111
|
"@stdlib/napi-export",
|
|
106
112
|
"@stdlib/napi-argv",
|
|
113
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
107
114
|
"@stdlib/napi-argv-int64",
|
|
108
115
|
"@stdlib/napi-argv-strided-complex64array",
|
|
109
|
-
"@stdlib/blas-base-shared"
|
|
116
|
+
"@stdlib/blas-base-shared",
|
|
117
|
+
"@stdlib/complex-float32-ctor"
|
|
110
118
|
]
|
|
111
119
|
},
|
|
112
120
|
{
|
|
@@ -126,7 +134,9 @@
|
|
|
126
134
|
],
|
|
127
135
|
"libpath": [],
|
|
128
136
|
"dependencies": [
|
|
129
|
-
"@stdlib/blas-base-shared"
|
|
137
|
+
"@stdlib/blas-base-shared",
|
|
138
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
139
|
+
"@stdlib/complex-float32-ctor"
|
|
130
140
|
]
|
|
131
141
|
},
|
|
132
142
|
{
|
|
@@ -146,7 +156,9 @@
|
|
|
146
156
|
],
|
|
147
157
|
"libpath": [],
|
|
148
158
|
"dependencies": [
|
|
149
|
-
"@stdlib/blas-base-shared"
|
|
159
|
+
"@stdlib/blas-base-shared",
|
|
160
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
161
|
+
"@stdlib/complex-float32-ctor"
|
|
150
162
|
]
|
|
151
163
|
},
|
|
152
164
|
|
|
@@ -167,9 +179,11 @@
|
|
|
167
179
|
"dependencies": [
|
|
168
180
|
"@stdlib/napi-export",
|
|
169
181
|
"@stdlib/napi-argv",
|
|
182
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
170
183
|
"@stdlib/napi-argv-int64",
|
|
171
184
|
"@stdlib/napi-argv-strided-complex64array",
|
|
172
|
-
"@stdlib/blas-base-shared"
|
|
185
|
+
"@stdlib/blas-base-shared",
|
|
186
|
+
"@stdlib/complex-float32-ctor"
|
|
173
187
|
]
|
|
174
188
|
},
|
|
175
189
|
{
|
|
@@ -178,7 +192,8 @@
|
|
|
178
192
|
"blas": "",
|
|
179
193
|
"wasm": false,
|
|
180
194
|
"src": [
|
|
181
|
-
"./src/cswap.c"
|
|
195
|
+
"./src/cswap.c",
|
|
196
|
+
"./src/cswap_ndarray.c"
|
|
182
197
|
],
|
|
183
198
|
"include": [
|
|
184
199
|
"./include"
|
|
@@ -186,7 +201,8 @@
|
|
|
186
201
|
"libraries": [],
|
|
187
202
|
"libpath": [],
|
|
188
203
|
"dependencies": [
|
|
189
|
-
"@stdlib/blas-base-shared"
|
|
204
|
+
"@stdlib/blas-base-shared",
|
|
205
|
+
"@stdlib/strided-base-stride2offset"
|
|
190
206
|
]
|
|
191
207
|
},
|
|
192
208
|
{
|
|
@@ -195,7 +211,8 @@
|
|
|
195
211
|
"blas": "",
|
|
196
212
|
"wasm": false,
|
|
197
213
|
"src": [
|
|
198
|
-
"./src/cswap.c"
|
|
214
|
+
"./src/cswap.c",
|
|
215
|
+
"./src/cswap_ndarray.c"
|
|
199
216
|
],
|
|
200
217
|
"include": [
|
|
201
218
|
"./include"
|
|
@@ -203,7 +220,8 @@
|
|
|
203
220
|
"libraries": [],
|
|
204
221
|
"libpath": [],
|
|
205
222
|
"dependencies": [
|
|
206
|
-
"@stdlib/blas-base-shared"
|
|
223
|
+
"@stdlib/blas-base-shared",
|
|
224
|
+
"@stdlib/strided-base-stride2offset"
|
|
207
225
|
]
|
|
208
226
|
},
|
|
209
227
|
|
|
@@ -225,9 +243,11 @@
|
|
|
225
243
|
"dependencies": [
|
|
226
244
|
"@stdlib/napi-export",
|
|
227
245
|
"@stdlib/napi-argv",
|
|
246
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
228
247
|
"@stdlib/napi-argv-int64",
|
|
229
248
|
"@stdlib/napi-argv-strided-complex64array",
|
|
230
|
-
"@stdlib/blas-base-shared"
|
|
249
|
+
"@stdlib/blas-base-shared",
|
|
250
|
+
"@stdlib/complex-float32-ctor"
|
|
231
251
|
]
|
|
232
252
|
},
|
|
233
253
|
{
|
|
@@ -246,7 +266,9 @@
|
|
|
246
266
|
],
|
|
247
267
|
"libpath": [],
|
|
248
268
|
"dependencies": [
|
|
249
|
-
"@stdlib/blas-base-shared"
|
|
269
|
+
"@stdlib/blas-base-shared",
|
|
270
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
271
|
+
"@stdlib/complex-float32-ctor"
|
|
250
272
|
]
|
|
251
273
|
},
|
|
252
274
|
{
|
|
@@ -265,7 +287,9 @@
|
|
|
265
287
|
],
|
|
266
288
|
"libpath": [],
|
|
267
289
|
"dependencies": [
|
|
268
|
-
"@stdlib/blas-base-shared"
|
|
290
|
+
"@stdlib/blas-base-shared",
|
|
291
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
292
|
+
"@stdlib/complex-float32-ctor"
|
|
269
293
|
]
|
|
270
294
|
},
|
|
271
295
|
|
|
@@ -288,9 +312,11 @@
|
|
|
288
312
|
"dependencies": [
|
|
289
313
|
"@stdlib/napi-export",
|
|
290
314
|
"@stdlib/napi-argv",
|
|
315
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
291
316
|
"@stdlib/napi-argv-int64",
|
|
292
317
|
"@stdlib/napi-argv-strided-complex64array",
|
|
293
|
-
"@stdlib/blas-base-shared"
|
|
318
|
+
"@stdlib/blas-base-shared",
|
|
319
|
+
"@stdlib/complex-float32-ctor"
|
|
294
320
|
]
|
|
295
321
|
},
|
|
296
322
|
{
|
|
@@ -310,7 +336,9 @@
|
|
|
310
336
|
],
|
|
311
337
|
"libpath": [],
|
|
312
338
|
"dependencies": [
|
|
313
|
-
"@stdlib/blas-base-shared"
|
|
339
|
+
"@stdlib/blas-base-shared",
|
|
340
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
341
|
+
"@stdlib/complex-float32-ctor"
|
|
314
342
|
]
|
|
315
343
|
},
|
|
316
344
|
{
|
|
@@ -330,7 +358,9 @@
|
|
|
330
358
|
],
|
|
331
359
|
"libpath": [],
|
|
332
360
|
"dependencies": [
|
|
333
|
-
"@stdlib/blas-base-shared"
|
|
361
|
+
"@stdlib/blas-base-shared",
|
|
362
|
+
"@stdlib/strided-base-min-view-buffer-index",
|
|
363
|
+
"@stdlib/complex-float32-ctor"
|
|
334
364
|
]
|
|
335
365
|
},
|
|
336
366
|
|
|
@@ -340,7 +370,8 @@
|
|
|
340
370
|
"blas": "",
|
|
341
371
|
"wasm": false,
|
|
342
372
|
"src": [
|
|
343
|
-
"./src/cswap.c"
|
|
373
|
+
"./src/cswap.c",
|
|
374
|
+
"./src/cswap_ndarray.c"
|
|
344
375
|
],
|
|
345
376
|
"include": [
|
|
346
377
|
"./include"
|
|
@@ -350,6 +381,7 @@
|
|
|
350
381
|
"dependencies": [
|
|
351
382
|
"@stdlib/napi-export",
|
|
352
383
|
"@stdlib/napi-argv",
|
|
384
|
+
"@stdlib/strided-base-stride2offset",
|
|
353
385
|
"@stdlib/napi-argv-int64",
|
|
354
386
|
"@stdlib/napi-argv-strided-complex64array",
|
|
355
387
|
"@stdlib/blas-base-shared"
|
|
@@ -361,7 +393,8 @@
|
|
|
361
393
|
"blas": "",
|
|
362
394
|
"wasm": false,
|
|
363
395
|
"src": [
|
|
364
|
-
"./src/cswap.c"
|
|
396
|
+
"./src/cswap.c",
|
|
397
|
+
"./src/cswap_ndarray.c"
|
|
365
398
|
],
|
|
366
399
|
"include": [
|
|
367
400
|
"./include"
|
|
@@ -369,7 +402,8 @@
|
|
|
369
402
|
"libraries": [],
|
|
370
403
|
"libpath": [],
|
|
371
404
|
"dependencies": [
|
|
372
|
-
"@stdlib/blas-base-shared"
|
|
405
|
+
"@stdlib/blas-base-shared",
|
|
406
|
+
"@stdlib/strided-base-stride2offset"
|
|
373
407
|
]
|
|
374
408
|
},
|
|
375
409
|
{
|
|
@@ -378,7 +412,8 @@
|
|
|
378
412
|
"blas": "",
|
|
379
413
|
"wasm": false,
|
|
380
414
|
"src": [
|
|
381
|
-
"./src/cswap.c"
|
|
415
|
+
"./src/cswap.c",
|
|
416
|
+
"./src/cswap_ndarray.c"
|
|
382
417
|
],
|
|
383
418
|
"include": [
|
|
384
419
|
"./include"
|
|
@@ -386,7 +421,8 @@
|
|
|
386
421
|
"libraries": [],
|
|
387
422
|
"libpath": [],
|
|
388
423
|
"dependencies": [
|
|
389
|
-
"@stdlib/blas-base-shared"
|
|
424
|
+
"@stdlib/blas-base-shared",
|
|
425
|
+
"@stdlib/strided-base-stride2offset"
|
|
390
426
|
]
|
|
391
427
|
},
|
|
392
428
|
|
|
@@ -396,7 +432,8 @@
|
|
|
396
432
|
"blas": "",
|
|
397
433
|
"wasm": true,
|
|
398
434
|
"src": [
|
|
399
|
-
"./src/cswap.c"
|
|
435
|
+
"./src/cswap.c",
|
|
436
|
+
"./src/cswap_ndarray.c"
|
|
400
437
|
],
|
|
401
438
|
"include": [
|
|
402
439
|
"./include"
|
|
@@ -404,7 +441,8 @@
|
|
|
404
441
|
"libraries": [],
|
|
405
442
|
"libpath": [],
|
|
406
443
|
"dependencies": [
|
|
407
|
-
"@stdlib/blas-base-shared"
|
|
444
|
+
"@stdlib/blas-base-shared",
|
|
445
|
+
"@stdlib/strided-base-stride2offset"
|
|
408
446
|
]
|
|
409
447
|
}
|
|
410
448
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-base-cswap",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Interchange two complex single-precision floating-point vectors.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "The Stdlib Authors",
|
|
@@ -35,14 +35,17 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@stdlib/assert-is-error": "^0.2.2",
|
|
38
|
-
"@stdlib/blas-base-shared": "^0.
|
|
38
|
+
"@stdlib/blas-base-shared": "^0.2.0",
|
|
39
|
+
"@stdlib/complex-float32-ctor": "^0.0.2",
|
|
39
40
|
"@stdlib/napi-argv": "^0.2.2",
|
|
40
41
|
"@stdlib/napi-argv-int64": "^0.2.2",
|
|
41
42
|
"@stdlib/napi-argv-strided-complex64array": "^0.2.2",
|
|
42
|
-
"@stdlib/napi-export": "^0.
|
|
43
|
-
"@stdlib/strided-base-
|
|
43
|
+
"@stdlib/napi-export": "^0.3.0",
|
|
44
|
+
"@stdlib/strided-base-min-view-buffer-index": "^0.3.0",
|
|
45
|
+
"@stdlib/strided-base-reinterpret-complex64": "^0.2.1",
|
|
46
|
+
"@stdlib/strided-base-stride2offset": "^0.1.0",
|
|
44
47
|
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
|
|
45
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
48
|
+
"@stdlib/utils-library-manifest": "^0.2.3",
|
|
46
49
|
"@stdlib/utils-try-require": "^0.2.2"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {},
|
|
@@ -86,9 +89,6 @@
|
|
|
86
89
|
"single",
|
|
87
90
|
"float32array"
|
|
88
91
|
],
|
|
89
|
-
"__stdlib__": {
|
|
90
|
-
"wasm": false
|
|
91
|
-
},
|
|
92
92
|
"funding": {
|
|
93
93
|
"type": "opencollective",
|
|
94
94
|
"url": "https://opencollective.com/stdlib"
|
package/src/addon.c
CHANGED
|
@@ -42,4 +42,24 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
|
|
|
42
42
|
return NULL;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Receives JavaScript callback invocation data.
|
|
47
|
+
*
|
|
48
|
+
* @param env environment under which the function is invoked
|
|
49
|
+
* @param info callback data
|
|
50
|
+
* @return Node-API value
|
|
51
|
+
*/
|
|
52
|
+
static napi_value addon_method( napi_env env, napi_callback_info info ) {
|
|
53
|
+
STDLIB_NAPI_ARGV( env, info, argv, argc, 7 );
|
|
54
|
+
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
|
|
55
|
+
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
|
|
56
|
+
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
|
|
57
|
+
STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 );
|
|
58
|
+
STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 );
|
|
59
|
+
STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 );
|
|
60
|
+
STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 4 );
|
|
61
|
+
API_SUFFIX(c_cswap_ndarray)( N, (void *)X, strideX, offsetX, (void *)Y, strideY, offsetY );
|
|
62
|
+
return NULL;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
|
package/src/cswap.c
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
#include "stdlib/blas/base/cswap.h"
|
|
20
20
|
#include "stdlib/blas/base/shared.h"
|
|
21
|
+
#include "stdlib/strided/base/stride2offset.h"
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Interchanges two complex single-precision floating-point vectors.
|
|
@@ -29,51 +30,7 @@
|
|
|
29
30
|
* @param strideY Y stride length
|
|
30
31
|
*/
|
|
31
32
|
void API_SUFFIX(c_cswap)( const CBLAS_INT N, void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
CBLAS_INT ix;
|
|
36
|
-
CBLAS_INT iy;
|
|
37
|
-
CBLAS_INT i;
|
|
38
|
-
CBLAS_INT j;
|
|
39
|
-
|
|
40
|
-
if ( N <= 0 ) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if ( strideX == 1 && strideY == 1 ) {
|
|
44
|
-
for ( i = 0; i < N*2; i += 2 ) {
|
|
45
|
-
tmp = x[ i ];
|
|
46
|
-
x[ i ] = y[ i ];
|
|
47
|
-
y[ i ] = tmp;
|
|
48
|
-
|
|
49
|
-
j = i + 1;
|
|
50
|
-
tmp = x[ j ];
|
|
51
|
-
x[ j ] = y[ j ];
|
|
52
|
-
y[ j ] = tmp;
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if ( strideX < 0 ) {
|
|
57
|
-
ix = 2 * (1-N) * strideX;
|
|
58
|
-
} else {
|
|
59
|
-
ix = 0;
|
|
60
|
-
}
|
|
61
|
-
if ( strideY < 0 ) {
|
|
62
|
-
iy = 2 * (1-N) * strideY;
|
|
63
|
-
} else {
|
|
64
|
-
iy = 0;
|
|
65
|
-
}
|
|
66
|
-
for ( i = 0; i < N; i++ ) {
|
|
67
|
-
tmp = x[ ix ];
|
|
68
|
-
x[ ix ] = y[ iy ];
|
|
69
|
-
y[ iy ] = tmp;
|
|
70
|
-
|
|
71
|
-
tmp = x[ ix+1 ];
|
|
72
|
-
x[ ix+1 ] = y[ iy+1 ];
|
|
73
|
-
y[ iy+1 ] = tmp;
|
|
74
|
-
|
|
75
|
-
ix += strideX * 2;
|
|
76
|
-
iy += strideY * 2;
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
33
|
+
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
|
|
34
|
+
CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY );
|
|
35
|
+
API_SUFFIX(c_cswap_ndarray)( N, X, strideX, ox, Y, strideY, oy );
|
|
79
36
|
}
|
package/src/cswap_cblas.c
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
#include "stdlib/blas/base/cswap.h"
|
|
20
20
|
#include "stdlib/blas/base/cswap_cblas.h"
|
|
21
21
|
#include "stdlib/blas/base/shared.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/strided/base/min_view_buffer_index.h"
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* Interchanges two complex single-precision floating-point vectors.
|
|
@@ -32,3 +34,23 @@
|
|
|
32
34
|
void API_SUFFIX(c_cswap)( const CBLAS_INT N, void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
33
35
|
API_SUFFIX(cblas_cswap)( N, X, strideX, Y, strideY );
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Interchanges two complex single-precision floating-point vectors using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X first input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y second input array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_cswap_ndarray)( const CBLAS_INT N, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
50
|
+
stdlib_complex64_t *x = (stdlib_complex64_t *)X;
|
|
51
|
+
stdlib_complex64_t *y = (stdlib_complex64_t *)Y;
|
|
52
|
+
|
|
53
|
+
x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer
|
|
54
|
+
y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); // adjust array pointer
|
|
55
|
+
API_SUFFIX(cblas_cswap)( N, (void *)x, strideX, (void *)y, strideY );
|
|
56
|
+
}
|
package/src/cswap_f.c
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
#include "stdlib/blas/base/cswap.h"
|
|
20
20
|
#include "stdlib/blas/base/cswap_fortran.h"
|
|
21
21
|
#include "stdlib/blas/base/shared.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/strided/base/min_view_buffer_index.h"
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* Interchanges two complex single-precision floating-point vectors.
|
|
@@ -32,3 +34,23 @@
|
|
|
32
34
|
void API_SUFFIX(c_cswap)( const CBLAS_INT N, void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
33
35
|
cswap( &N, X, &strideX, Y, &strideY );
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Interchanges two complex single-precision floating-point vectors using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X first input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y second input array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_cswap_ndarray)( const CBLAS_INT N, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
50
|
+
stdlib_complex64_t *x = (stdlib_complex64_t *)X;
|
|
51
|
+
stdlib_complex64_t *y = (stdlib_complex64_t *)Y;
|
|
52
|
+
|
|
53
|
+
x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX );
|
|
54
|
+
y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY );
|
|
55
|
+
cswap( &N, (void *)x, &strideX, (void *)y, &strideY );
|
|
56
|
+
}
|