From d2d0ec05d90a31e2bbdeea46bc206632006fa994 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 17 Sep 2024 07:37:19 +0000 Subject: [PATCH] Auto-generated commit --- .github/.keepalive | 1 - CHANGELOG.md | 16 ++- CONTRIBUTORS | 7 ++ README.md | 134 +++++++++++++++++++++++++ benchmark/c/benchmark.length.c | 44 +++++++- examples/c/example.c | 8 ++ include/stdlib/blas/base/scopy.h | 9 +- include/stdlib/blas/base/scopy_cblas.h | 4 +- lib/ndarray.native.js | 15 +-- manifest.json | 101 +++++++++++++++---- package.json | 4 +- src/addon.c | 25 ++++- src/scopy.c | 55 ++-------- src/scopy_cblas.c | 21 +++- src/scopy_f.c | 21 +++- src/scopy_ndarray.c | 79 +++++++++++++++ 16 files changed, 447 insertions(+), 97 deletions(-) delete mode 100644 .github/.keepalive create mode 100644 src/scopy_ndarray.c diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 635f77d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T02:11:35.170Z diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a96b4..e2271d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,17 @@
-## Unreleased (2024-09-01) +## Unreleased (2024-09-17) + +
+ +### Features + +- [`08f39b4`](https://github.com/stdlib-js/stdlib/commit/08f39b45439d043323ec402647f6b3ea8a5a4a56) - add C `ndarray` implementation for `blas/base/scopy` [(#2913)](https://github.com/stdlib-js/stdlib/pull/2913) + +
+ +
@@ -12,6 +22,7 @@
+- [`08f39b4`](https://github.com/stdlib-js/stdlib/commit/08f39b45439d043323ec402647f6b3ea8a5a4a56) - **feat:** add C `ndarray` implementation for `blas/base/scopy` [(#2913)](https://github.com/stdlib-js/stdlib/pull/2913) _(by Aman Bhansali, Athan Reines)_ - [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
@@ -24,8 +35,9 @@ ### Contributors -A total of 1 person contributed to this release. Thank you to this contributor: +A total of 2 people contributed to this release. Thank you to the following contributors: +- Aman Bhansali - Athan Reines
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 57d1184..147a89e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,6 +2,7 @@ # # Contributors listed in alphabetical order. +Aayush Khanna <96649223+aayush0325@users.noreply.github.com> Adarsh Palaskar Aditya Sapra AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> @@ -26,17 +27,20 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> Frank Kovacs Golden Kumar <103646877+AuenKr@users.noreply.github.com> Gunj Joshi +HarshaNP <96897754+GittyHarsha@users.noreply.github.com> Harshita Kalani Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> Jaimin Godhani <112328542+Jai0401@users.noreply.github.com> James Gelok Jaysukh Makvana +Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com> Jithin KS Joel Mathew Koshy Joey Reed Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison +Kaif Mohd Karthik Prakash <116057817+skoriop@users.noreply.github.com> Khaldon Krishnendu Das <86651039+itskdhere@users.noreply.github.com> @@ -86,8 +90,10 @@ Stephannie Jiménez Gacha Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com> Tirtadwipa Manunggal Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> +Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com> Utkarsh Utkarsh Raj +Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com> Varad Gupta Xiaochuan Ye Yernar Yergaziyev @@ -96,3 +102,4 @@ nishant-s7 <97207366+nishant-s7@users.noreply.github.com> orimiles5 <97595296+orimiles5@users.noreply.github.com> rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu +yaswanth <116426380+yaswanthkosuru@users.noreply.github.com> diff --git a/README.md b/README.md index fd5c634..0e6ef1d 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,140 @@ console.log( y ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/scopy.h" +``` + +#### c_scopy( N, \*X, strideX, \*Y, strideY ) + +Copies values from `X` into `Y`. + +```c +const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; +float y[] = { 0.0f, 0.0f, 0.0f, 0.0f }; + +c_scopy( 4, x, 1, y, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **Y**: `[out] float*` output array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. + +```c +void c_scopy( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY ); +``` + +#### c_scopy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) + +Copies values from `x` into `y` using alternative indexing semantics. + +```c +const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; +float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + +c_scopy_ndarray( 3, x, 1, 2, y, 1, 2 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **Y**: `[out] float*` output array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. + +```c +void c_scopy_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/scopy.h" +#include + +int main( void ) { + // Create strided arrays: + const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; + float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + + // Specify the number of elements: + const int N = 4; + + // Specify stride lengths: + const int strideX = 2; + const int strideY = -2; + + // Copy elements: + c_scopy( N, x, strideX, y, strideY ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "y[ %i ] = %f\n", i, y[ i ] ); + } + + // Copy elements: + c_scopy_ndarray( N, x, strideX, 0, y, strideY, 6 ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "y[ %i ] = %f\n", i, y[ i ] ); + } +} +``` + +
+ + + +
+ + +