Skip to content

Commit d187fb7

Browse files
Merge branch 'stdlib-js:develop' into tiny-random
2 parents e1939ca + 551a3e9 commit d187fb7

File tree

695 files changed

+165457
-2116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

695 files changed

+165457
-2116
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Krishnam Agarwal <[email protected]>
8282
Krishnendu Das <[email protected]>
8383
Kshitij-Dale <[email protected]>
8484
Lovelin Dhoni J B <[email protected]>
85+
8586
Manik Sharma <[email protected]>
8687
Manvith M <[email protected]>
8788
Marcus Fantham <[email protected]>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: amend-message
3+
---
4+
docs: update namespace TypeScript declarations
5+
6+
PR-URL: #5816
7+
8+
Reviewed-by: Philipp Burckhardt <[email protected]>
9+
Signed-off-by: stdlib-bot <[email protected]>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
type: amend-message
3+
---
4+
feat(stats): add C implementation for `stats/base/dists/hypergeometric/skewness`
5+
6+
PR-URL: #4560
7+
Closes: #3666
8+
9+
Co-authored-by: stdlib-bot <[email protected]>
10+
Reviewed-by: Philipp Burckhardt <[email protected]>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: amend-message
3+
---
4+
chore: address commit comments
5+
6+
PR-URL: #6011
7+
Progresses: #6002
8+
9+
Reviewed-by: Philipp Burckhardt <[email protected]>

lib/node_modules/@stdlib/_tools/makie/plugins/makie-list-pkgs-names/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
* @module @stdlib/_tools/makie/plugins/makie-list-pkgs-names
2525
*
2626
* @example
27-
* var plugin = require( '@stdlib/_tools/makie/plugins/makie-list-pkgs-names' );
2827
* var makie = require( '@stdlib/_tools/makie' );
28+
* var plugin = require( '@stdlib/_tools/makie/plugins/makie-list-pkgs-names' );
2929
* var opts = {
3030
* 'plugins': {
3131
* 'benchmark': plugin

lib/node_modules/@stdlib/array/base/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ The namespace exports the following:
109109
- <span class="signature">[`every( x )`][@stdlib/array/base/every]</span><span class="delimiter">: </span><span class="description">test whether all elements in an array are truthy.</span>
110110
- <span class="signature">[`fancySliceAssign( x, y, s, strict )`][@stdlib/array/base/fancy-slice-assign]</span><span class="delimiter">: </span><span class="description">assign element values from a broadcasted input array to corresponding elements in an output array.</span>
111111
- <span class="signature">[`fancySlice( x, s, strict )`][@stdlib/array/base/fancy-slice]</span><span class="delimiter">: </span><span class="description">return a shallow copy of a portion of an array.</span>
112+
- <span class="signature">[`fillBy( x, start, end, fcn[, thisArg] )`][@stdlib/array/base/fill-by]</span><span class="delimiter">: </span><span class="description">fill all elements within a portion of an array according to a callback function.</span>
112113
- <span class="signature">[`fill( x, value, start, end )`][@stdlib/array/base/fill]</span><span class="delimiter">: </span><span class="description">fill all elements within a portion of an array with a specified value.</span>
113114
- <span class="signature">[`filledBy( len, clbk[, thisArg] )`][@stdlib/array/base/filled-by]</span><span class="delimiter">: </span><span class="description">create a filled "generic" array according to a provided callback function.</span>
114115
- <span class="signature">[`filled( value, len )`][@stdlib/array/base/filled]</span><span class="delimiter">: </span><span class="description">create a filled "generic" array.</span>
@@ -431,6 +432,8 @@ var squared = ns.map2d( arr2d, [ 2, 3 ], randu );
431432

432433
[@stdlib/array/base/fancy-slice]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/fancy-slice
433434

435+
[@stdlib/array/base/fill-by]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/fill-by
436+
434437
[@stdlib/array/base/fill]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/fill
435438

436439
[@stdlib/array/base/filled-by]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/filled-by

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import everyByRight = require( '@stdlib/array/base/every-by-right' );
8585
import fancySlice = require( '@stdlib/array/base/fancy-slice' );
8686
import fancySliceAssign = require( '@stdlib/array/base/fancy-slice-assign' );
8787
import fill = require( '@stdlib/array/base/fill' );
88+
import fillBy = require( '@stdlib/array/base/fill-by' );
8889
import filled = require( '@stdlib/array/base/filled' );
8990
import filledBy = require( '@stdlib/array/base/filled-by' );
9091
import filled2d = require( '@stdlib/array/base/filled2d' );
@@ -1947,6 +1948,38 @@ interface Namespace {
19471948
*/
19481949
fill: typeof fill;
19491950

1951+
/**
1952+
* Fills all elements within a portion of an array according to a provided callback function.
1953+
*
1954+
* @param x - input array
1955+
* @param start - starting index (inclusive)
1956+
* @param end - ending index (exclusive)
1957+
* @param fcn - callback function
1958+
* @param thisArg - callback function execution context
1959+
* @returns modified input array
1960+
*
1961+
* @example
1962+
* function fcn() {
1963+
* return 4;
1964+
* }
1965+
*
1966+
* var x = [ 1, 2, 3 ];
1967+
*
1968+
* var out = ns.fillBy( x, 4, 0, 3 );
1969+
* // returns [ 4, 4, 4 ]
1970+
*
1971+
* @example
1972+
* function fcn() {
1973+
* return 8;
1974+
* }
1975+
*
1976+
* var x = [ 1, 2, 3, 4, 5, 6 ];
1977+
*
1978+
* var out = ns.fillBy( x, 8, 0, 3 );
1979+
* // returns [ 8, 8, 8, 4, 5, 6 ]
1980+
*/
1981+
fillBy: typeof fillBy;
1982+
19501983
/**
19511984
* Returns a filled "generic" array.
19521985
*
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# fillBy
22+
23+
> Fill all elements within a portion of an array according to a callback function.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var fillBy = require( '@stdlib/array/base/fill-by' );
41+
```
42+
43+
#### fillBy( x, start, end, fcn\[, thisArg] )
44+
45+
Fills all elements within a portion of an array from an inclusive `start` index to an exclusive `end` index according to a provided callback function.
46+
47+
```javascript
48+
function fcn() {
49+
return 10;
50+
}
51+
52+
var x = [ 1, 2, 3, 4, 5, 6 ];
53+
54+
var out = fillBy( x, 1, 4, fcn );
55+
// returns [ 1, 10, 10, 10, 5, 6 ]
56+
57+
var bool = ( out === x );
58+
// returns true
59+
```
60+
61+
The callback function is provided the following arguments:
62+
63+
- **value**: current array element.
64+
- **index**: current array element index.
65+
- **arr**: input array.
66+
67+
To set the callback execution context, provide a `thisArg`.
68+
69+
<!-- eslint-disable no-invalid-this -->
70+
71+
```javascript
72+
function fcn() {
73+
this.count += 1;
74+
return 10;
75+
}
76+
77+
var x = [ 1, 2, 3, 4, 5, 6 ];
78+
79+
var ctx = {
80+
'count': 0
81+
};
82+
var out = fillBy( x, 1, 4, fcn, ctx );
83+
// returns [ 1, 10, 10, 10, 5, 6 ]
84+
85+
var bool = ( out === x );
86+
// returns true
87+
88+
var cnt = ctx.count;
89+
// returns 3
90+
```
91+
92+
</section>
93+
94+
<!-- /.usage -->
95+
96+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
97+
98+
<section class="notes">
99+
100+
## Notes
101+
102+
- Negative `start` and `end` indices are resolved to positive indices by counting from the end of the array with `-1` corresponding to the last indexed element.
103+
- The function **mutates** the input array.
104+
105+
</section>
106+
107+
<!-- /.notes -->
108+
109+
<!-- Package usage examples. -->
110+
111+
<section class="examples">
112+
113+
## Examples
114+
115+
<!-- eslint no-undef: "error" -->
116+
117+
```javascript
118+
var constantFunction = require( '@stdlib/utils/constant-function' );
119+
var Float64Array = require( '@stdlib/array/float64' );
120+
var zeroTo = require( '@stdlib/array/base/zero-to' );
121+
var fillBy = require( '@stdlib/array/base/fill-by' );
122+
123+
var x = new Float64Array( zeroTo( 6 ) );
124+
// returns <Float64Array>[ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ]
125+
126+
var y = fillBy( x, 0, 6, constantFunction( 10.0 ) );
127+
// returns <Float64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
128+
129+
y = fillBy( x, 0, 4, constantFunction( 0.0 ) );
130+
// returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 10.0, 10.0 ]
131+
132+
y = fillBy( x, 2, 6, constantFunction( 20.0 ) );
133+
// returns <Float64Array>[ 0.0, 0.0, 20.0, 20.0, 20.0, 20.0 ]
134+
135+
y = fillBy( x, 2, 4, constantFunction( 30.0 ) );
136+
// returns <Float64Array>[ 0.0, 0.0, 30.0, 30.0, 20.0, 20.0 ]
137+
```
138+
139+
</section>
140+
141+
<!-- /.examples -->
142+
143+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
144+
145+
<section class="references">
146+
147+
</section>
148+
149+
<!-- /.references -->
150+
151+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
152+
153+
<section class="related">
154+
155+
</section>
156+
157+
<!-- /.related -->
158+
159+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
160+
161+
<section class="links">
162+
163+
</section>
164+
165+
<!-- /.links -->
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var pow = require( '@stdlib/math/base/special/pow' );
25+
var isArray = require( '@stdlib/assert/is-array' );
26+
var ones = require( '@stdlib/array/base/ones' );
27+
var pkg = require( './../package.json' ).name;
28+
var fillBy = require( './../lib' );
29+
30+
31+
// FUNCTIONS //
32+
33+
/**
34+
* Callback function.
35+
*
36+
* @private
37+
* @param {*} value - current array element
38+
* @param {NonNegativeInteger} idx - current array element index
39+
* @param {Collection} arr - input array
40+
* @returns {*} fill value
41+
*/
42+
function fcn( value, idx ) {
43+
return value + idx;
44+
}
45+
46+
/**
47+
* Creates a benchmark function.
48+
*
49+
* @private
50+
* @param {PositiveInteger} len - array length
51+
* @returns {Function} benchmark function
52+
*/
53+
function createBenchmark( len ) {
54+
var x = ones( len );
55+
return benchmark;
56+
57+
/**
58+
* Benchmark function.
59+
*
60+
* @private
61+
* @param {Benchmark} b - benchmark instance
62+
*/
63+
function benchmark( b ) {
64+
var out;
65+
var i;
66+
67+
b.tic();
68+
for ( i = 0; i < b.iterations; i++ ) {
69+
out = fillBy( x, 0, len, fcn );
70+
if ( out.length !== len ) {
71+
b.fail( 'unexpected length' );
72+
}
73+
}
74+
b.toc();
75+
if ( !isArray( out ) ) {
76+
b.fail( 'should return an array' );
77+
}
78+
b.pass( 'benchmark finished' );
79+
b.end();
80+
}
81+
}
82+
83+
84+
// MAIN //
85+
86+
/**
87+
* Main execution sequence.
88+
*
89+
* @private
90+
*/
91+
function main() {
92+
var len;
93+
var min;
94+
var max;
95+
var f;
96+
var i;
97+
98+
min = 1; // 10^min
99+
max = 6; // 10^max
100+
101+
for ( i = min; i <= max; i++ ) {
102+
len = pow( 10, i );
103+
104+
f = createBenchmark( len );
105+
bench( pkg+':dtype=generic,len='+len, f );
106+
}
107+
}
108+
109+
main();

0 commit comments

Comments
 (0)