diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/README.md b/lib/node_modules/@stdlib/blas/base/zcopy/README.md
index c5a4f195ffcc..c1d154585339 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/README.md
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/README.md
@@ -211,6 +211,140 @@ console.log( y.get( y.length-1 ).toString() );
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/blas/base/zcopy.h"
+```
+
+#### c_zcopy( N, \*X, strideX, \*Y, strideY )
+
+Copies values from `X` into `Y`.
+
+```c
+const double x[] = { 1.0, 2.0, 3.0, 4.0 }; // interleaved real and imaginary components
+double y[] = { 0.0, 0.0, 0.0, 0.0 };
+
+c_zcopy( 2, (void *)x, 1, (void *)y, 1 );
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **X**: `[in] void*` input array.
+- **strideX**: `[in] CBLAS_INT` index increment for `X`.
+- **Y**: `[out] void*` output array.
+- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
+
+```c
+void c_zcopy( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
+```
+
+#### c_zcopy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY )
+
+Copies values from `X` into `Y` using alternative indexing semantics.
+
+```c
+const double x[] = { 1.0, 2.0, 3.0, 4.0 }; // interleaved real and imaginary components
+double y[] = { 0.0, 0.0, 0.0, 0.0 };
+
+c_zcopy_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0 );
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **X**: `[in] void*` input array.
+- **strideX**: `[in] CBLAS_INT` index increment for `X`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+- **Y**: `[out] void*` output array.
+- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
+- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
+
+```c
+void c_zcopy_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 );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/blas/base/zcopy.h"
+#include
+
+int main( void ) {
+ // Create strided arrays:
+ const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
+ double y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+
+ // Specify the number of elements:
+ const int N = 4;
+
+ // Specify stride lengths:
+ const int strideX = 1;
+ const int strideY = -1;
+
+ // Copy elements:
+ c_zcopy( N, (void *)x, strideX, (void *)y, strideY );
+
+ // Print the result:
+ for ( int i = 0; i < N; i++ ) {
+ printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
+ }
+
+ // Copy elements using alternative indexing semantics:
+ c_zcopy_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 );
+
+ // Print the result:
+ for ( int i = 0; i < N; i++ ) {
+ printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
+ }
+}
+```
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/zcopy/benchmark/c/benchmark.length.c
index 9178b3f15ad7..de1c11373843 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/benchmark/c/benchmark.length.c
@@ -94,7 +94,7 @@ static double rand_double( void ) {
* @param len array length
* @return elapsed time in seconds
*/
-static double benchmark( int iterations, int len ) {
+static double benchmark1( int iterations, int len ) {
double elapsed;
double *x;
double *y;
@@ -127,6 +127,46 @@ static double benchmark( int iterations, int len ) {
return elapsed;
}
+/**
+* Runs a benchmark.
+*
+* @param iterations number of iterations
+* @param len array length
+* @return elapsed time in seconds
+*/
+static double benchmark2( int iterations, int len ) {
+ double elapsed;
+ double *x;
+ double *y;
+ double t;
+ int i;
+
+ x = (double *) malloc( len*2 * sizeof( double ) );
+ y = (double *) malloc( len*2 * sizeof( double ) );
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_double()*10000.0 ) - 5000.0;
+ x[ i+1 ] = ( rand_double()*10000.0 ) - 5000.0;
+ y[ i ] = 0.0;
+ y[ i+1 ] = 0.0;
+ }
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ c_zcopy_ndarray( len, (void *)x, 1, 0, (void *)y, 1, 0 );
+ if ( y[ 0 ] != y[ 0 ] ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( y[ 0 ] != y[ 0 ] ) {
+ printf( "should not return NaN\n" );
+ }
+ free( x );
+ free( y );
+
+ return elapsed;
+}
+
/**
* Main execution sequence.
*/
@@ -149,7 +189,14 @@ int main( void ) {
for ( j = 0; j < REPEATS; j++ ) {
count += 1;
printf( "# c::%s:len=%d\n", NAME, len );
- elapsed = benchmark( iter, len );
+ elapsed = benchmark1( iter, len );
+ print_results( iter, elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ for ( j = 0; j < REPEATS; j++ ) {
+ count += 1;
+ printf( "# c::%s:ndarray:len=%d\n", NAME, len );
+ elapsed = benchmark2( iter, len );
print_results( iter, elapsed );
printf( "ok %d benchmark finished\n", count );
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/zcopy/examples/c/example.c
index 06ed07ca2450..68e2f4edd196 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/examples/c/example.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/examples/c/example.c
@@ -38,4 +38,12 @@ int main( void ) {
for ( int i = 0; i < N; i++ ) {
printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
}
+
+ // Copy elements using alternative indexing semantics:
+ c_zcopy_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 );
+
+ // Print the result:
+ for ( int i = 0; i < N; i++ ) {
+ printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
+ }
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy.h b/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy.h
index cf64ca765db4..dec01829a234 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy.h
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy.h
@@ -22,6 +22,8 @@
#ifndef ZCOPY_H
#define ZCOPY_H
+#include "stdlib/blas/base/shared.h"
+
/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
@@ -32,7 +34,12 @@ extern "C" {
/**
* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector.
*/
-void c_zcopy( const int N, const void *X, const int strideX, void *Y, const int strideY );
+void API_SUFFIX(c_zcopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
+
+/**
+* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector using alternative indexing semantics.
+*/
+void API_SUFFIX(c_zcopy_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 );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy_cblas.h b/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy_cblas.h
index e34477784085..849871aa2235 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy_cblas.h
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/include/stdlib/blas/base/zcopy_cblas.h
@@ -22,6 +22,8 @@
#ifndef ZCOPY_CBLAS_H
#define ZCOPY_CBLAS_H
+#include "stdlib/blas/base/shared.h"
+
/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
@@ -32,7 +34,7 @@ extern "C" {
/**
* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector.
*/
-void cblas_zcopy( const int N, const void *X, const int strideX, void *Y, const int strideY );
+void API_SUFFIX(cblas_zcopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/zcopy/lib/ndarray.native.js
index 5bd6f58bd9ff..1a760bf5024c 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/lib/ndarray.native.js
@@ -21,7 +21,6 @@
// MODULES //
var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
-var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
var addon = require( './../src/addon.node' );
@@ -59,16 +58,9 @@ var addon = require( './../src/addon.node' );
* // returns 2.0
*/
function zcopy( N, x, strideX, offsetX, y, strideY, offsetY ) {
- var viewX;
- var viewY;
-
- offsetX = minViewBufferIndex( N, strideX, offsetX );
- offsetY = minViewBufferIndex( N, strideY, offsetY );
-
- viewX = reinterpret( x, offsetX );
- viewY = reinterpret( y, offsetY );
-
- addon( N, viewX, strideX, viewY, strideY );
+ var viewX = reinterpret( x, 0 );
+ var viewY = reinterpret( y, 0 );
+ addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY );
return y;
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/lib/zcopy.js b/lib/node_modules/@stdlib/blas/base/zcopy/lib/zcopy.js
index ad215ef678d3..c9cf41cfe5da 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/lib/zcopy.js
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/lib/zcopy.js
@@ -20,7 +20,8 @@
// MODULES //
-var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
// MAIN //
@@ -55,45 +56,9 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
* // returns 2.0
*/
function zcopy( N, x, strideX, y, strideY ) {
- var viewX;
- var viewY;
- var sx;
- var sy;
- var ix;
- var iy;
- var i;
-
- if ( N <= 0 ) {
- return y;
- }
- viewX = reinterpret( x, 0 );
- viewY = reinterpret( y, 0 );
- if ( strideX === 1 && strideY === 1 ) {
- for ( i = 0; i < N*2; i += 2 ) {
- viewY[ i ] = viewX[ i ];
- viewY[ i+1 ] = viewX[ i+1 ];
- }
- return y;
- }
- if ( strideX < 0 ) {
- ix = 2 * (1-N) * strideX;
- } else {
- ix = 0;
- }
- if ( strideY < 0 ) {
- iy = 2 * (1-N) * strideY;
- } else {
- iy = 0;
- }
- sx = strideX * 2;
- sy = strideY * 2;
- for ( i = 0; i < N; i++ ) {
- viewY[ iy ] = viewX[ ix ];
- viewY[ iy+1 ] = viewX[ ix+1 ];
- ix += sx;
- iy += sy;
- }
- return y;
+ var ox = stride2offset( N, strideX );
+ var oy = stride2offset( N, strideY );
+ return ndarray( N, x, strideX, ox, y, strideY, oy );
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/manifest.json b/lib/node_modules/@stdlib/blas/base/zcopy/manifest.json
index 9b042c14dfc1..6910aec821c8 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/manifest.json
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/manifest.json
@@ -45,8 +45,11 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
]
},
{
@@ -55,14 +58,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
"task": "examples",
@@ -70,14 +77,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
@@ -99,8 +110,11 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
]
},
{
@@ -119,7 +133,11 @@
"-lpthread"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
"task": "examples",
@@ -137,7 +155,11 @@
"-lpthread"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
@@ -157,8 +179,11 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
]
},
{
@@ -167,14 +192,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
"task": "examples",
@@ -182,14 +211,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
@@ -210,8 +243,11 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
]
},
{
@@ -229,7 +265,11 @@
"-lblas"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
"task": "examples",
@@ -246,7 +286,11 @@
"-lblas"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
@@ -268,8 +312,11 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
]
},
{
@@ -288,7 +335,11 @@
"-lpthread"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
"task": "examples",
@@ -306,7 +357,11 @@
"-lpthread"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/complex/float64/ctor"
+ ]
},
{
@@ -315,7 +370,8 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
@@ -325,8 +381,10 @@
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
+ "@stdlib/blas/base/shared",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-complex128array"
+ "@stdlib/napi/argv-strided-complex128array",
+ "@stdlib/strided/base/stride2offset"
]
},
{
@@ -335,14 +393,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
"task": "examples",
@@ -350,14 +412,18 @@
"blas": "",
"wasm": false,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
@@ -366,14 +432,18 @@
"blas": "",
"wasm": true,
"src": [
- "./src/zcopy.c"
+ "./src/zcopy.c",
+ "./src/zcopy_ndarray.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
}
]
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/src/addon.c b/lib/node_modules/@stdlib/blas/base/zcopy/src/addon.c
index c8f32dee8005..e6ed6768458a 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/src/addon.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/src/addon.c
@@ -17,6 +17,7 @@
*/
#include "stdlib/blas/base/zcopy.h"
+#include "stdlib/blas/base/shared.h"
#include "stdlib/napi/export.h"
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.h"
@@ -37,8 +38,28 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 );
STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 3 );
- c_zcopy( N, (void *)X, strideX, (void *)Y, strideY );
+ API_SUFFIX(c_zcopy)( N, (void *)X, strideX, (void *)Y, strideY );
return NULL;
}
-STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
+/**
+* Receives JavaScript callback invocation data.
+*
+* @param env environment under which the function is invoked
+* @param info callback data
+* @return Node-API value
+*/
+static napi_value addon_method( napi_env env, napi_callback_info info ) {
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 7 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
+ STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 );
+ STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 );
+ STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 4 );
+ API_SUFFIX(c_zcopy_ndarray)( N, (void *)X, strideX, offsetX, (void *)Y, strideY, offsetY );
+ return NULL;
+}
+
+STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy.c b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy.c
index e137eab186dc..d95b81db7d1a 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy.c
@@ -17,6 +17,8 @@
*/
#include "stdlib/blas/base/zcopy.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/strided/base/stride2offset.h"
/**
* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector.
@@ -27,38 +29,8 @@
* @param Y output array
* @param strideY Y stride length
*/
-void c_zcopy( const int N, const void *X, const int strideX, void *Y, const int strideY ) {
- double *x = (double *)X;
- double *y = (double *)Y;
- int ix;
- int iy;
- int i;
-
- if ( N <= 0 ) {
- return;
- }
- if ( strideX == 1 && strideY == 1 ) {
- for ( i = 0; i < N*2; i += 2 ) {
- y[ i ] = x[ i ];
- y[ i+1 ] = x[ i+1 ];
- }
- return;
- }
- if ( strideX < 0 ) {
- ix = 2 * (1-N) * strideX;
- } else {
- ix = 0;
- }
- if ( strideY < 0 ) {
- iy = 2 * (1-N) * strideY;
- } else {
- iy = 0;
- }
- for ( i = 0; i < N; i++ ) {
- y[ iy ] = x[ ix ];
- y[ iy+1 ] = x[ ix+1 ];
- ix += strideX * 2;
- iy += strideY * 2;
- }
- return;
+void API_SUFFIX(c_zcopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
+ CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
+ CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY );
+ API_SUFFIX(c_zcopy_ndarray)( N, X, strideX, ox, Y, strideY, oy );
}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_cblas.c b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_cblas.c
index 603a63753a73..53581b22d3c0 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_cblas.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_cblas.c
@@ -18,6 +18,9 @@
#include "stdlib/blas/base/zcopy.h"
#include "stdlib/blas/base/zcopy_cblas.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/complex/float64/ctor.h"
+#include "stdlib/strided/base/min_view_buffer_index.h"
/**
* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector.
@@ -28,6 +31,26 @@
* @param Y output array
* @param strideY Y stride length
*/
-void c_zcopy( const int N, const void *X, const int strideX, void *Y, const int strideY ) {
+void API_SUFFIX(c_zcopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
cblas_zcopy( N, X, strideX, Y, strideY );
}
+
+/**
+* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X input array
+* @param strideX X stride length
+* @param offsetX starting index for X
+* @param Y output array
+* @param strideY Y stride length
+* @param offsetY starting index for Y
+*/
+void API_SUFFIX(c_zcopy_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 ) {
+ stdlib_complex128_t *zx = (stdlib_complex128_t *)X;
+ stdlib_complex128_t *zy = (stdlib_complex128_t *)Y;
+
+ zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer
+ zy += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); // adjust array pointer
+ cblas_zcopy( N, (void *)zx, strideX, (void *)zy, strideY );
+}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_f.c b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_f.c
index eb3b3c5dc8a4..2f21ebf46af2 100644
--- a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_f.c
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_f.c
@@ -18,6 +18,9 @@
#include "stdlib/blas/base/zcopy.h"
#include "stdlib/blas/base/zcopy_fortran.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/complex/float64/ctor.h"
+#include "stdlib/strided/base/min_view_buffer_index.h"
/**
* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector.
@@ -28,6 +31,26 @@
* @param Y output array
* @param strideY Y stride length
*/
-void c_zcopy( const int N, const void *X, const int strideX, void *Y, const int strideY ) {
+void API_SUFFIX(c_zcopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ) {
zcopy( &N, X, &strideX, Y, &strideY );
}
+
+/**
+* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X input array
+* @param strideX X stride length
+* @param offsetX starting index for X
+* @param Y output array
+* @param strideY Y stride length
+* @param offsetY starting index for Y
+*/
+void API_SUFFIX(c_zcopy_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 ) {
+ stdlib_complex128_t *zx = (stdlib_complex128_t *)X;
+ stdlib_complex128_t *zy = (stdlib_complex128_t *)Y;
+
+ zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX );
+ zy += stdlib_strided_min_view_buffer_index( N, strideY, offsetY );
+ zcopy( &N, (void *)zx, &strideX, (void *)zy, &strideY );
+}
diff --git a/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_ndarray.c b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_ndarray.c
new file mode 100644
index 000000000000..c2d7fa14ebd8
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/zcopy/src/zcopy_ndarray.c
@@ -0,0 +1,56 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include "stdlib/blas/base/zcopy.h"
+#include "stdlib/blas/base/shared.h"
+
+/**
+* Copies values from one complex double-precision floating-point vector to another complex double-precision floating-point vector using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X input array
+* @param strideX X stride length
+* @param offsetX starting index for X
+* @param Y output array
+* @param strideY Y stride length
+* @param offsetY starting index for Y
+*/
+void API_SUFFIX(c_zcopy_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 ) {
+ double *x = (double *)X;
+ double *y = (double *)Y;
+ CBLAS_INT ix;
+ CBLAS_INT iy;
+ CBLAS_INT sx;
+ CBLAS_INT sy;
+ CBLAS_INT i;
+
+ if ( N <= 0 ) {
+ return;
+ }
+ sx = strideX * 2;
+ sy = strideY * 2;
+ ix = offsetX * 2;
+ iy = offsetY * 2;
+ for ( i = 0; i < N; i++ ) {
+ y[ iy ] = x[ ix ];
+ y[ iy+1 ] = x[ ix+1 ];
+ ix += sx;
+ iy += sy;
+ }
+ return;
+}