From 36ad267cb98a52d55bca2e70f6464887a0ba3d14 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Apr 2024 21:14:07 +0000 Subject: [PATCH] Auto-generated commit --- README.md | 102 +++++++++++++++++++++++++ include/stdlib/blas/base/dswap.h | 4 +- include/stdlib/blas/base/dswap_cblas.h | 4 +- manifest.json | 58 ++++++++++---- package.json | 1 + src/dswap.c | 11 +-- src/dswap_cblas.c | 3 +- src/dswap_f.c | 3 +- 8 files changed, 164 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b1cc392..85c57d1 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,108 @@ console.log( y ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/dswap.h" +``` + +#### c_dswap( N, X, strideX, Y, strideY ) + +Interchanges two double-precision floating-point vectors. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; +double y[] = { 0.0, 0.0, 0.0, 0.0 }; + +c_dswap( 4, x, 1, y, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[inout] double*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **Y**: `[inout] double*` first input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. + +```c +void c_dswap( const CBLAS_INT N, double *X, const CBLAS_INT strideX, double *Y, const CBLAS_INT strideY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/dswap.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 = 2; + const int strideY = -2; + + // Interchange elements: + c_dswap( N, x, strideX, y, strideY ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + printf( "y[ %i ] = %lf\n", i, y[ i ] ); + } +} +``` + +
+ + + +
+ + +