diff --git a/lib/node_modules/@stdlib/blas/base/zswap/README.md b/lib/node_modules/@stdlib/blas/base/zswap/README.md index 7570adfe7aec..4b69e2b186cf 100644 --- a/lib/node_modules/@stdlib/blas/base/zswap/README.md +++ b/lib/node_modules/@stdlib/blas/base/zswap/README.md @@ -265,6 +265,142 @@ console.log( y.get( y.length-1 ).toString() ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/zswap.h" +``` + +#### c_zswap( N, \*X, strideX, \*Y, strideY ) + +Interchanges two complex double-precision floating-point vectors. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; // interleaved real and imaginary components +double y[] = { 5.0, 6.0, 7.0, 8.0 }; + +c_zswap( 2, (void *)x, 1, (void *)y, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[inout] void*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **Y**: `[inout] void*` second input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. + +```c +void c_zswap( const CBLAS_INT N, void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY ); +``` + +#### c_zswap_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) + +Interchanges two complex double-precision floating-point vectors using alternative indexing semantics. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; // interleaved real and imaginary components +double y[] = { 5.0, 6.0, 7.0, 8.0 }; + +c_zswap_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**: `[inout] void*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **Y**: `[inout] void*` second input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. + +```c +void c_zswap_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 ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/zswap.h" +#include + +int main( void ) { + // Create strided arrays: + 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; + + // Swap elements: + c_zswap( N, (void *)x, strideX, (void *)y, strideY ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); + printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] ); + } + + // Swap elements using alternative indexing semantics: + c_zswap_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); + printf( "y[ %i ] = %lf + %lfj\n", i, y[ i*2 ], y[ (i*2)+1 ] ); + } +} +``` + +
+ + + +
+ + +