Skip to content

refactor: update blas/ext/base/dapx to follow current project conventions #4737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/node_modules/@stdlib/blas/ext/base/dapx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **alpha**: scalar constant.
- **x**: input [`Float64Array`][@stdlib/array/float64].
- **strideX**: stride length for `x`.
- **strideX**: stride length.

The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element:

Expand Down Expand Up @@ -168,14 +168,14 @@ console.log( x );
#include "stdlib/blas/ext/base/dapx.h"
```

#### c_dapx( N, alpha, \*X, strideX )
#### stdlib_strided_dapx( N, alpha, \*X, strideX )

Adds a scalar constant to each element in a double-precision floating-point strided array.

```c
double x[] = { 1.0, 2.0, 3.0, 4.0 };

c_dapx( 4, 5.0, x, 1 );
stdlib_strided_dapx( 4, 5.0, x, 1 );

```

Expand All @@ -187,29 +187,29 @@ The function accepts the following arguments:
- **strideX**: `[in] CBLAS_INT` stride length for `X`.

```c
void c_dapx( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
void stdlib_strided_dapx( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
```

#### c_dapx_ndarray( N, alpha, \*X, strideX, offsetX )
#### stdlib_strided_dapx_ndarray( N, alpha, \*X, strideX, offsetX )

Adds a scalar constant to each element in a double-precision floating-point strided array using alternative indexing semantics.

```c
double x[] = { 1.0, 2.0, 3.0, 4.0 };

c_dapx_ndarray( 4, 5.0, x, 1, 0 );
stdlib_strided_dapx_ndarray( 4, 5.0, x, 1, 0 );
```

The function accepts the following arguments:

- **N**: `[in] CBLAS_INT` number of indexed elements.
- **alpha**: `[in] double` scalar constant.
- **X**: `[inout] double*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
- **strideX**: `[in] CBLAS_INT` stride length.
- **offsetX**: `[in] CBLAS_INT` starting index.

```c
void c_dapx_ndarray( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
void stdlib_strided_dapx_ndarray( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
```

</section>
Expand Down Expand Up @@ -245,7 +245,7 @@ int main( void ) {
const int strideX = 1;

// Fill the array:
c_dapx( N, 5.0, x, strideX );
stdlib_strided_dapx( N, 5.0, x, strideX );

// Print the result:
for ( int i = 0; i < 8; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static double benchmark1( int iterations, int len ) {
t = tic();
for ( i = 0; i < iterations; i++ ) {
// cppcheck-suppress uninitvar
c_dapx( len, 5.0, x, 1 );
stdlib_strided_dapx( len, 5.0, x, 1 );
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
break;
Expand All @@ -131,7 +131,7 @@ static double benchmark2( int iterations, int len ) {
t = tic();
for ( i = 0; i < iterations; i++ ) {
// cppcheck-suppress uninitvar
c_dapx_ndarray( len, 5.0, x, 1, 0 );
stdlib_strided_dapx_ndarray( len, 5.0, x, 1, 0 );
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main( void ) {
const int strideX = 1;

// Add a constant to each element:
c_dapx( N, 5.0, x, strideX );
stdlib_strided_dapx( N, 5.0, x, strideX );

// Print the result:
for ( int i = 0; i < 8; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ extern "C" {
/**
* Adds a scalar constant to each element in a double-precision floating-point strided array.
*/
void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
void API_SUFFIX(stdlib_strided_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );

/**
* Adds a scalar constant to each element in a double-precision floating-point strided array using alternative indexing semantics.
*/
void API_SUFFIX(c_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
void API_SUFFIX(stdlib_strided_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );

#ifdef __cplusplus
}
Expand Down
3 changes: 1 addition & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dapx/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ var M = 5;
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
* var alpha = 5.0;
*
* dapx( 3, alpha, x, 1, x.length-3 );
* dapx( 3, 5.0, x, 1, x.length-3 );
* // x => <Float64Array>[ 1.0, -2.0, 3.0, 1.0, 10.0, -1.0 ]
*/
function dapx( N, alpha, x, strideX, offsetX ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ var addon = require( './../src/addon.node' );
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
* var alpha = 5.0;
*
* dapx( 3, alpha, x, 1, x.length-3 );
* dapx( 3, 5.0, x, 1, x.length-3 );
* // x => <Float64Array>[ 1.0, -2.0, 3.0, 1.0, 10.0, -1.0 ]
*/
function dapx( N, alpha, x, strideX, offsetX ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dapx/src/addon.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 1 );
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
API_SUFFIX(c_dapx)( N, alpha, X, strideX );
API_SUFFIX(stdlib_strided_dapx)( N, alpha, X, strideX );
return NULL;
}

Expand All @@ -56,7 +56,7 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
API_SUFFIX(c_dapx_ndarray)( N, alpha, X, strideX, offsetX );
API_SUFFIX(stdlib_strided_dapx_ndarray)( N, alpha, X, strideX, offsetX );
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/blas/ext/base/dapx/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
* @param X input array
* @param strideX stride length
*/
void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX ) {
void API_SUFFIX(stdlib_strided_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX ) {
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
API_SUFFIX(c_dapx_ndarray)( N, alpha, X, strideX, ox );
API_SUFFIX(stdlib_strided_dapx_ndarray)( N, alpha, X, strideX, ox );
}

/**
Expand All @@ -42,7 +42,7 @@ void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const
* @param strideX stride length
* @param offsetX starting index
*/
void API_SUFFIX(c_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
void API_SUFFIX(stdlib_strided_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
CBLAS_INT ix;
CBLAS_INT m;
CBLAS_INT i;
Expand Down
Loading