Skip to content

Commit 5c0bf73

Browse files
committed
chore: update indentation
1 parent 6d81a32 commit 5c0bf73

File tree

4 files changed

+69
-50
lines changed

4 files changed

+69
-50
lines changed

lib/node_modules/@stdlib/blas/base/zdscal/lib/ndarray.native.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,26 @@ function zdscal( N, alpha, x, strideX, offsetX ) {
5050
addon.ndarray( N, alpha, viewX, strideX, offsetX );
5151
return x;
5252
}
53+
var Complex128Array = require( '@stdlib/array/complex128' );
5354

55+
var x = new Complex128Array( [ 0.1, // 3
56+
0.1, // 3
57+
3.0,
58+
6.0,
59+
-0.6, // 2
60+
0.1, // 2
61+
4.0,
62+
7.0,
63+
0.1, // 1
64+
-0.3, // 1
65+
7.0,
66+
2.0 ] );
67+
68+
console.log(zdscal(3, 2.0, x, -2, 4));
69+
for (let i = 0; i < x.length; i++) {
70+
const v = x.get(i); // returns { re, im }
71+
console.log(`x[${i}] = ${v.re} + ${v.im}i`);
72+
}
5473

5574
// EXPORTS //
5675

lib/node_modules/@stdlib/blas/base/zdscal/src/zdscal_cblas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void API_SUFFIX(c_zdscal_ndarray)( const CBLAS_INT N, const double alpha, void *
5353

5454
x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer
5555
if ( sx < 0 ) {
56-
sx = -sx;
57-
}
56+
sx = -sx;
57+
}
5858
API_SUFFIX(cblas_zdscal)( N, alpha, (void *)x, sx );
5959
}

lib/node_modules/@stdlib/blas/base/zdscal/src/zdscal_ndarray.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@
3131
* @param offsetX starting index for X
3232
*/
3333
void API_SUFFIX(c_zdscal_ndarray)( const CBLAS_INT N, const double alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
34-
stdlib_complex128_t z;
35-
int64_t is1;
36-
int64_t i;
34+
stdlib_complex128_t *x = (stdlib_complex128_t *)X;
35+
CBLAS_INT ix;
36+
CBLAS_INT sx;
37+
CBLAS_INT i;
3738

38-
if ( N <= 0 || alpha == 1.0 ) {
39-
return;
40-
}
41-
stdlib_complex128_t *ip1 = (stdlib_complex128_t *)X;
42-
is1 = (int64_t)strideX;
43-
ip1 += offsetX;
44-
for ( i = 0; i < N; i++, ip1 += is1 ) {
45-
z = *ip1;
46-
*ip1 = stdlib_base_complex128_scale( alpha, z );
47-
}
48-
return;
39+
if ( N <= 0 || alpha == 1.0 ) {
40+
return;
41+
}
42+
sx = strideX;
43+
ix = offsetX;
44+
for ( i = 0; i < N; i++ ) {
45+
x[ ix ] = stdlib_base_complex128_scale( alpha, x[ ix ] );
46+
ix += sx;
47+
}
48+
return;
4949
}

lib/node_modules/@stdlib/blas/base/zdscal/test/test.ndarray.native.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ tape( 'the function has an arity of 5', opts, function test( t ) {
4848
t.end();
4949
});
5050

51-
tape( 'the function scales elements from `zx` by `da`', opts, function test( t ) {
51+
tape( 'the function scales elements from `x` by `alpha`', opts, function test( t ) {
5252
var expected;
53-
var zx;
53+
var x;
5454

55-
zx = new Complex128Array([
55+
x = new Complex128Array([
5656
0.3, // 1
5757
0.1, // 1
5858
0.5, // 2
@@ -67,7 +67,7 @@ tape( 'the function scales elements from `zx` by `da`', opts, function test( t )
6767
3.0
6868
]);
6969

70-
zdscal( 4, 2.0, zx, 1, 0 );
70+
zdscal( 4, 2.0, x, 1, 0 );
7171

7272
expected = new Complex128Array([
7373
0.6, // 1
@@ -83,15 +83,15 @@ tape( 'the function scales elements from `zx` by `da`', opts, function test( t )
8383
2.0,
8484
3.0
8585
]);
86-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
86+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
8787
t.end();
8888
});
8989

90-
tape( 'the function supports a `zx` stride', opts, function test( t ) {
90+
tape( 'the function supports a `x` stride', opts, function test( t ) {
9191
var expected;
92-
var zx;
92+
var x;
9393

94-
zx = new Complex128Array([
94+
x = new Complex128Array([
9595
0.1, // 1
9696
0.1, // 1
9797
3.0,
@@ -106,7 +106,7 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) {
106106
2.0
107107
]);
108108

109-
zdscal( 3, 2.0, zx, 2, 0 );
109+
zdscal( 3, 2.0, x, 2, 0 );
110110

111111
expected = new Complex128Array([
112112
0.2, // 1
@@ -122,15 +122,15 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) {
122122
7.0,
123123
2.0
124124
]);
125-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
125+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
126126
t.end();
127127
});
128128

129-
tape( 'the function supports a negative `zx` stride', opts, function test( t ) {
129+
tape( 'the function supports a negative `x` stride', opts, function test( t ) {
130130
var expected;
131-
var zx;
131+
var x;
132132

133-
zx = new Complex128Array([
133+
x = new Complex128Array([
134134
0.1, // 3
135135
0.1, // 3
136136
3.0,
@@ -145,7 +145,7 @@ tape( 'the function supports a negative `zx` stride', opts, function test( t ) {
145145
2.0
146146
]);
147147

148-
zdscal( 3, 2.0, zx, -2, 4 );
148+
zdscal( 3, 2.0, x, -2, 4 );
149149

150150
expected = new Complex128Array([
151151
0.2, // 3
@@ -161,15 +161,15 @@ tape( 'the function supports a negative `zx` stride', opts, function test( t ) {
161161
7.0,
162162
2.0
163163
]);
164-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
164+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
165165
t.end();
166166
});
167167

168-
tape( 'the function supports a `zx` offset', opts, function test( t ) {
168+
tape( 'the function supports a `x` offset', opts, function test( t ) {
169169
var expected;
170-
var zx;
170+
var x;
171171

172-
zx = new Complex128Array([
172+
x = new Complex128Array([
173173
0.1,
174174
0.1,
175175
3.0,
@@ -184,7 +184,7 @@ tape( 'the function supports a `zx` offset', opts, function test( t ) {
184184
2.0 // 3
185185
]);
186186

187-
zdscal( 3, 2.0, zx, 1, 3 );
187+
zdscal( 3, 2.0, x, 1, 3 );
188188

189189
expected = new Complex128Array([
190190
0.1,
@@ -200,43 +200,43 @@ tape( 'the function supports a `zx` offset', opts, function test( t ) {
200200
14.0, // 3
201201
4.0 // 3
202202
]);
203-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
203+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
204204
t.end();
205205
});
206206

207207
tape( 'the function returns a reference to the input array', opts, function test( t ) {
208208
var out;
209-
var zx;
209+
var x;
210210

211-
zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
212-
out = zdscal( 4, 2.0, zx, 1, 0 );
211+
x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
212+
out = zdscal( 4, 2.0, x, 1, 0 );
213213

214-
t.strictEqual( out, zx, 'same reference' );
214+
t.strictEqual( out, x, 'same reference' );
215215
t.end();
216216
});
217217

218218
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) {
219219
var expected;
220-
var zx;
220+
var x;
221221

222-
zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
222+
x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
223223

224224
expected = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); // eslint-disable-line max-len
225225

226-
zdscal( -1, 2.0, zx, 1, 0 );
227-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
226+
zdscal( -1, 2.0, x, 1, 0 );
227+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
228228

229-
zdscal( 0, 2.0, zx, 1, 0 );
230-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
229+
zdscal( 0, 2.0, x, 1, 0 );
230+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
231231

232232
t.end();
233233
});
234234

235235
tape( 'the function supports complex access patterns', opts, function test( t ) {
236236
var expected;
237-
var zx;
237+
var x;
238238

239-
zx = new Complex128Array([
239+
x = new Complex128Array([
240240
0.1,
241241
0.1,
242242
3.0,
@@ -253,7 +253,7 @@ tape( 'the function supports complex access patterns', opts, function test( t )
253253
3.0 // 1
254254
]);
255255

256-
zdscal( 2, 2.0, zx, -3, 6 );
256+
zdscal( 2, 2.0, x, -3, 6 );
257257

258258
expected = new Complex128Array([
259259
0.1,
@@ -271,6 +271,6 @@ tape( 'the function supports complex access patterns', opts, function test( t )
271271
4.0, // 1
272272
6.0 // 1
273273
]);
274-
t.strictEqual( isSameComplex128Array( zx, expected ), true, 'returns expected value' );
274+
t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' );
275275
t.end();
276276
});

0 commit comments

Comments
 (0)