Skip to content

Commit 7de1f33

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent c0e5699 commit 7de1f33

File tree

10 files changed

+262
-284
lines changed

10 files changed

+262
-284
lines changed

lib/node_modules/@stdlib/ndarray/base/pop/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# pop
2222

23-
> Return an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
23+
> Return an array containing a truncated view of an input ndarray and a view of the last element(s) along a specified dimension.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -40,9 +40,9 @@ limitations under the License.
4040
var pop = require( '@stdlib/ndarray/base/pop' );
4141
```
4242

43-
#### pop( x, dim, strict, writable )
43+
#### pop( x, dim, writable )
4444

45-
Returns an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
45+
Returns an array containing a truncated view of an input ndarray and a view of the last element(s) along a specified dimension.
4646

4747
```javascript
4848
var ndarray = require( '@stdlib/ndarray/ctor' );
@@ -62,7 +62,7 @@ var sh = x.shape;
6262
var arr = ndarray2array( x );
6363
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
6464

65-
var y = pop( x, 0, false, false );
65+
var y = pop( x, 0, false );
6666
// returns [ <ndarray>, <ndarray> ]
6767

6868
arr = ndarray2array( y[ 0 ] );
@@ -76,7 +76,6 @@ The function accepts the following arguments:
7676

7777
- **x**: input ndarray.
7878
- **dim**: dimension along which to perform the operation. If provided an integer less than zero, the dimension index is resolved relative to the last dimension, with the last dimension corresponding to the value `-1`.
79-
- **strict**: boolean indicating whether to enforce strict bounds checking.
8079
- **writable**: boolean indicating whether a returned ndarray should be writable.
8180

8281
</section>
@@ -109,17 +108,17 @@ var ndarray2array = require( '@stdlib/ndarray/to-array' );
109108
var zeroTo = require( '@stdlib/array/base/zero-to' );
110109
var pop = require( '@stdlib/ndarray/base/pop' );
111110

112-
// Create a linear ndarray buffer:
111+
// Create a linear data buffer:
113112
var buf = zeroTo( 27 );
114113

115-
// Create an ndarray which is a stack of three 3x3 matrices:
114+
// Create an ndarray:
116115
var x = array( buf, {
117116
'shape': [ 3, 3, 3 ]
118117
});
118+
console.log( ndarray2array( x ) );
119119

120-
// Get the first two rows of each matrix:
121-
var y = pop( x, 1, false, false );
122-
// returns [ <ndarray>, <ndarray> ]
120+
// Remove the last row from each matrix:
121+
var y = pop( x, 1, false );
123122

124123
console.log( ndarray2array( y[ 0 ] ) );
125124
console.log( ndarray2array( y[ 1 ] ) );

lib/node_modules/@stdlib/ndarray/base/pop/benchmark/benchmark.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bench( pkg+'::1d', function benchmark( b ) {
4848

4949
b.tic();
5050
for ( i = 0; i < b.iterations; i++ ) {
51-
v = pop( values[ i%values.length ], 0, false, false );
51+
v = pop( values[ i%values.length ], 0, false );
5252
if ( typeof v !== 'object' ) {
5353
b.fail( 'should return an array of ndarrays' );
5454
}
@@ -66,21 +66,21 @@ bench( pkg+'::2d', function benchmark( b ) {
6666
var v;
6767
var i;
6868

69-
/* eslint-disable object-curly-newline */
69+
/* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
7070

7171
values = [
72-
empty( [ 2, 2 ], { 'dtype': 'float64' }),
73-
empty( [ 2, 2 ], { 'dtype': 'float32' }),
74-
empty( [ 2, 2 ], { 'dtype': 'int32' }),
75-
empty( [ 2, 2 ], { 'dtype': 'complex128' }),
76-
empty( [ 2, 2 ], { 'dtype': 'generic' })
72+
empty( [ 2, 2 ], { 'dtype': 'float64' } ),
73+
empty( [ 2, 2 ], { 'dtype': 'float32' } ),
74+
empty( [ 2, 2 ], { 'dtype': 'int32' } ),
75+
empty( [ 2, 2 ], { 'dtype': 'complex128' } ),
76+
empty( [ 2, 2 ], { 'dtype': 'generic' } )
7777
];
7878

79-
/* eslint-enable object-curly-newline */
79+
/* eslint-enable object-curly-newline, stdlib/line-closing-bracket-spacing */
8080

8181
b.tic();
8282
for ( i = 0; i < b.iterations; i++ ) {
83-
v = pop( values[ i%values.length ], 0, false, false );
83+
v = pop( values[ i%values.length ], 0, false );
8484
if ( typeof v !== 'object' ) {
8585
b.fail( 'should return an array of ndarrays' );
8686
}
@@ -98,21 +98,21 @@ bench( pkg+'::3d', function benchmark( b ) {
9898
var v;
9999
var i;
100100

101-
/* eslint-disable object-curly-newline */
101+
/* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
102102

103103
values = [
104-
empty( [ 2, 2, 2 ], { 'dtype': 'float64' }),
105-
empty( [ 2, 2, 2 ], { 'dtype': 'float32' }),
106-
empty( [ 2, 2, 2 ], { 'dtype': 'int32' }),
107-
empty( [ 2, 2, 2 ], { 'dtype': 'complex128' }),
108-
empty( [ 2, 2, 2 ], { 'dtype': 'generic' })
104+
empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ),
105+
empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ),
106+
empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ),
107+
empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ),
108+
empty( [ 2, 2, 2 ], { 'dtype': 'generic' } )
109109
];
110110

111-
/* eslint-enable object-curly-newline */
111+
/* eslint-enable object-curly-newline, stdlib/line-closing-bracket-spacing */
112112

113113
b.tic();
114114
for ( i = 0; i < b.iterations; i++ ) {
115-
v = pop( values[ i%values.length ], 0, false, false );
115+
v = pop( values[ i%values.length ], 0, false );
116116
if ( typeof v !== 'object' ) {
117117
b.fail( 'should return an array of ndarrays' );
118118
}
@@ -130,21 +130,21 @@ bench( pkg+'::4d', function benchmark( b ) {
130130
var v;
131131
var i;
132132

133-
/* eslint-disable object-curly-newline */
133+
/* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
134134

135135
values = [
136-
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' }),
137-
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' }),
138-
empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' }),
139-
empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' }),
140-
empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' })
136+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
137+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
138+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
139+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
140+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } )
141141
];
142142

143-
/* eslint-enable object-curly-newline */
143+
/* eslint-enable object-curly-newline, stdlib/line-closing-bracket-spacing */
144144

145145
b.tic();
146146
for ( i = 0; i < b.iterations; i++ ) {
147-
v = pop( values[ i%values.length ], 0, false, false );
147+
v = pop( values[ i%values.length ], 0, false );
148148
if ( typeof v !== 'object' ) {
149149
b.fail( 'should return an array of ndarrays' );
150150
}
@@ -162,21 +162,21 @@ bench( pkg+'::5d', function benchmark( b ) {
162162
var v;
163163
var i;
164164

165-
/* eslint-disable object-curly-newline */
165+
/* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
166166

167167
values = [
168-
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' }),
169-
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' }),
170-
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' }),
171-
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' }),
172-
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' })
168+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
169+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
170+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
171+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
172+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } )
173173
];
174174

175-
/* eslint-enable object-curly-newline */
175+
/* eslint-enable object-curly-newline, stdlib/line-closing-bracket-spacing */
176176

177177
b.tic();
178178
for ( i = 0; i < b.iterations; i++ ) {
179-
v = pop( values[ i%values.length ], 0, false, false );
179+
v = pop( values[ i%values.length ], 0, false );
180180
if ( typeof v !== 'object' ) {
181181
b.fail( 'should return an array of ndarrays' );
182182
}

lib/node_modules/@stdlib/ndarray/base/pop/docs/repl.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11

2-
{{alias}}( x, dim, strict, writable )
3-
Returns an array containing a truncated view of an input ndarray and a
4-
complementary view of the last element(s) along a specified dimension.
2+
{{alias}}( x, dim, writable )
3+
Returns an array containing a truncated view of an input ndarray and a view
4+
of the last element(s) along a specified dimension.
55

66
Parameters
77
----------
88
x: ndarray
9-
Input array.
9+
Input ndarray.
1010

1111
dim: integer
1212
Dimension along which to perform the operation. If provided an integer
1313
less than zero, the dimension index is resolved relative to the last
1414
dimension, with the last dimension corresponding to the value `-1`.
1515

16-
strict: boolean
17-
Boolean indicating whether to enforce strict bounds checking.
18-
1916
writable: boolean
2017
Boolean indicating whether a returned ndarray should be writable. This
2118
parameter only applies to ndarray constructors which support read-only
2219
instances.
2320

2421
Returns
2522
-------
26-
out: array
27-
Output array.
23+
out: Array<ndarray>
24+
An array containing a truncated view of an input ndarray and a view of
25+
the last element(s) along a specified dimension.
2826

2927
Examples
3028
--------
3129
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] )
3230
<ndarray>
33-
> var y = {{alias}}( x, 1, false, false )
31+
> var y = {{alias}}( x, 1, false )
3432
[ <ndarray>, <ndarray> ]
3533
> {{alias:@stdlib/ndarray/to-array}}( y[0] )
3634
[ [ 1 ], [ 3 ] ]

lib/node_modules/@stdlib/ndarray/base/pop/docs/types/index.d.ts

Lines changed: 4 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { typedndarray, genericndarray } from '@stdlib/types/ndarray';
24-
import { ComplexLike } from '@stdlib/types/complex';
25-
import { ArrayLike } from '@stdlib/types/array';
26-
23+
import { ndarray } from '@stdlib/types/ndarray';
2724

2825
/**
29-
* Returns an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
26+
* Returns an array containing a truncated view of an input ndarray and a view of the last element(s) along a specified dimension.
3027
*
3128
* @param x - input array
3229
* @param dim - dimension along which to perform the operation
33-
* @param strict - boolean indicating whether to enforce strict bounds checking
3430
* @param writable - boolean indicating whether returned arrays should be writable
3531
* @returns a list of ndarrays
3632
*
@@ -50,114 +46,7 @@ import { ArrayLike } from '@stdlib/types/array';
5046
* var arr = ndarray2array( x );
5147
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
5248
*
53-
* var y = pop( x, 0, false, false );
54-
* // returns [ <ndarray>, <ndarray> ]
55-
*
56-
* arr = ndarray2array( y[ 0 ] );
57-
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
58-
*
59-
* arr = ndarray2array( y[ 1 ] );
60-
* // returns [ [ 5.0, 6.0 ] ]
61-
*/
62-
declare function pop<T extends typedndarray<number> = typedndarray<number>>( x: T, dim: number, strict: boolean, writable: boolean ): ArrayLike<T>;
63-
64-
/**
65-
* Returns an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
66-
*
67-
* @param x - input array
68-
* @param dim - dimension along which to perform the operation
69-
* @param strict - boolean indicating whether to enforce strict bounds checking
70-
* @param writable - boolean indicating whether returned arrays should be writable
71-
* @returns a list of ndarrays
72-
*
73-
* @example
74-
* var Complex64Array = require( '@stdlib/array/complex64' );
75-
* var ndarray = require( '@stdlib/ndarray/ctor' );
76-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
77-
*
78-
* var buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
79-
* var shape = [ 2, 2 ];
80-
* var strides = [ 2, 1 ];
81-
* var offset = 0;
82-
*
83-
* var x = ndarray( 'complex64', buffer, shape, strides, offset, 'row-major' );
84-
* // returns <ndarray>
85-
*
86-
* var arr = ndarray2array( x );
87-
* // returns [ [ 1.0, 2.0, 3.0, 4.0 ], [ 5.0, 6.0, 7.0, 8.0 ] ]
88-
*
89-
* var y = pop( x, 0, false, false );
90-
* // returns [ <ndarray>, <ndarray> ]
91-
*
92-
* arr = ndarray2array( y[ 0 ] );
93-
* // returns [ [ 1.0, 2.0 ], [ 5.0, 6.0 ] ]
94-
*
95-
* arr = ndarray2array( y[ 1 ] );
96-
* // returns [ [ 2.0, 3.0 ], [ 7.0, 8.0 ] ]
97-
*/
98-
declare function pop<T extends ComplexLike = ComplexLike, U extends typedndarray<T> = typedndarray<T>>( x: U, dim: number, strict: boolean, writable: boolean ): ArrayLike<U>;
99-
100-
/**
101-
* Returns an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
102-
*
103-
* @param x - input array
104-
* @param dim - dimension along which to perform the operation
105-
* @param strict - boolean indicating whether to enforce strict bounds checking
106-
* @param writable - boolean indicating whether returned arrays should be writable
107-
* @returns a list of ndarrays
108-
*
109-
* @example
110-
* var BooleanArray = require( '@stdlib/array/bool' );
111-
* var ndarray = require( '@stdlib/ndarray/ctor' );
112-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
113-
*
114-
* var buffer = new BooleanArray( [ true, false, true, false, true, false ] );
115-
* var shape = [ 3, 2 ];
116-
* var strides = [ 2, 1 ];
117-
* var offset = 0;
118-
*
119-
* var x = ndarray( 'uint8c', buffer, shape, strides, offset, 'row-major' );
120-
* // returns <ndarray>
121-
*
122-
* var arr = ndarray2array( x );
123-
* // returns [ [ true, false ], [ true, false ], [ true, false ] ]
124-
*
125-
* var y = pop( x, 0, false, false );
126-
* // returns [ <ndarray>, <ndarray> ]
127-
*
128-
* arr = ndarray2array( y[ 0 ] );
129-
* // returns [ [ true, false ], [ true, false ] ]
130-
*
131-
* arr = ndarray2array( y[ 1 ] );
132-
* // returns [ [ true, false ] ]
133-
*/
134-
declare function pop<T extends typedndarray<boolean> = typedndarray<boolean>>( x: T, dim: number, strict: boolean, writable: boolean ): ArrayLike<T>;
135-
136-
/**
137-
* Returns an array containing a truncated view of an input ndarray and a complementary view of the last element(s) along a specified dimension.
138-
*
139-
* @param x - input array
140-
* @param dim - dimension along which to perform the operation
141-
* @param strict - boolean indicating whether to enforce strict bounds checking
142-
* @param writable - boolean indicating whether returned arrays should be writable
143-
* @returns a list of ndarrays
144-
*
145-
* @example
146-
* var ndarray = require( '@stdlib/ndarray/ctor' );
147-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
148-
*
149-
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
150-
* var shape = [ 3, 2 ];
151-
* var strides = [ 2, 1 ];
152-
* var offset = 0;
153-
*
154-
* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
155-
* // returns <ndarray>
156-
*
157-
* var arr = ndarray2array( x );
158-
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
159-
*
160-
* var y = pop( x, 0, false, false );
49+
* var y = pop( x, 0, false );
16150
* // returns [ <ndarray>, <ndarray> ]
16251
*
16352
* arr = ndarray2array( y[ 0 ] );
@@ -166,7 +55,7 @@ declare function pop<T extends typedndarray<boolean> = typedndarray<boolean>>( x
16655
* arr = ndarray2array( y[ 1 ] );
16756
* // returns [ [ 5.0, 6.0 ] ]
16857
*/
169-
declare function pop<T = unknown, U extends genericndarray<T> = genericndarray<T>>( x: U, dim: number, strict: boolean, writable: boolean ): ArrayLike<U>;
58+
declare function pop<T extends ndarray = ndarray>( x: T, dim: number, writable: boolean ): [ T, T ];
17059

17160

17261
// EXPORTS //

0 commit comments

Comments
 (0)