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 ] ); + } +} +``` + +
+ + + +
+ + +