Skip to content

Commit 2fa27d7

Browse files
committed
refactor: update implementation according to current project conventions
Ref: #788
1 parent 3818752 commit 2fa27d7

File tree

8 files changed

+199
-178
lines changed

8 files changed

+199
-178
lines changed

lib/node_modules/@stdlib/blas/base/sswap/examples/c/example.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
int main( void ) {
2323
// Create strided arrays:
24-
float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
25-
float y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
24+
float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
25+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
2626

2727
// Specify the number of indexed elements:
28-
int N = 4;
28+
const int N = 4;
2929

3030
// Specify stride lengths:
31-
int strideX = 2;
32-
int strideY = -2;
31+
const int strideX = 2;
32+
const int strideY = -2;
3333

3434
// Interchange elements:
3535
c_sswap( N, x, strideX, y, strideY );
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,169 @@
11
{
2-
"options": {
3-
"os": "linux",
4-
"blas": ""
5-
},
6-
"fields": [
7-
{
8-
"field": "src",
9-
"resolve": true,
10-
"relative": true
11-
},
12-
{
13-
"field": "include",
14-
"resolve": true,
15-
"relative": true
16-
},
17-
{
18-
"field": "libraries",
19-
"resolve": false,
20-
"relative": false
21-
},
22-
{
23-
"field": "libpath",
24-
"resolve": true,
25-
"relative": false
26-
}
27-
],
28-
"confs": [
29-
{
30-
"os": "linux",
31-
"blas": "",
32-
"src": [
33-
"./src/sswap.f",
34-
"./src/sswap_f.c"
35-
],
36-
"include": [
37-
"./include"
38-
],
39-
"libraries": [],
40-
"libpath": [],
41-
"dependencies": [
42-
"@stdlib/napi/export",
43-
"@stdlib/napi/argv",
44-
"@stdlib/napi/argv-int64",
45-
"@stdlib/napi/argv-strided-float32array"
46-
]
47-
},
48-
{
49-
"os": "linux",
50-
"blas": "openblas",
51-
"src": [
52-
"./src/sswap_cblas.c"
53-
],
54-
"include": [
55-
"./include"
56-
],
57-
"libraries": [
58-
"-lopenblas",
59-
"-lpthread"
60-
],
61-
"libpath": [],
62-
"dependencies": [
63-
"@stdlib/napi/export",
64-
"@stdlib/napi/argv",
65-
"@stdlib/napi/argv-int64",
66-
"@stdlib/napi/argv-strided-float32array"
67-
]
68-
},
69-
{
70-
"os": "mac",
71-
"blas": "",
72-
"src": [
73-
"./src/sswap.f",
74-
"./src/sswap_f.c"
75-
],
76-
"include": [
77-
"./include"
78-
],
79-
"libraries": [],
80-
"libpath": [],
81-
"dependencies": [
82-
"@stdlib/napi/export",
83-
"@stdlib/napi/argv",
84-
"@stdlib/napi/argv-int64",
85-
"@stdlib/napi/argv-strided-float32array"
86-
]
87-
},
88-
{
89-
"os": "mac",
90-
"blas": "apple_accelerate_framework",
91-
"src": [
92-
"./src/sswap_cblas.c"
93-
],
94-
"include": [
95-
"./include"
96-
],
97-
"libraries": [
98-
"-lblas"
99-
],
100-
"libpath": [],
101-
"dependencies": [
102-
"@stdlib/napi/export",
103-
"@stdlib/napi/argv",
104-
"@stdlib/napi/argv-int64",
105-
"@stdlib/napi/argv-strided-float32array"
106-
]
107-
},
108-
{
109-
"os": "mac",
110-
"blas": "openblas",
111-
"src": [
112-
"./src/sswap_cblas.c"
113-
],
114-
"include": [
115-
"./include"
116-
],
117-
"libraries": [
118-
"-lopenblas",
119-
"-lpthread"
120-
],
121-
"libpath": [],
122-
"dependencies": [
123-
"@stdlib/napi/export",
124-
"@stdlib/napi/argv",
125-
"@stdlib/napi/argv-int64",
126-
"@stdlib/napi/argv-strided-float32array"
127-
]
128-
},
129-
{
130-
"os": "win",
131-
"blas": "",
132-
"src": [
133-
"./src/sswap.c"
134-
],
135-
"include": [
136-
"./include"
137-
],
138-
"libraries": [],
139-
"libpath": [],
140-
"dependencies": [
141-
"@stdlib/napi/export",
142-
"@stdlib/napi/argv",
143-
"@stdlib/napi/argv-int64",
144-
"@stdlib/napi/argv-strided-float32array"
145-
]
146-
}
147-
]
2+
"options": {
3+
"os": "linux",
4+
"blas": "",
5+
"wasm": false
6+
},
7+
"fields": [
8+
{
9+
"field": "src",
10+
"resolve": true,
11+
"relative": true
12+
},
13+
{
14+
"field": "include",
15+
"resolve": true,
16+
"relative": true
17+
},
18+
{
19+
"field": "libraries",
20+
"resolve": false,
21+
"relative": false
22+
},
23+
{
24+
"field": "libpath",
25+
"resolve": true,
26+
"relative": false
27+
}
28+
],
29+
"confs": [
30+
{
31+
"os": "linux",
32+
"blas": "",
33+
"wasm": false,
34+
"src": [
35+
"./src/sswap.f",
36+
"./src/sswap_f.c"
37+
],
38+
"include": [
39+
"./include"
40+
],
41+
"libraries": [],
42+
"libpath": [],
43+
"dependencies": [
44+
"@stdlib/napi/export",
45+
"@stdlib/napi/argv",
46+
"@stdlib/napi/argv-int64",
47+
"@stdlib/napi/argv-strided-float32array"
48+
]
49+
},
50+
{
51+
"os": "linux",
52+
"blas": "openblas",
53+
"wasm": false,
54+
"src": [
55+
"./src/sswap_cblas.c"
56+
],
57+
"include": [
58+
"./include"
59+
],
60+
"libraries": [
61+
"-lopenblas",
62+
"-lpthread"
63+
],
64+
"libpath": [],
65+
"dependencies": [
66+
"@stdlib/napi/export",
67+
"@stdlib/napi/argv",
68+
"@stdlib/napi/argv-int64",
69+
"@stdlib/napi/argv-strided-float32array"
70+
]
71+
},
72+
{
73+
"os": "mac",
74+
"blas": "",
75+
"wasm": false,
76+
"src": [
77+
"./src/sswap.f",
78+
"./src/sswap_f.c"
79+
],
80+
"include": [
81+
"./include"
82+
],
83+
"libraries": [],
84+
"libpath": [],
85+
"dependencies": [
86+
"@stdlib/napi/export",
87+
"@stdlib/napi/argv",
88+
"@stdlib/napi/argv-int64",
89+
"@stdlib/napi/argv-strided-float32array"
90+
]
91+
},
92+
{
93+
"os": "mac",
94+
"blas": "apple_accelerate_framework",
95+
"wasm": false,
96+
"src": [
97+
"./src/sswap_cblas.c"
98+
],
99+
"include": [
100+
"./include"
101+
],
102+
"libraries": [
103+
"-lblas"
104+
],
105+
"libpath": [],
106+
"dependencies": [
107+
"@stdlib/napi/export",
108+
"@stdlib/napi/argv",
109+
"@stdlib/napi/argv-int64",
110+
"@stdlib/napi/argv-strided-float32array"
111+
]
112+
},
113+
{
114+
"os": "mac",
115+
"blas": "openblas",
116+
"wasm": false,
117+
"src": [
118+
"./src/sswap_cblas.c"
119+
],
120+
"include": [
121+
"./include"
122+
],
123+
"libraries": [
124+
"-lopenblas",
125+
"-lpthread"
126+
],
127+
"libpath": [],
128+
"dependencies": [
129+
"@stdlib/napi/export",
130+
"@stdlib/napi/argv",
131+
"@stdlib/napi/argv-int64",
132+
"@stdlib/napi/argv-strided-float32array"
133+
]
134+
},
135+
{
136+
"os": "win",
137+
"blas": "",
138+
"wasm": false,
139+
"src": [
140+
"./src/sswap.c"
141+
],
142+
"include": [
143+
"./include"
144+
],
145+
"libraries": [],
146+
"libpath": [],
147+
"dependencies": [
148+
"@stdlib/napi/export",
149+
"@stdlib/napi/argv",
150+
"@stdlib/napi/argv-int64",
151+
"@stdlib/napi/argv-strided-float32array"
152+
]
153+
},
154+
{
155+
"os": "",
156+
"blas": "",
157+
"wasm": true,
158+
"src": [
159+
"./src/sswap.c"
160+
],
161+
"include": [
162+
"./include"
163+
],
164+
"libraries": [],
165+
"libpath": [],
166+
"dependencies": []
167+
}
168+
]
148169
}

lib/node_modules/@stdlib/blas/base/sswap/src/addon.c

+1-1
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_INT64( env, strideY, argv, 4 );
3939
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
4040
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 3 );
41-
c_sswap( N, (float *)X, strideX, (float *)Y, strideY );
41+
c_sswap( N, X, strideX, Y, strideY );
4242
return NULL;
4343
}
4444

lib/node_modules/@stdlib/blas/base/sswap/test/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ tape( 'if a native implementation is available, the main export is the native im
5151
'@stdlib/utils/try-require': tryRequire
5252
});
5353

54-
t.strictEqual( sswap, mock, 'returns native implementation' );
54+
t.strictEqual( sswap, mock, 'returns expected value' );
5555
t.end();
5656

5757
function tryRequire() {
@@ -73,7 +73,7 @@ tape( 'if a native implementation is not available, the main export is a JavaScr
7373
'@stdlib/utils/try-require': tryRequire
7474
});
7575

76-
t.strictEqual( sswap, main, 'returns JavaScript implementation' );
76+
t.strictEqual( sswap, main, 'returns expected value' );
7777
t.end();
7878

7979
function tryRequire() {

lib/node_modules/@stdlib/blas/base/sswap/test/test.ndarray.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tape( 'main export is a function', function test( t ) {
3535
});
3636

3737
tape( 'the function has an arity of 7', function test( t ) {
38-
t.strictEqual( sswap.length, 7, 'arity of 7' );
38+
t.strictEqual( sswap.length, 7, 'returns expected value' );
3939
t.end();
4040
});
4141

@@ -224,7 +224,7 @@ tape( 'the function returns a reference to the second input array', function tes
224224

225225
out = sswap( x.length, x, 1, 0, y, 1, 0 );
226226

227-
t.strictEqual( out, y, 'same reference' );
227+
t.strictEqual( out, y, 'returns expected value' );
228228
t.end();
229229
});
230230

@@ -244,12 +244,12 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function leav
244244
scopy( y.length, y, 1, 0, ye, 1, 0 );
245245

246246
sswap( -1, x, 1, 0, y, 1, 0 );
247-
t.deepEqual( x, xe, 'leaves `x` unchanged' );
248-
t.deepEqual( y, ye, 'leaves `y` unchanged' );
247+
t.deepEqual( x, xe, 'returns expected value' );
248+
t.deepEqual( y, ye, 'returns expected value' );
249249

250250
sswap( 0, x, 1, 0, y, 1, 0 );
251-
t.deepEqual( x, xe, 'leaves `x` unchanged' );
252-
t.deepEqual( y, ye, 'leaves `y` unchanged' );
251+
t.deepEqual( x, xe, 'returns expected value' );
252+
t.deepEqual( y, ye, 'returns expected value' );
253253

254254
t.end();
255255
});

0 commit comments

Comments
 (0)