@stdlib/blas-base-ccopy 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 +45 -62
- package/dist/index.js +7 -7
- package/dist/index.js.map +4 -4
- package/docs/types/index.d.ts +8 -48
- package/include/stdlib/blas/base/ccopy.h +8 -3
- package/include/stdlib/blas/base/ccopy_cblas.h +3 -3
- package/include/stdlib/blas/base/ccopy_fortran.h +3 -3
- package/lib/ccopy.js +7 -52
- package/lib/ccopy.native.js +2 -12
- package/lib/index.js +4 -24
- package/lib/ndarray.js +2 -12
- package/lib/ndarray.native.js +5 -23
- package/manifest.json +65 -27
- package/package.json +8 -8
- package/src/addon.c +21 -1
- package/src/ccopy.c +5 -34
- package/src/ccopy.f +8 -8
- package/src/ccopy_cblas.c +23 -0
- package/src/ccopy_f.c +23 -0
- package/src/ccopy_ndarray.c +56 -0
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -59,22 +59,12 @@ Copies values from `x` into `y`.
|
|
|
59
59
|
|
|
60
60
|
```javascript
|
|
61
61
|
var Complex64Array = require( '@stdlib/array-complex64' );
|
|
62
|
-
var realf = require( '@stdlib/complex-float32-real' );
|
|
63
|
-
var imagf = require( '@stdlib/complex-float32-imag' );
|
|
64
62
|
|
|
65
63
|
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
66
64
|
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
67
65
|
|
|
68
66
|
ccopy( x.length, x, 1, y, 1 );
|
|
69
|
-
|
|
70
|
-
var z = y.get( 0 );
|
|
71
|
-
// returns <Complex64>
|
|
72
|
-
|
|
73
|
-
var re = realf( z );
|
|
74
|
-
// returns 1.0
|
|
75
|
-
|
|
76
|
-
var im = imagf( z );
|
|
77
|
-
// returns 2.0
|
|
67
|
+
// y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
78
68
|
```
|
|
79
69
|
|
|
80
70
|
The function has the following parameters:
|
|
@@ -89,22 +79,12 @@ The `N` and stride parameters determine how values from `x` are copied into `y`.
|
|
|
89
79
|
|
|
90
80
|
```javascript
|
|
91
81
|
var Complex64Array = require( '@stdlib/array-complex64' );
|
|
92
|
-
var realf = require( '@stdlib/complex-float32-real' );
|
|
93
|
-
var imagf = require( '@stdlib/complex-float32-imag' );
|
|
94
82
|
|
|
95
83
|
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
|
|
96
84
|
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
97
85
|
|
|
98
86
|
ccopy( 2, x, -2, y, 1 );
|
|
99
|
-
|
|
100
|
-
var z = y.get( 0 );
|
|
101
|
-
// returns <Complex64>
|
|
102
|
-
|
|
103
|
-
var re = realf( z );
|
|
104
|
-
// returns 5.0
|
|
105
|
-
|
|
106
|
-
var im = imagf( z );
|
|
107
|
-
// returns 6.0
|
|
87
|
+
// y => <Complex64Array>[ 5.0, 6.0, 1.0, 2.0, 0.0, 0.0, 0.0, 0.0 ]
|
|
108
88
|
```
|
|
109
89
|
|
|
110
90
|
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
|
|
@@ -113,8 +93,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [
|
|
|
113
93
|
|
|
114
94
|
```javascript
|
|
115
95
|
var Complex64Array = require( '@stdlib/array-complex64' );
|
|
116
|
-
var realf = require( '@stdlib/complex-float32-real' );
|
|
117
|
-
var imagf = require( '@stdlib/complex-float32-imag' );
|
|
118
96
|
|
|
119
97
|
// Initial arrays...
|
|
120
98
|
var x0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
|
|
@@ -126,15 +104,7 @@ var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3r
|
|
|
126
104
|
|
|
127
105
|
// Copy in reverse order every other value from `x1` into `y1`...
|
|
128
106
|
ccopy( 2, x1, -2, y1, 1 );
|
|
129
|
-
|
|
130
|
-
var z = y0.get( 2 );
|
|
131
|
-
// returns <Complex64>
|
|
132
|
-
|
|
133
|
-
var re = realf( z );
|
|
134
|
-
// returns 7.0
|
|
135
|
-
|
|
136
|
-
var im = imagf( z );
|
|
137
|
-
// returns 8.0
|
|
107
|
+
// y0 => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 7.0, 8.0, 3.0, 4.0 ]
|
|
138
108
|
```
|
|
139
109
|
|
|
140
110
|
#### ccopy.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )
|
|
@@ -143,22 +113,12 @@ Copies values from `x` into `y` using alternative indexing semantics.
|
|
|
143
113
|
|
|
144
114
|
```javascript
|
|
145
115
|
var Complex64Array = require( '@stdlib/array-complex64' );
|
|
146
|
-
var realf = require( '@stdlib/complex-float32-real' );
|
|
147
|
-
var imagf = require( '@stdlib/complex-float32-imag' );
|
|
148
116
|
|
|
149
117
|
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
150
118
|
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
151
119
|
|
|
152
120
|
ccopy.ndarray( x.length, x, 1, 0, y, 1, 0 );
|
|
153
|
-
|
|
154
|
-
var z = y.get( 0 );
|
|
155
|
-
// returns <Complex64>
|
|
156
|
-
|
|
157
|
-
var re = realf( z );
|
|
158
|
-
// returns 1.0
|
|
159
|
-
|
|
160
|
-
var im = imagf( z );
|
|
161
|
-
// returns 2.0
|
|
121
|
+
// y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
162
122
|
```
|
|
163
123
|
|
|
164
124
|
The function has the following additional parameters:
|
|
@@ -170,22 +130,12 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
|
|
|
170
130
|
|
|
171
131
|
```javascript
|
|
172
132
|
var Complex64Array = require( '@stdlib/array-complex64' );
|
|
173
|
-
var realf = require( '@stdlib/complex-float32-real' );
|
|
174
|
-
var imagf = require( '@stdlib/complex-float32-imag' );
|
|
175
133
|
|
|
176
134
|
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
|
|
177
135
|
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
178
136
|
|
|
179
137
|
ccopy.ndarray( 2, x, 2, 1, y, -1, y.length-1 );
|
|
180
|
-
|
|
181
|
-
var z = y.get( y.length-1 );
|
|
182
|
-
// returns <Complex64>
|
|
183
|
-
|
|
184
|
-
var re = realf( z );
|
|
185
|
-
// returns 3.0
|
|
186
|
-
|
|
187
|
-
var im = imagf( z );
|
|
188
|
-
// returns 4.0
|
|
138
|
+
// y => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, 7.0, 8.0, 3.0, 4.0 ]
|
|
189
139
|
```
|
|
190
140
|
|
|
191
141
|
</section>
|
|
@@ -268,7 +218,7 @@ Copies values from `X` into `Y`.
|
|
|
268
218
|
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; // interleaved real and imaginary components
|
|
269
219
|
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
270
220
|
|
|
271
|
-
c_ccopy( 2, (void *)x, 1, (void *)
|
|
221
|
+
c_ccopy( 2, (void *)x, 1, (void *)y, 1 );
|
|
272
222
|
```
|
|
273
223
|
|
|
274
224
|
The function accepts the following arguments:
|
|
@@ -283,6 +233,31 @@ The function accepts the following arguments:
|
|
|
283
233
|
void c_ccopy( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
|
|
284
234
|
```
|
|
285
235
|
|
|
236
|
+
#### c_ccopy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY )
|
|
237
|
+
|
|
238
|
+
Copies values from `X` into `Y` using alternative indexing semantics.
|
|
239
|
+
|
|
240
|
+
```c
|
|
241
|
+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; // interleaved real and imaginary components
|
|
242
|
+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
243
|
+
|
|
244
|
+
c_ccopy_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0 );
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The function accepts the following arguments:
|
|
248
|
+
|
|
249
|
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
|
|
250
|
+
- **X**: `[in] void*` input array.
|
|
251
|
+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
|
|
252
|
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
|
|
253
|
+
- **Y**: `[out] void*` output array.
|
|
254
|
+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
|
|
255
|
+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
|
|
256
|
+
|
|
257
|
+
```c
|
|
258
|
+
void c_ccopy_ndarray( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
|
|
259
|
+
```
|
|
260
|
+
|
|
286
261
|
</section>
|
|
287
262
|
|
|
288
263
|
<!-- /.usage -->
|
|
@@ -324,6 +299,14 @@ int main( void ) {
|
|
|
324
299
|
for ( int i = 0; i < N; i++ ) {
|
|
325
300
|
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
|
|
326
301
|
}
|
|
302
|
+
|
|
303
|
+
// Copy elements using alternative indexing semantics:
|
|
304
|
+
c_ccopy_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 );
|
|
305
|
+
|
|
306
|
+
// Print the result:
|
|
307
|
+
for ( int i = 0; i < N; i++ ) {
|
|
308
|
+
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
|
|
309
|
+
}
|
|
327
310
|
}
|
|
328
311
|
```
|
|
329
312
|
|
|
@@ -343,7 +326,7 @@ int main( void ) {
|
|
|
343
326
|
|
|
344
327
|
## See Also
|
|
345
328
|
|
|
346
|
-
- <span class="package-name">[`@stdlib/blas-base/cswap`][@stdlib/blas/base/cswap]</span><span class="delimiter">: </span><span class="description">
|
|
329
|
+
- <span class="package-name">[`@stdlib/blas-base/cswap`][@stdlib/blas/base/cswap]</span><span class="delimiter">: </span><span class="description">interchange two complex single-precision floating-point vectors.</span>
|
|
347
330
|
|
|
348
331
|
</section>
|
|
349
332
|
|
|
@@ -375,7 +358,7 @@ See [LICENSE][stdlib-license].
|
|
|
375
358
|
|
|
376
359
|
## Copyright
|
|
377
360
|
|
|
378
|
-
Copyright © 2016-
|
|
361
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
379
362
|
|
|
380
363
|
</section>
|
|
381
364
|
|
|
@@ -388,8 +371,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
388
371
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas-base-ccopy.svg
|
|
389
372
|
[npm-url]: https://npmjs.org/package/@stdlib/blas-base-ccopy
|
|
390
373
|
|
|
391
|
-
[test-image]: https://github.com/stdlib-js/blas-base-ccopy/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
392
|
-
[test-url]: https://github.com/stdlib-js/blas-base-ccopy/actions/workflows/test.yml?query=branch:v0.
|
|
374
|
+
[test-image]: https://github.com/stdlib-js/blas-base-ccopy/actions/workflows/test.yml/badge.svg?branch=v0.4.0
|
|
375
|
+
[test-url]: https://github.com/stdlib-js/blas-base-ccopy/actions/workflows/test.yml?query=branch:v0.4.0
|
|
393
376
|
|
|
394
377
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas-base-ccopy/main.svg
|
|
395
378
|
[coverage-url]: https://codecov.io/github/stdlib-js/blas-base-ccopy?branch=main
|
|
@@ -401,8 +384,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
401
384
|
|
|
402
385
|
-->
|
|
403
386
|
|
|
404
|
-
[chat-image]: https://img.shields.io/
|
|
405
|
-
[chat-url]: https://
|
|
387
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
388
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
406
389
|
|
|
407
390
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
408
391
|
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
var
|
|
3
|
-
});var
|
|
4
|
-
var
|
|
5
|
-
});var
|
|
6
|
-
var z=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),
|
|
7
|
-
});var B=require("path").join,C=require('@stdlib/utils-try-require/dist'),D=require('@stdlib/assert-is-error/dist'),F=
|
|
1
|
+
"use strict";var p=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var y=p(function(H,m){
|
|
2
|
+
var j=require('@stdlib/strided-base-reinterpret-complex64/dist');function g(r,e,i,u,a,s,n){var o,c,x,d,v,t,q;if(r<=0)return a;for(o=j(e,0),c=j(a,0),x=i*2,d=s*2,v=u*2,t=n*2,q=0;q<r;q++)c[t]=o[v],c[t+1]=o[v+1],v+=x,t+=d;return a}m.exports=g
|
|
3
|
+
});var R=p(function(I,w){
|
|
4
|
+
var l=require('@stdlib/strided-base-stride2offset/dist'),h=y();function k(r,e,i,u,a){var s=l(r,i),n=l(r,a);return h(r,e,i,s,u,a,n)}w.exports=k
|
|
5
|
+
});var O=p(function(J,E){
|
|
6
|
+
var z=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),_=R(),A=y();z(_,"ndarray",A);E.exports=_
|
|
7
|
+
});var B=require("path").join,C=require('@stdlib/utils-try-require/dist'),D=require('@stdlib/assert-is-error/dist'),F=O(),f,b=C(B(__dirname,"./native.js"));D(b)?f=F:f=b;module.exports=f;
|
|
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
|
-
"sources": ["../lib/
|
|
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* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Complex64Array} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {Complex64Array} output array\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,4CAA6C,
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../lib/ndarray.js", "../lib/ccopy.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 reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// MAIN //\n\n/**\n* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Complex64Array} y - output array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Complex64Array} output array\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n*\n* ccopy( x.length, x, 1, 0, y, 1, 0 );\n* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]\n*/\nfunction ccopy( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar viewX;\n\tvar viewY;\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\tviewY[ iy ] = viewX[ ix ];\n\t\tviewY[ iy+1 ] = viewX[ ix+1 ];\n\t\tix += sx;\n\t\tiy += sy;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ccopy;\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 stride2offset = require( '@stdlib/strided-base-stride2offset' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Complex64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Complex64Array} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {Complex64Array} output array\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n*\n* ccopy( x.length, x, 1, y, 1 );\n* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]\n*/\nfunction ccopy( N, x, strideX, y, strideY ) {\n\tvar ox = stride2offset( N, strideX );\n\tvar oy = stride2offset( N, strideY );\n\treturn ndarray( N, x, strideX, ox, y, strideY, oy );\n}\n\n\n// EXPORTS //\n\nmodule.exports = ccopy;\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 ccopy = require( './ccopy.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( ccopy, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = ccopy;\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 copy values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.\n*\n* @module @stdlib/blas-base-ccopy\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var ccopy = require( '@stdlib/blas-base-ccopy' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n*\n* ccopy( x.length, x, 1, y, 1 );\n* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var ccopy = require( '@stdlib/blas-base-ccopy' );\n*\n* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n*\n* ccopy.ndarray( x.length, x, 1, 0, y, 1, 0 );\n* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.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 ccopy;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tccopy = main;\n} else {\n\tccopy = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ccopy;\n\n// exports: { \"ndarray\": \"ccopy.ndarray\" }\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,4CAA6C,EA0BxE,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,GAAKb,GAAK,EACT,OAAOI,EAQR,IANAG,EAAQT,EAAaG,EAAG,CAAE,EAC1BO,EAAQV,EAAaM,EAAG,CAAE,EAC1BK,EAAKP,EAAU,EACfQ,EAAKL,EAAU,EACfM,EAAKR,EAAU,EACfS,EAAKN,EAAU,EACTO,EAAI,EAAGA,EAAIb,EAAGa,IACnBL,EAAOI,CAAG,EAAIL,EAAOI,CAAG,EACxBH,EAAOI,EAAG,CAAE,EAAIL,EAAOI,EAAG,CAAE,EAC5BA,GAAMF,EACNG,GAAMF,EAEP,OAAON,CACR,CAKAP,EAAO,QAAUE,IC9EjB,IAAAe,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAU,IAwBd,SAASC,EAAOC,EAAGC,EAAGC,EAASC,EAAGC,EAAU,CAC3C,IAAIC,EAAKR,EAAeG,EAAGE,CAAQ,EAC/BI,EAAKT,EAAeG,EAAGI,CAAQ,EACnC,OAAON,EAASE,EAAGC,EAAGC,EAASG,EAAIF,EAAGC,EAASE,CAAG,CACnD,CAKAV,EAAO,QAAUG,ICxDjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAQ,IACRC,EAAU,IAKdF,EAAaC,EAAO,UAAWC,CAAQ,EAKvCH,EAAO,QAAUE,ICcjB,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_ndarray", "__commonJSMin", "exports", "module", "reinterpret", "ccopy", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "viewX", "viewY", "sx", "sy", "ix", "iy", "i", "require_ccopy", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "ccopy", "N", "x", "strideX", "y", "strideY", "ox", "oy", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "ccopy", "ndarray", "join", "tryRequire", "isError", "main", "ccopy", "tmp"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -38,22 +38,12 @@ interface Routine {
|
|
|
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
|
* ccopy( x.length, x, 1, y, 1 );
|
|
48
|
-
*
|
|
49
|
-
* var z = y.get( 0 );
|
|
50
|
-
* // returns <Complex64>
|
|
51
|
-
*
|
|
52
|
-
* var re = realf( z );
|
|
53
|
-
* // returns 1.0
|
|
54
|
-
*
|
|
55
|
-
* var im = imagf( z );
|
|
56
|
-
* // returns 2.0
|
|
46
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
57
47
|
*/
|
|
58
48
|
( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64Array;
|
|
59
49
|
|
|
@@ -71,22 +61,12 @@ interface Routine {
|
|
|
71
61
|
*
|
|
72
62
|
* @example
|
|
73
63
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
74
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
75
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
76
64
|
*
|
|
77
65
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
78
|
-
* var y = new Complex64Array( [
|
|
66
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
79
67
|
*
|
|
80
68
|
* ccopy.ndarray( x.length, x, 1, 0, y, 1, 0 );
|
|
81
|
-
*
|
|
82
|
-
* var z = y.get( 0 );
|
|
83
|
-
* // returns <Complex64>
|
|
84
|
-
*
|
|
85
|
-
* var re = realf( z );
|
|
86
|
-
* // returns 1.0
|
|
87
|
-
*
|
|
88
|
-
* var im = imagf( z );
|
|
89
|
-
* // returns 2.0
|
|
69
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
90
70
|
*/
|
|
91
71
|
ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64Array;
|
|
92
72
|
}
|
|
@@ -103,41 +83,21 @@ interface Routine {
|
|
|
103
83
|
*
|
|
104
84
|
* @example
|
|
105
85
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
106
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
107
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
108
86
|
*
|
|
109
87
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
110
|
-
* var y = new Complex64Array( [
|
|
88
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
111
89
|
*
|
|
112
90
|
* ccopy( x.length, x, 1, y, 1 );
|
|
113
|
-
*
|
|
114
|
-
* var z = y.get( 0 );
|
|
115
|
-
* // returns <Complex64>
|
|
116
|
-
*
|
|
117
|
-
* var re = realf( z );
|
|
118
|
-
* // returns 1.0
|
|
119
|
-
*
|
|
120
|
-
* var im = imagf( z );
|
|
121
|
-
* // returns 2.0
|
|
91
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
122
92
|
*
|
|
123
93
|
* @example
|
|
124
94
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
125
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
126
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
127
95
|
*
|
|
128
96
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
129
|
-
* var y = new Complex64Array( [
|
|
97
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
130
98
|
*
|
|
131
99
|
* ccopy.ndarray( x.length, x, 1, 0, y, 1, 0 );
|
|
132
|
-
*
|
|
133
|
-
* var z = y.get( 0 );
|
|
134
|
-
* // returns <Complex64>
|
|
135
|
-
*
|
|
136
|
-
* var re = realf( z );
|
|
137
|
-
* // returns 1.0
|
|
138
|
-
*
|
|
139
|
-
* var im = imagf( z );
|
|
140
|
-
* // returns 2.0
|
|
100
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
141
101
|
*/
|
|
142
102
|
declare var ccopy: Routine;
|
|
143
103
|
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* Header file containing function declarations for the C interface to the BLAS Level 1 routine `ccopy`.
|
|
21
21
|
*/
|
|
22
|
-
#ifndef
|
|
23
|
-
#define
|
|
22
|
+
#ifndef STDLIB_BLAS_BASE_CCOPY_H
|
|
23
|
+
#define STDLIB_BLAS_BASE_CCOPY_H
|
|
24
24
|
|
|
25
25
|
#include "stdlib/blas/base/shared.h"
|
|
26
26
|
|
|
@@ -36,8 +36,13 @@ extern "C" {
|
|
|
36
36
|
*/
|
|
37
37
|
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
41
|
+
*/
|
|
42
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
|
|
43
|
+
|
|
39
44
|
#ifdef __cplusplus
|
|
40
45
|
}
|
|
41
46
|
#endif
|
|
42
47
|
|
|
43
|
-
#endif // !
|
|
48
|
+
#endif // !STDLIB_BLAS_BASE_CCOPY_H
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* Header file containing function declarations for the C interface to the CBLAS Level 1 routine `cblas_ccopy`.
|
|
21
21
|
*/
|
|
22
|
-
#ifndef
|
|
23
|
-
#define
|
|
22
|
+
#ifndef STDLIB_BLAS_BASE_CCOPY_CBLAS_H
|
|
23
|
+
#define STDLIB_BLAS_BASE_CCOPY_CBLAS_H
|
|
24
24
|
|
|
25
25
|
#include "stdlib/blas/base/shared.h"
|
|
26
26
|
|
|
@@ -40,4 +40,4 @@ void API_SUFFIX(cblas_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT
|
|
|
40
40
|
}
|
|
41
41
|
#endif
|
|
42
42
|
|
|
43
|
-
#endif // !
|
|
43
|
+
#endif // !STDLIB_BLAS_BASE_CCOPY_CBLAS_H
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* Header file containing function declarations for the Fortran interface to the BLAS Level 1 routine `ccopy`.
|
|
21
21
|
*/
|
|
22
|
-
#ifndef
|
|
23
|
-
#define
|
|
22
|
+
#ifndef STDLIB_BLAS_BASE_CCOPY_FORTRAN_H
|
|
23
|
+
#define STDLIB_BLAS_BASE_CCOPY_FORTRAN_H
|
|
24
24
|
|
|
25
25
|
/*
|
|
26
26
|
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C/Fortran compiler (a Fortran compiler must be configured to not attach underscores).
|
|
@@ -38,4 +38,4 @@ void ccopy( const CBLAS_INT *, const void *, const CBLAS_INT *, void *, const CB
|
|
|
38
38
|
}
|
|
39
39
|
#endif
|
|
40
40
|
|
|
41
|
-
#endif // !
|
|
41
|
+
#endif // !STDLIB_BLAS_BASE_CCOPY_FORTRAN_H
|
package/lib/ccopy.js
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var stride2offset = require( '@stdlib/strided-base-stride2offset' );
|
|
24
|
+
var ndarray = require( './ndarray.js' );
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
// MAIN //
|
|
@@ -37,63 +38,17 @@ var reinterpret = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
|
37
38
|
*
|
|
38
39
|
* @example
|
|
39
40
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
40
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
41
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
42
41
|
*
|
|
43
42
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
44
|
-
* var y = new Complex64Array( [
|
|
43
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
45
44
|
*
|
|
46
45
|
* ccopy( x.length, x, 1, y, 1 );
|
|
47
|
-
*
|
|
48
|
-
* var z = y.get( 0 );
|
|
49
|
-
* // returns <Complex64>
|
|
50
|
-
*
|
|
51
|
-
* var re = realf( z );
|
|
52
|
-
* // returns 1.0
|
|
53
|
-
*
|
|
54
|
-
* var im = imagf( z );
|
|
55
|
-
* // returns 2.0
|
|
46
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
56
47
|
*/
|
|
57
48
|
function ccopy( N, x, strideX, y, strideY ) {
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
var sy;
|
|
62
|
-
var ix;
|
|
63
|
-
var iy;
|
|
64
|
-
var i;
|
|
65
|
-
|
|
66
|
-
if ( N <= 0 ) {
|
|
67
|
-
return y;
|
|
68
|
-
}
|
|
69
|
-
viewX = reinterpret( x, 0 );
|
|
70
|
-
viewY = reinterpret( y, 0 );
|
|
71
|
-
if ( strideX === 1 && strideY === 1 ) {
|
|
72
|
-
for ( i = 0; i < N*2; i += 2 ) {
|
|
73
|
-
viewY[ i ] = viewX[ i ];
|
|
74
|
-
viewY[ i+1 ] = viewX[ i+1 ];
|
|
75
|
-
}
|
|
76
|
-
return y;
|
|
77
|
-
}
|
|
78
|
-
if ( strideX < 0 ) {
|
|
79
|
-
ix = 2 * (1-N) * strideX;
|
|
80
|
-
} else {
|
|
81
|
-
ix = 0;
|
|
82
|
-
}
|
|
83
|
-
if ( strideY < 0 ) {
|
|
84
|
-
iy = 2 * (1-N) * strideY;
|
|
85
|
-
} else {
|
|
86
|
-
iy = 0;
|
|
87
|
-
}
|
|
88
|
-
sx = strideX * 2;
|
|
89
|
-
sy = strideY * 2;
|
|
90
|
-
for ( i = 0; i < N; i++ ) {
|
|
91
|
-
viewY[ iy ] = viewX[ ix ];
|
|
92
|
-
viewY[ iy+1 ] = viewX[ ix+1 ];
|
|
93
|
-
ix += sx;
|
|
94
|
-
iy += sy;
|
|
95
|
-
}
|
|
96
|
-
return y;
|
|
49
|
+
var ox = stride2offset( N, strideX );
|
|
50
|
+
var oy = stride2offset( N, strideY );
|
|
51
|
+
return ndarray( N, x, strideX, ox, y, strideY, oy );
|
|
97
52
|
}
|
|
98
53
|
|
|
99
54
|
|
package/lib/ccopy.native.js
CHANGED
|
@@ -38,22 +38,12 @@ 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
|
* ccopy( x.length, x, 1, y, 1 );
|
|
48
|
-
*
|
|
49
|
-
* var z = y.get( 0 );
|
|
50
|
-
* // returns <Complex64>
|
|
51
|
-
*
|
|
52
|
-
* var re = realf( z );
|
|
53
|
-
* // returns 1.0
|
|
54
|
-
*
|
|
55
|
-
* var im = imagf( z );
|
|
56
|
-
* // returns 2.0
|
|
46
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
57
47
|
*/
|
|
58
48
|
function ccopy( N, x, strideX, y, strideY ) {
|
|
59
49
|
var viewX = reinterpret( x, 0 );
|
package/lib/index.js
CHANGED
|
@@ -25,43 +25,23 @@
|
|
|
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 ccopy = require( '@stdlib/blas-base-ccopy' );
|
|
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
|
* ccopy( x.length, x, 1, y, 1 );
|
|
36
|
-
*
|
|
37
|
-
* var z = y.get( 0 );
|
|
38
|
-
* // returns <Complex64>
|
|
39
|
-
*
|
|
40
|
-
* var re = realf( z );
|
|
41
|
-
* // returns 1.0
|
|
42
|
-
*
|
|
43
|
-
* var im = imagf( z );
|
|
44
|
-
* // returns 2.0
|
|
34
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
45
35
|
*
|
|
46
36
|
* @example
|
|
47
37
|
* var Complex64Array = require( '@stdlib/array-complex64' );
|
|
48
|
-
* var realf = require( '@stdlib/complex-float32-real' );
|
|
49
|
-
* var imagf = require( '@stdlib/complex-float32-imag' );
|
|
50
38
|
* var ccopy = require( '@stdlib/blas-base-ccopy' );
|
|
51
39
|
*
|
|
52
40
|
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
|
|
53
|
-
* var y = new Complex64Array( [
|
|
41
|
+
* var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
|
|
54
42
|
*
|
|
55
43
|
* ccopy.ndarray( x.length, x, 1, 0, y, 1, 0 );
|
|
56
|
-
*
|
|
57
|
-
* var z = y.get( 0 );
|
|
58
|
-
* // returns <Complex64>
|
|
59
|
-
*
|
|
60
|
-
* var re = realf( z );
|
|
61
|
-
* // returns 1.0
|
|
62
|
-
*
|
|
63
|
-
* var im = imagf( z );
|
|
64
|
-
* // returns 2.0
|
|
44
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
65
45
|
*/
|
|
66
46
|
|
|
67
47
|
// MODULES //
|
package/lib/ndarray.js
CHANGED
|
@@ -39,22 +39,12 @@ 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
|
* ccopy( x.length, x, 1, 0, y, 1, 0 );
|
|
49
|
-
*
|
|
50
|
-
* var z = y.get( 0 );
|
|
51
|
-
* // returns <Complex64>
|
|
52
|
-
*
|
|
53
|
-
* var re = realf( z );
|
|
54
|
-
* // returns 1.0
|
|
55
|
-
*
|
|
56
|
-
* var im = imagf( z );
|
|
57
|
-
* // returns 2.0
|
|
47
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
58
48
|
*/
|
|
59
49
|
function ccopy( N, x, strideX, offsetX, y, strideY, offsetY ) {
|
|
60
50
|
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,34 +40,17 @@ 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
|
* ccopy( x.length, x, 1, 0, y, 1, 0 );
|
|
51
|
-
*
|
|
52
|
-
* var z = y.get( 0 );
|
|
53
|
-
* // returns <Complex64>
|
|
54
|
-
*
|
|
55
|
-
* var re = realf( z );
|
|
56
|
-
* // returns 1.0
|
|
57
|
-
*
|
|
58
|
-
* var im = imagf( z );
|
|
59
|
-
* // returns 2.0
|
|
48
|
+
* // y => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
|
|
60
49
|
*/
|
|
61
50
|
function ccopy( N, x, strideX, offsetX, y, strideY, offsetY ) {
|
|
62
|
-
var viewX;
|
|
63
|
-
var viewY;
|
|
64
|
-
|
|
65
|
-
offsetX = minViewBufferIndex( N, strideX, offsetX );
|
|
66
|
-
offsetY = minViewBufferIndex( N, strideY, offsetY );
|
|
67
|
-
|
|
68
|
-
viewX = reinterpret( x, offsetX );
|
|
69
|
-
viewY = reinterpret( y, offsetY );
|
|
70
|
-
|
|
71
|
-
addon( N, viewX, strideX, viewY, strideY );
|
|
51
|
+
var viewX = reinterpret( x, 0 );
|
|
52
|
+
var viewY = reinterpret( y, 0 );
|
|
53
|
+
addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY );
|
|
72
54
|
return y;
|
|
73
55
|
}
|
|
74
56
|
|
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/ccopy.c"
|
|
61
|
+
"./src/ccopy.c",
|
|
62
|
+
"./src/ccopy_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/ccopy.c"
|
|
80
|
+
"./src/ccopy.c",
|
|
81
|
+
"./src/ccopy_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/ccopy.c"
|
|
195
|
+
"./src/ccopy.c",
|
|
196
|
+
"./src/ccopy_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/ccopy.c"
|
|
214
|
+
"./src/ccopy.c",
|
|
215
|
+
"./src/ccopy_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/ccopy.c"
|
|
373
|
+
"./src/ccopy.c",
|
|
374
|
+
"./src/ccopy_ndarray.c"
|
|
344
375
|
],
|
|
345
376
|
"include": [
|
|
346
377
|
"./include"
|
|
@@ -352,7 +383,8 @@
|
|
|
352
383
|
"@stdlib/napi-argv",
|
|
353
384
|
"@stdlib/napi-argv-int64",
|
|
354
385
|
"@stdlib/napi-argv-strided-complex64array",
|
|
355
|
-
"@stdlib/blas-base-shared"
|
|
386
|
+
"@stdlib/blas-base-shared",
|
|
387
|
+
"@stdlib/strided-base-stride2offset"
|
|
356
388
|
]
|
|
357
389
|
},
|
|
358
390
|
{
|
|
@@ -361,7 +393,8 @@
|
|
|
361
393
|
"blas": "",
|
|
362
394
|
"wasm": false,
|
|
363
395
|
"src": [
|
|
364
|
-
"./src/ccopy.c"
|
|
396
|
+
"./src/ccopy.c",
|
|
397
|
+
"./src/ccopy_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/ccopy.c"
|
|
415
|
+
"./src/ccopy.c",
|
|
416
|
+
"./src/ccopy_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/ccopy.c"
|
|
435
|
+
"./src/ccopy.c",
|
|
436
|
+
"./src/ccopy_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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/blas-base-ccopy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Copy values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -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": {},
|
|
@@ -85,9 +88,6 @@
|
|
|
85
88
|
"single",
|
|
86
89
|
"float32array"
|
|
87
90
|
],
|
|
88
|
-
"__stdlib__": {
|
|
89
|
-
"wasm": false
|
|
90
|
-
},
|
|
91
91
|
"funding": {
|
|
92
92
|
"type": "opencollective",
|
|
93
93
|
"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_ccopy_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/ccopy.c
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license Apache-2.0
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
#include "stdlib/blas/base/ccopy.h"
|
|
20
20
|
#include "stdlib/blas/base/shared.h"
|
|
21
|
+
#include "stdlib/strided/base/stride2offset.h"
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
|
|
@@ -29,37 +30,7 @@
|
|
|
29
30
|
* @param strideY Y stride length
|
|
30
31
|
*/
|
|
31
32
|
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
CBLAS_INT iy;
|
|
36
|
-
CBLAS_INT i;
|
|
37
|
-
|
|
38
|
-
if ( N <= 0 ) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if ( strideX == 1 && strideY == 1 ) {
|
|
42
|
-
for ( i = 0; i < N*2; i += 2 ) {
|
|
43
|
-
y[ i ] = x[ i ];
|
|
44
|
-
y[ i+1 ] = x[ i+1 ];
|
|
45
|
-
}
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if ( strideX < 0 ) {
|
|
49
|
-
ix = 2 * (1-N) * strideX;
|
|
50
|
-
} else {
|
|
51
|
-
ix = 0;
|
|
52
|
-
}
|
|
53
|
-
if ( strideY < 0 ) {
|
|
54
|
-
iy = 2 * (1-N) * strideY;
|
|
55
|
-
} else {
|
|
56
|
-
iy = 0;
|
|
57
|
-
}
|
|
58
|
-
for ( i = 0; i < N; i++ ) {
|
|
59
|
-
y[ iy ] = x[ ix ];
|
|
60
|
-
y[ iy+1 ] = x[ ix+1 ];
|
|
61
|
-
ix += strideX * 2;
|
|
62
|
-
iy += strideY * 2;
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
33
|
+
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
|
|
34
|
+
CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY );
|
|
35
|
+
API_SUFFIX(c_ccopy_ndarray)( N, X, strideX, ox, Y, strideY, oy );
|
|
65
36
|
}
|
package/src/ccopy.f
CHANGED
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support.
|
|
49
49
|
!
|
|
50
50
|
! @param {integer} N - number of indexed elements
|
|
51
|
-
! @param {Array<complex>}
|
|
52
|
-
! @param {integer} strideX - `
|
|
53
|
-
! @param {Array<complex>}
|
|
54
|
-
! @param {integer} strideY - `
|
|
51
|
+
! @param {Array<complex>} x - input array
|
|
52
|
+
! @param {integer} strideX - `x` stride length
|
|
53
|
+
! @param {Array<complex>} y - output array
|
|
54
|
+
! @param {integer} strideY - `y` stride length
|
|
55
55
|
!<
|
|
56
|
-
subroutine ccopy( N,
|
|
56
|
+
subroutine ccopy( N, x, strideX, y, strideY )
|
|
57
57
|
implicit none
|
|
58
58
|
! ..
|
|
59
59
|
! Scalar arguments:
|
|
60
60
|
integer :: strideX, strideY, N
|
|
61
61
|
! ..
|
|
62
62
|
! Array arguments:
|
|
63
|
-
complex ::
|
|
63
|
+
complex :: x(*), y(*)
|
|
64
64
|
! ..
|
|
65
65
|
! Local scalars:
|
|
66
66
|
integer :: ix, iy, i
|
|
@@ -71,7 +71,7 @@ subroutine ccopy( N, cx, strideX, cy, strideY )
|
|
|
71
71
|
! ..
|
|
72
72
|
if ( strideX == 1 .AND. strideY == 1 ) then
|
|
73
73
|
do i = 1, N
|
|
74
|
-
|
|
74
|
+
y( i ) = x( i )
|
|
75
75
|
end do
|
|
76
76
|
else
|
|
77
77
|
if ( strideX < 0 ) then
|
|
@@ -85,7 +85,7 @@ subroutine ccopy( N, cx, strideX, cy, strideY )
|
|
|
85
85
|
iy = 1
|
|
86
86
|
end if
|
|
87
87
|
do i = 1, N
|
|
88
|
-
|
|
88
|
+
y( iy ) = x( ix )
|
|
89
89
|
ix = ix + strideX
|
|
90
90
|
iy = iy + strideY
|
|
91
91
|
end do
|
package/src/ccopy_cblas.c
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
#include "stdlib/blas/base/ccopy.h"
|
|
20
20
|
#include "stdlib/blas/base/ccopy_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
|
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
|
|
@@ -32,3 +34,24 @@
|
|
|
32
34
|
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
33
35
|
API_SUFFIX(cblas_ccopy)( N, X, strideX, Y, strideY );
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y output array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const 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
|
+
|
|
56
|
+
API_SUFFIX(cblas_ccopy)( N, (void *)x, strideX, (void *)y, strideY );
|
|
57
|
+
}
|
package/src/ccopy_f.c
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
#include "stdlib/blas/base/ccopy.h"
|
|
20
20
|
#include "stdlib/blas/base/ccopy_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
|
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
|
|
@@ -32,3 +34,24 @@
|
|
|
32
34
|
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
|
|
33
35
|
ccopy( &N, X, &strideX, Y, &strideY );
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
40
|
+
*
|
|
41
|
+
* @param N number of indexed elements
|
|
42
|
+
* @param X input array
|
|
43
|
+
* @param strideX X stride length
|
|
44
|
+
* @param offsetX starting index for X
|
|
45
|
+
* @param Y output array
|
|
46
|
+
* @param strideY Y stride length
|
|
47
|
+
* @param offsetY starting index for Y
|
|
48
|
+
*/
|
|
49
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const 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
|
+
|
|
56
|
+
ccopy( &N, (void *)x, &strideX, (void *)y, &strideY );
|
|
57
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 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/ccopy.h"
|
|
20
|
+
#include "stdlib/blas/base/shared.h"
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
|
|
24
|
+
*
|
|
25
|
+
* @param N number of indexed elements
|
|
26
|
+
* @param X input array
|
|
27
|
+
* @param strideX X stride length
|
|
28
|
+
* @param offsetX starting index for X
|
|
29
|
+
* @param Y output array
|
|
30
|
+
* @param strideY Y stride length
|
|
31
|
+
* @param offsetY starting index for Y
|
|
32
|
+
*/
|
|
33
|
+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
|
|
34
|
+
const float *x = (float *)X;
|
|
35
|
+
float *y = (float *)Y;
|
|
36
|
+
CBLAS_INT ix;
|
|
37
|
+
CBLAS_INT iy;
|
|
38
|
+
CBLAS_INT sx;
|
|
39
|
+
CBLAS_INT sy;
|
|
40
|
+
CBLAS_INT i;
|
|
41
|
+
|
|
42
|
+
if ( N <= 0 ) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
sx = strideX * 2;
|
|
46
|
+
sy = strideY * 2;
|
|
47
|
+
ix = offsetX * 2;
|
|
48
|
+
iy = offsetY * 2;
|
|
49
|
+
for ( i = 0; i < N; i++ ) {
|
|
50
|
+
y[ iy ] = x[ ix ];
|
|
51
|
+
y[ iy+1 ] = x[ ix+1 ];
|
|
52
|
+
ix += sx;
|
|
53
|
+
iy += sy;
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|