Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Dec 2, 2023
1 parent fd82954 commit 01151b2
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 178 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The function has the following parameters:
- **y**: second input [`Float64Array`][mdn-float64array].
- **strideY**: index increment for `y`.

The `N` and stride parameters determine how values from `x` and `y` are accessed at runtime. For example, to swap in reverse order every other value in `x` with the first `N` elements of `y`,
The `N` and stride parameters determine how values in the strided arrays are accessed at runtime. For example, to swap in reverse order every other value in `x` with the first `N` elements of `y`,

```javascript
var Float64Array = require( '@stdlib/array-float64' );
Expand Down Expand Up @@ -138,7 +138,7 @@ The function has the following additional parameters:
- **offsetX**: starting index for `x`.
- **offsetY**: starting index for `y`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the offset parameters support indexing semantics based on starting indices. For example, to swap every other value in `x` starting from the second value with the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,...,
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to swap every other value in `x` starting from the second value with the last `N` elements in `y` where `x[i] = y[n]`, `x[i+2] = y[n-1]`,...,

```javascript
var Float64Array = require( '@stdlib/array-float64' );
Expand Down
6 changes: 3 additions & 3 deletions examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ int main( void ) {
double y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

// Specify the number of elements:
int N = 4;
const int N = 4;

// Specify stride lengths:
int strideX = 2;
int strideY = -2;
const int strideX = 2;
const int strideY = -2;

// Interchange elements:
c_dswap( N, x, strideX, y, strideY );
Expand Down
313 changes: 167 additions & 146 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,148 +1,169 @@
{
"options": {
"os": "linux",
"blas": ""
},
"fields": [
{
"field": "src",
"resolve": true,
"relative": true
},
{
"field": "include",
"resolve": true,
"relative": true
},
{
"field": "libraries",
"resolve": false,
"relative": false
},
{
"field": "libpath",
"resolve": true,
"relative": false
}
],
"confs": [
{
"os": "linux",
"blas": "",
"src": [
"./src/dswap.f",
"./src/dswap_f.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "linux",
"blas": "openblas",
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "",
"src": [
"./src/dswap.f",
"./src/dswap_f.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "apple_accelerate_framework",
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lblas"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "openblas",
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "win",
"blas": "",
"src": [
"./src/dswap.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
}
]
"options": {
"os": "linux",
"blas": "",
"wasm": false
},
"fields": [
{
"field": "src",
"resolve": true,
"relative": true
},
{
"field": "include",
"resolve": true,
"relative": true
},
{
"field": "libraries",
"resolve": false,
"relative": false
},
{
"field": "libpath",
"resolve": true,
"relative": false
}
],
"confs": [
{
"os": "linux",
"blas": "",
"wasm": false,
"src": [
"./src/dswap.f",
"./src/dswap_f.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "linux",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "",
"wasm": false,
"src": [
"./src/dswap.f",
"./src/dswap_f.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "apple_accelerate_framework",
"wasm": false,
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lblas"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "mac",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dswap_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "win",
"blas": "",
"wasm": false,
"src": [
"./src/dswap.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/napi-export",
"@stdlib/napi-argv",
"@stdlib/napi-argv-int64",
"@stdlib/napi-argv-strided-float64array"
]
},
{
"os": "",
"blas": "",
"wasm": true,
"src": [
"./src/dswap.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
}
]
}
2 changes: 1 addition & 1 deletion src/addon.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 3 );
c_dswap( N, (double *)X, strideX, (double *)Y, strideY );
c_dswap( N, X, strideX, Y, strideY );
return NULL;
}

Expand Down
12 changes: 6 additions & 6 deletions test/test.dswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tape( 'main export is a function', function test( t ) {
});

tape( 'the function has an arity of 5', function test( t ) {
t.strictEqual( dswap.length, 5, 'arity of 5' );
t.strictEqual( dswap.length, 5, 'returns expected value' );
t.end();
});

Expand Down Expand Up @@ -158,7 +158,7 @@ tape( 'the function returns a reference to the second input array', function tes

out = dswap( x.length, x, 1, y, 1 );

t.strictEqual( out, y, 'same reference' );
t.strictEqual( out, y, 'returns expected value' );
t.end();
});

Expand All @@ -178,12 +178,12 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function leav
dcopy( y.length, y, 1, ye, 1 );

dswap( -1, x, 1, y, 1 );
t.deepEqual( x, xe, 'leaves `x` unchanged' );
t.deepEqual( y, ye, 'leaves `y` unchanged' );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );

dswap( 0, x, 1, y, 1 );
t.deepEqual( x, xe, 'leaves `x` unchanged' );
t.deepEqual( y, ye, 'leaves `y` unchanged' );
t.deepEqual( x, xe, 'returns expected value' );
t.deepEqual( y, ye, 'returns expected value' );

t.end();
});
Expand Down
Loading

0 comments on commit 01151b2

Please sign in to comment.