Skip to content

Commit ad15302

Browse files
committed
refactor: apply suggestions from code review
1 parent 3b4d986 commit ad15302

File tree

8 files changed

+1433
-87
lines changed

8 files changed

+1433
-87
lines changed

lib/node_modules/@stdlib/ndarray/fill-slice/benchmark/benchmark.1d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function createBenchmark( len, shape, xtype, order ) {
6767

6868
b.tic();
6969
for ( i = 0; i < b.iterations; i++ ) {
70-
fillSlice( x, new MultiSlice( null ), i );
70+
fillSlice( x, i, new MultiSlice( null ) );
7171
if ( isnan( x.data[ i%len ] ) ) {
7272
b.fail( 'should not return NaN' );
7373
}

lib/node_modules/@stdlib/ndarray/fill-slice/benchmark/benchmark.2d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function createBenchmark( len, shape, xtype, order ) {
6969

7070
b.tic();
7171
for ( i = 0; i < b.iterations; i++ ) {
72-
fillSlice( x, new MultiSlice( null, null ), i );
72+
fillSlice( x, i, new MultiSlice( null, null ) );
7373
if ( isnan( x.data[ i%len ] ) ) {
7474
b.fail( 'should not return NaN' );
7575
}

lib/node_modules/@stdlib/ndarray/fill-slice/docs/repl.txt

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,49 @@
11

2-
{{alias}}( x, s, value )
3-
Fills an input ndarray with a specified value in the region defined by a
4-
MultiSlice.
2+
{{alias}}( x, value, ...s[, options] )
3+
Fills an input ndarray slice with a specified value.
54

6-
If `value` is a number and `x` has a complex data type, the function fills
7-
an input ndarray with a complex number whose real component equals the
8-
provided scalar `value` and whose imaginary component is zero.
5+
The function supports three (mutually exclusive) means of providing slice
6+
arguments:
97

10-
The function *mutates* the input ndarray.
8+
1. Providing a single MultiSlice object.
9+
2. Providing a single array containing slice arguments.
10+
3. Providing slice arguments as separate arguments.
11+
12+
An individual slice argument must be either a Slice, an integer, null, or
13+
undefined.
14+
15+
If providing a MultiSlice object or an array of slice arguments, no other
16+
slice arguments should be provided.
17+
18+
Mixing function invocation styles (e.g., providing multiple MultiSlice
19+
objects or providing an array of slice arguments followed by additional
20+
slice arguments) is not supported.
1121

1222
Parameters
1323
----------
14-
x: ndarrayLike
24+
x: ndarray
1525
Input ndarray.
1626

17-
s: MultiSlice
18-
MultiSlice instance.
19-
2027
value: any
2128
Scalar value. Must be able to safely cast to the input ndarray data
2229
type. Scalar values having floating-point data types (both real and
2330
complex) are allowed to downcast to a lower precision data type of the
2431
same kind (e.g., a scalar double-precision floating-point number can be
2532
used to fill a 'float32' input ndarray).
2633

34+
s: ...MultiSlice|Slice|null|undefined|integer|ArrayLike
35+
Slice arguments.
36+
37+
options: Object (optional)
38+
Options.
39+
40+
options.strict: boolean (optional)
41+
Boolean indicating whether to enforce strict bounds checking.
42+
Default: true.
43+
2744
Returns
2845
-------
29-
out: ndarrayLike
46+
out: ndarray
3047
Input ndarray.
3148

3249
Examples
@@ -37,7 +54,7 @@
3754
> var s0 = new {{alias:@stdlib/slice/ctor}}( 0, 1 );
3855
> var s1 = new {{alias:@stdlib/slice/ctor}}( null, null );
3956
> var s = new {{alias:@stdlib/slice/multi}}( s0, s1 );
40-
> {{alias}}( x, s, 10.0 );
57+
> {{alias}}( x, 10.0, s );
4158
> x.get( 0, 0 )
4259
10.0
4360

0 commit comments

Comments
 (0)