diff --git a/CHANGELOG.md b/CHANGELOG.md index 99dc498a2..106742f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,28 @@ +
+ +#### [@stdlib/blas/base/caxpy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/caxpy) + +
+ +
+ +##### Features + +- [`b6ee443`](https://github.com/stdlib-js/stdlib/commit/b6ee443347db7dcd18b281f99a0617b3b64d86fc) - add C `ndarray` implementation for `blas/base/caxpy` [(#3456)](https://github.com/stdlib-js/stdlib/pull/3456) + +
+ + + +
+ +
+ + +
#### [@stdlib/blas/base/ccopy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ccopy) @@ -211,6 +233,28 @@ +
+ +#### [@stdlib/blas/base/daxpy](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/daxpy) + +
+ +
+ +##### Features + +- [`b6ee443`](https://github.com/stdlib-js/stdlib/commit/b6ee443347db7dcd18b281f99a0617b3b64d86fc) - add C `ndarray` implementation for `blas/base/caxpy` [(#3456)](https://github.com/stdlib-js/stdlib/pull/3456) + +
+ + + +
+ +
+ + +
#### [@stdlib/blas/base/drotm-wasm](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/drotm-wasm) @@ -1069,6 +1113,7 @@ A total of 8 people contributed to this release. Thank you to the following cont
+- [`b6ee443`](https://github.com/stdlib-js/stdlib/commit/b6ee443347db7dcd18b281f99a0617b3b64d86fc) - **feat:** add C `ndarray` implementation for `blas/base/caxpy` [(#3456)](https://github.com/stdlib-js/stdlib/pull/3456) _(by Aman Bhansali, Athan Reines)_ - [`cf7d38a`](https://github.com/stdlib-js/stdlib/commit/cf7d38ae3e7bce92cf47778f7b1c3da731121d77) - **docs:** update related packages sections [(#3527)](https://github.com/stdlib-js/stdlib/pull/3527) _(by stdlib-bot)_ - [`bf5643f`](https://github.com/stdlib-js/stdlib/commit/bf5643fb1a3f32a60903d8e210f71571e609119f) - **docs:** update related packages sections [(#3404)](https://github.com/stdlib-js/stdlib/pull/3404) _(by stdlib-bot)_ - [`ac06419`](https://github.com/stdlib-js/stdlib/commit/ac06419c2a8358dfd80818823f571077eb58958e) - **docs:** update related packages sections [(#3387)](https://github.com/stdlib-js/stdlib/pull/3387) _(by stdlib-bot)_ diff --git a/base/caxpy/README.md b/base/caxpy/README.md index 3716afe8b..ea10b2461 100644 --- a/base/caxpy/README.md +++ b/base/caxpy/README.md @@ -229,6 +229,152 @@ logEach( '(%s)*(%s) + (%s) = %s', ca, cx, cyc, cy ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/caxpy.h" +``` + +#### c_caxpy( N, ca, \*CX, strideX, \*CY, strideY ) + +Scales values from `cx` by `ca` and adds the result to `cy`. + +```c +#include "stdlib/complex/float32/ctor.h" + +float cx[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; +float cy[] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f }; +const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f ); + +c_caxpy( 4, ca, (void *)cx, 1, (void *)cy, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **ca**: `[in] stdlib_complex64_t` scalar constant. +- **CX**: `[in] void*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `CX`. +- **CY**: `[inout] void*` output array. +- **strideY**: `[in] CBLAS_INT` index increment for `CY`. + +```c +void c_caxpy( const CBLAS_INT N, const stdlib_complex64_t ca, const void *CX, const CBLAS_INT strideX, void *CY, const CBLAS_INT strideY ); +``` + +#### c_caxpy_ndarray( N, ca, \*CX, strideX, offsetX, \*CY, strideY, offsetY ) + +Scales values from `cx` by `ca` and adds the result to `cy` using alternative indexing semantics. + +```c +#include "stdlib/complex/float32/ctor.h" + +float cx[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; +float cy[] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f } +const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f ); + +c_caxpy_ndarray( 4, ca, (void *)cx, 1, 0, (void *)cy, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **ca**: `[in] stdlib_complex64_t` scalar constant. +- **CX**: `[in] void*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `CX`. +- **offsetX**: `[in] CBLAS_INT` starting index for `CX`. +- **CY**: `[inout] void*` output array. +- **strideY**: `[in] CBLAS_INT` index increment for `CY`. +- **offsetY**: `[in] CBLAS_INT` starting index for `CY`. + +```c +void c_caxpy_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca, const void *CX, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *CY, const CBLAS_INT strideY, const CBLAS_INT offsetY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/caxpy.h" +#include "stdlib/complex/float32/ctor.h" +#include + +int main( void ) { + // Create strided arrays of interleaved real and imaginary components... + float cx[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; + float cy[] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f }; + + // Create a complex scalar: + const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f ); + + // Specify the number of elements: + const int N = 4; + + // Specify strides... + const int strideX = 1; + const int strideY = 1; + + // Scale values from `cx` by `ca` and adds the result to `cy`: + c_caxpy( N, ca, (void *)cx, strideX, (void *)cy, strideY ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "cy[ %i ] = %f + %fj\n", i, cy[ i*2 ], cy[ (i*2)+1 ] ); + } + + // Scales values from `cx` by `ca` and adds the result to `cy` using alternative indexing semantics: + c_caxpy_ndarray( N, ca, (void *)cx, -strideX, 3, (void *)cy, -strideY, 3 ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "cy[ %i ] = %f + %fj\n", i, cy[ i*2 ], cy[ (i*2)+1 ] ); + } +} +``` + +
+ + + +
+ + +