Skip to content

Commit 02cbff3

Browse files
authored
refactor: update blas/ext/base/dapx to follow current project conventions
PR-URL: #4737 Reviewed-by: Philipp Burckhardt <[email protected]>
1 parent 8fc41f6 commit 02cbff3

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

lib/node_modules/@stdlib/blas/ext/base/dapx/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The function has the following parameters:
4848
- **N**: number of indexed elements.
4949
- **alpha**: scalar constant.
5050
- **x**: input [`Float64Array`][@stdlib/array/float64].
51-
- **strideX**: stride length for `x`.
51+
- **strideX**: stride length.
5252

5353
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:
5454

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

171-
#### c_dapx( N, alpha, \*X, strideX )
171+
#### stdlib_strided_dapx( N, alpha, \*X, strideX )
172172

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

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

178-
c_dapx( 4, 5.0, x, 1 );
178+
stdlib_strided_dapx( 4, 5.0, x, 1 );
179179

180180
```
181181
@@ -187,29 +187,29 @@ The function accepts the following arguments:
187187
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
188188
189189
```c
190-
void c_dapx( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
190+
void stdlib_strided_dapx( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
191191
```
192192

193-
#### c_dapx_ndarray( N, alpha, \*X, strideX, offsetX )
193+
#### stdlib_strided_dapx_ndarray( N, alpha, \*X, strideX, offsetX )
194194

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

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

200-
c_dapx_ndarray( 4, 5.0, x, 1, 0 );
200+
stdlib_strided_dapx_ndarray( 4, 5.0, x, 1, 0 );
201201
```
202202
203203
The function accepts the following arguments:
204204
205205
- **N**: `[in] CBLAS_INT` number of indexed elements.
206206
- **alpha**: `[in] double` scalar constant.
207207
- **X**: `[inout] double*` input array.
208-
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
209-
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
208+
- **strideX**: `[in] CBLAS_INT` stride length.
209+
- **offsetX**: `[in] CBLAS_INT` starting index.
210210
211211
```c
212-
void c_dapx_ndarray( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
212+
void stdlib_strided_dapx_ndarray( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
213213
```
214214

215215
</section>
@@ -245,7 +245,7 @@ int main( void ) {
245245
const int strideX = 1;
246246

247247
// Fill the array:
248-
c_dapx( N, 5.0, x, strideX );
248+
stdlib_strided_dapx( N, 5.0, x, strideX );
249249

250250
// Print the result:
251251
for ( int i = 0; i < 8; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/dapx/benchmark/c/benchmark.length.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static double benchmark1( int iterations, int len ) {
106106
t = tic();
107107
for ( i = 0; i < iterations; i++ ) {
108108
// cppcheck-suppress uninitvar
109-
c_dapx( len, 5.0, x, 1 );
109+
stdlib_strided_dapx( len, 5.0, x, 1 );
110110
if ( x[ 0 ] != x[ 0 ] ) {
111111
printf( "should not return NaN\n" );
112112
break;
@@ -131,7 +131,7 @@ static double benchmark2( int iterations, int len ) {
131131
t = tic();
132132
for ( i = 0; i < iterations; i++ ) {
133133
// cppcheck-suppress uninitvar
134-
c_dapx_ndarray( len, 5.0, x, 1, 0 );
134+
stdlib_strided_dapx_ndarray( len, 5.0, x, 1, 0 );
135135
if ( x[ 0 ] != x[ 0 ] ) {
136136
printf( "should not return NaN\n" );
137137
break;

lib/node_modules/@stdlib/blas/ext/base/dapx/examples/c/example.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main( void ) {
3030
const int strideX = 1;
3131

3232
// Add a constant to each element:
33-
c_dapx( N, 5.0, x, strideX );
33+
stdlib_strided_dapx( N, 5.0, x, strideX );
3434

3535
// Print the result:
3636
for ( int i = 0; i < 8; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/dapx/include/stdlib/blas/ext/base/dapx.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ extern "C" {
3131
/**
3232
* Adds a scalar constant to each element in a double-precision floating-point strided array.
3333
*/
34-
void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
34+
void API_SUFFIX(stdlib_strided_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX );
3535

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

4141
#ifdef __cplusplus
4242
}

lib/node_modules/@stdlib/blas/ext/base/dapx/lib/ndarray.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ var M = 5;
3939
* var Float64Array = require( '@stdlib/array/float64' );
4040
*
4141
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
42-
* var alpha = 5.0;
4342
*
44-
* dapx( 3, alpha, x, 1, x.length-3 );
43+
* dapx( 3, 5.0, x, 1, x.length-3 );
4544
* // x => <Float64Array>[ 1.0, -2.0, 3.0, 1.0, 10.0, -1.0 ]
4645
*/
4746
function dapx( N, alpha, x, strideX, offsetX ) {

lib/node_modules/@stdlib/blas/ext/base/dapx/lib/ndarray.native.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ var addon = require( './../src/addon.node' );
3939
* var Float64Array = require( '@stdlib/array/float64' );
4040
*
4141
* var x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
42-
* var alpha = 5.0;
4342
*
44-
* dapx( 3, alpha, x, 1, x.length-3 );
43+
* dapx( 3, 5.0, x, 1, x.length-3 );
4544
* // x => <Float64Array>[ 1.0, -2.0, 3.0, 1.0, 10.0, -1.0 ]
4645
*/
4746
function dapx( N, alpha, x, strideX, offsetX ) {

lib/node_modules/@stdlib/blas/ext/base/dapx/src/addon.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
3838
STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 1 );
3939
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
4040
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
41-
API_SUFFIX(c_dapx)( N, alpha, X, strideX );
41+
API_SUFFIX(stdlib_strided_dapx)( N, alpha, X, strideX );
4242
return NULL;
4343
}
4444

@@ -56,7 +56,7 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
5656
STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
5757
STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
5858
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
59-
API_SUFFIX(c_dapx_ndarray)( N, alpha, X, strideX, offsetX );
59+
API_SUFFIX(stdlib_strided_dapx_ndarray)( N, alpha, X, strideX, offsetX );
6060
return NULL;
6161
}
6262

lib/node_modules/@stdlib/blas/ext/base/dapx/src/main.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
* @param X input array
2929
* @param strideX stride length
3030
*/
31-
void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX ) {
31+
void API_SUFFIX(stdlib_strided_dapx)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX ) {
3232
CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
33-
API_SUFFIX(c_dapx_ndarray)( N, alpha, X, strideX, ox );
33+
API_SUFFIX(stdlib_strided_dapx_ndarray)( N, alpha, X, strideX, ox );
3434
}
3535

3636
/**
@@ -42,7 +42,7 @@ void API_SUFFIX(c_dapx)( const CBLAS_INT N, const double alpha, double *X, const
4242
* @param strideX stride length
4343
* @param offsetX starting index
4444
*/
45-
void API_SUFFIX(c_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
45+
void API_SUFFIX(stdlib_strided_dapx_ndarray)( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
4646
CBLAS_INT ix;
4747
CBLAS_INT m;
4848
CBLAS_INT i;

0 commit comments

Comments
 (0)