Skip to content

Commit 799acef

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: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e60e690 commit 799acef

File tree

8 files changed

+38
-70
lines changed

8 files changed

+38
-70
lines changed

lib/node_modules/@stdlib/stats/base/cumax/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The function has the following additional parameters:
102102
- **offsetX**: starting index for `x`.
103103
- **offsetY**: starting index for `y`.
104104

105-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative maximum of every other value in `x` starting from the second value and to store in the last `N` elements of `y` starting from the last element
105+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative maximum of every other element in `x` starting from the second element and to store in the last `N` elements of `y` starting from the last element
106106

107107
```javascript
108108
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];

lib/node_modules/@stdlib/stats/base/cumax/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var zeros = require( '@stdlib/array/zeros' );
2727
var gfill = require( '@stdlib/blas/ext/base/gfill' );
2828
var pow = require( '@stdlib/math/base/special/pow' );
2929
var pkg = require( './../package.json' ).name;
30-
var cumax = require( './../lib/cumax.js' );
30+
var cumax = require( './../lib' );
3131

3232

3333
// VARIABLES //

lib/node_modules/@stdlib/stats/base/cumax/docs/repl.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@
104104
// Advanced indexing:
105105
> x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ];
106106
> y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
107-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
108-
> {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 )
107+
> {{alias}}.ndarray( 3, x, 2, 1, y, -1, y.length-1 )
109108
[ 0.0, 0.0, 0.0, 2.0, 2.0, -2.0 ]
110109

111110
See Also

lib/node_modules/@stdlib/stats/base/cumax/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ var cumax = require( './../lib' );
2525
var x = discreteUniform( 10, 0, 100, {
2626
'dtype': 'float64'
2727
});
28-
var y = new Float64Array( x.length );
2928
console.log( x );
29+
30+
var y = new Float64Array( x.length );
3031
console.log( y );
3132

3233
cumax( x.length, x, 1, y, -1 );

lib/node_modules/@stdlib/stats/base/cumax/lib/cumax.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

lib/node_modules/@stdlib/stats/base/cumax/lib/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,30 @@
2828
*
2929
* var x = [ 1.0, -2.0, 2.0 ];
3030
* var y = [ 0.0, 0.0, 0.0 ];
31-
* var N = x.length;
3231
*
33-
* cumax( N, x, 1, y, 1 );
32+
* cumax( 3, x, 1, y, 1 );
3433
* // y => [ 1.0, 1.0, 2.0 ]
3534
*
3635
* @example
37-
* var floor = require( '@stdlib/math/base/special/floor' );
3836
* var cumax = require( '@stdlib/stats/base/cumax' );
3937
*
4038
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
4139
* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
42-
* var N = floor( x.length / 2 );
4340
*
44-
* cumax.ndarray( N, x, 2, 1, y, 1, 0 );
41+
* cumax.ndarray( 4, x, 2, 1, y, 1, 0 );
4542
* // y => [ 1.0, 1.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0 ]
4643
*/
4744

4845
// MODULES //
4946

47+
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
5048
var main = require( './main.js' );
49+
var ndarray = require( './ndarray.js' );
50+
51+
52+
// MAIN //
53+
54+
setReadOnly( main, 'ndarray', ndarray );
5155

5256

5357
// EXPORTS //

lib/node_modules/@stdlib/stats/base/cumax/lib/main.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,34 @@
2020

2121
// MODULES //
2222

23-
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
24-
var cumax = require( './cumax.js' );
23+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
2524
var ndarray = require( './ndarray.js' );
2625

2726

2827
// MAIN //
2928

30-
setReadOnly( cumax, 'ndarray', ndarray );
29+
/**
30+
* Computes the cumulative maximum of a strided array.
31+
*
32+
* @param {PositiveInteger} N - number of indexed elements
33+
* @param {NumericArray} x - input array
34+
* @param {integer} strideX - stride length for `x`
35+
* @param {NumericArray} y - output array
36+
* @param {integer} strideY - stride length for `y`
37+
* @returns {NumericArray} output array
38+
*
39+
* @example
40+
* var x = [ 1.0, -2.0, 2.0 ];
41+
* var y = [ 0.0, 0.0, 0.0 ];
42+
*
43+
* var v = cumax( 3, x, 1, y, 1 );
44+
* // returns [ 1.0, 1.0, 2.0 ]
45+
*/
46+
function cumax( N, x, strideX, y, strideY ) {
47+
var ix = stride2offset( N, strideX );
48+
var iy = stride2offset( N, strideY );
49+
return ndarray( N, x, strideX, ix, y, strideY, iy );
50+
}
3151

3252

3353
// EXPORTS //

lib/node_modules/@stdlib/stats/base/cumax/test/test.cumax.js renamed to lib/node_modules/@stdlib/stats/base/cumax/test/test.main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
2626
var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
2727
var Float64Array = require( '@stdlib/array/float64' );
28-
var cumax = require( './../lib/cumax.js' );
28+
var cumax = require( './../lib' );
2929

3030

3131
// TESTS //

0 commit comments

Comments
 (0)