Skip to content

Commit e24c53d

Browse files
committed
Auto-generated commit
1 parent d05ba6e commit e24c53d

File tree

23 files changed

+1688
-2
lines changed

23 files changed

+1688
-2
lines changed

.github/.keepalive

-1
This file was deleted.

CHANGELOG.md

+47-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-03-10)
7+
## Unreleased (2025-03-13)
88

99
<section class="packages">
1010

@@ -831,6 +831,50 @@ This release closes the following issue:
831831

832832
<!-- /.package -->
833833

834+
<section class="package" id="array-base-symmetric-banded-filled2d-by-unreleased">
835+
836+
#### [@stdlib/array/base/symmetric-banded/filled2d-by](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/symmetric-banded/filled2d-by)
837+
838+
<details>
839+
840+
<section class="features">
841+
842+
##### Features
843+
844+
- [`41a2534`](https://github.com/stdlib-js/stdlib/commit/41a2534c6dd345a0dc73365826919ccbf1e9eca7) - add `array/base/symmetric-banded/filled2d-by`
845+
846+
</section>
847+
848+
<!-- /.features -->
849+
850+
</details>
851+
852+
</section>
853+
854+
<!-- /.package -->
855+
856+
<section class="package" id="array-base-symmetric-filled2d-by-unreleased">
857+
858+
#### [@stdlib/array/base/symmetric/filled2d-by](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/symmetric/filled2d-by)
859+
860+
<details>
861+
862+
<section class="features">
863+
864+
##### Features
865+
866+
- [`052b810`](https://github.com/stdlib-js/stdlib/commit/052b81032b766464a079bc88cc676e38dac0c35a) - add `array/base/symmetric/filled2d-by`
867+
868+
</section>
869+
870+
<!-- /.features -->
871+
872+
</details>
873+
874+
</section>
875+
876+
<!-- /.package -->
877+
834878
<section class="package" id="array-base-take-indexed2-unreleased">
835879

836880
#### [@stdlib/array/base/take-indexed2](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/take-indexed2)
@@ -1151,6 +1195,8 @@ A total of 13 people contributed to this release. Thank you to the following con
11511195

11521196
<details>
11531197

1198+
- [`41a2534`](https://github.com/stdlib-js/stdlib/commit/41a2534c6dd345a0dc73365826919ccbf1e9eca7) - **feat:** add `array/base/symmetric-banded/filled2d-by` _(by Athan Reines)_
1199+
- [`052b810`](https://github.com/stdlib-js/stdlib/commit/052b81032b766464a079bc88cc676e38dac0c35a) - **feat:** add `array/base/symmetric/filled2d-by` _(by Athan Reines)_
11541200
- [`c31eccd`](https://github.com/stdlib-js/stdlib/commit/c31eccd4e752a5647b718df9f3b70739c8a4b45b) - **chore(array):** fix incorrect JSDoc type [(#5844)](https://github.com/stdlib-js/stdlib/pull/5844) _(by Anshu Kumar)_
11551201
- [`165c7fb`](https://github.com/stdlib-js/stdlib/commit/165c7fb75861f4c1ee28940aadbe44ba4f6e8268) - **fix:** use the correct TypeScript callback signature and update docs for `array/base/for-each` [(#5448)](https://github.com/stdlib-js/stdlib/pull/5448) _(by Muhammad Haris)_
11561202
- [`01e81a5`](https://github.com/stdlib-js/stdlib/commit/01e81a54c2f1294efe1d199cba7dfc6ac8bb9acf) - **refactor:** update path _(by Athan Reines)_

CONTRIBUTORS

+6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ Aksshay Balasubramanian <[email protected]>
1717
Aleksandr <[email protected]>
1818
Ali Salesi <[email protected]>
1919
Aman Bhansali <[email protected]>
20+
AmanBhadkariya <[email protected]>
2021
Amit Jimiwal <[email protected]>
2122
Anshu Kumar <[email protected]>
23+
Anshu Kumar <[email protected]>
2224
Anudeep Sanapala <[email protected]>
2325
Athan Reines <[email protected]>
2426
@@ -33,6 +35,7 @@ Daniel Yu <[email protected]>
3335
Debashis Maharana <[email protected]>
3436
Desh Deepak Kant <[email protected]>
3537
38+
Dhanyabad behera <[email protected]>
3639
Dhruv Arvind Singh <[email protected]>
3740
Dhruvil Mehta <[email protected]>
3841
Divyansh Seth <[email protected]>
@@ -47,12 +50,14 @@ Gautam sharma <[email protected]>
4750
Golden Kumar <[email protected]>
4851
Gunj Joshi <[email protected]>
4952
Gururaj Gurram <[email protected]>
53+
Haroon Rasheed <[email protected]>
5054
5155
5256
Harshita Kalani <[email protected]>
5357
Hemant M Mehta <[email protected]>
5458
Hridyanshu <[email protected]>
5559
Jaimin Godhani <[email protected]>
60+
Jaison D Souza <[email protected]>
5661
Jalaj Kumar <[email protected]>
5762
James Gelok <[email protected]>
5863
Jaysukh Makvana <[email protected]>
@@ -66,6 +71,7 @@ Justin Dennison <[email protected]>
6671
Justyn Shelby <[email protected]>
6772
Karan Anand <[email protected]>
6873
Karthik Prakash <[email protected]>
74+
Kaushikgtm <[email protected]>
6975
Kohantika Nath <[email protected]>
7076
Krishnam Agarwal <[email protected]>
7177
Krishnendu Das <[email protected]>
+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
# filled2dBy
22+
23+
> Create a filled two-dimensional symmetric banded nested array according to a provided 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 filled2dBy = require( '@stdlib/array/base/symmetric-banded/filled2d-by' );
41+
```
42+
43+
#### filled2dBy( N, k, fill, clbk\[, thisArg] )
44+
45+
Returns a filled two-dimensional symmetric banded nested array according to a provided callback function.
46+
47+
```javascript
48+
function clbk( idx ) {
49+
return idx[ 0 ] + idx[ 1 ];
50+
}
51+
52+
var out = filled2dBy( 3, 1, 0, clbk );
53+
// returns [ [ 0, 1, 0 ], [ 1, 2, 3 ], [ 0, 3, 4 ] ]
54+
```
55+
56+
The function accepts the following arguments:
57+
58+
- **N**: number of rows and columns.
59+
- **k**: number of super-/sub-diagonals.
60+
- **fill**: fill value for elements outside the band.
61+
- **clbk**: callback function.
62+
- **thisArg**: callback function execution context (_optional_).
63+
64+
When invoked, a callback function is provided a single argument:
65+
66+
- **indices**: current array element indices.
67+
68+
To set the callback execution context, provide a `thisArg`.
69+
70+
<!-- eslint-disable no-invalid-this -->
71+
72+
```javascript
73+
function clbk() {
74+
this.count += 1;
75+
return 1;
76+
}
77+
78+
var ctx = {
79+
'count': 0
80+
};
81+
82+
var out = filled2dBy( 2, 1, 0, clbk, ctx );
83+
// returns [ [ 1, 1 ], [ 1, 1 ] ];
84+
85+
var cnt = ctx.count;
86+
// returns 3
87+
```
88+
89+
</section>
90+
91+
<!-- /.usage -->
92+
93+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
94+
95+
<section class="notes">
96+
97+
## Notes
98+
99+
- As the output array is symmetric and banded, the callback function is only invoked for the elements residing within the band in the upper triangle of the output array.
100+
101+
</section>
102+
103+
<!-- /.notes -->
104+
105+
<!-- Package usage examples. -->
106+
107+
<section class="examples">
108+
109+
## Examples
110+
111+
<!-- eslint no-undef: "error" -->
112+
113+
```javascript
114+
var constantFunction = require( '@stdlib/utils/constant-function' );
115+
var filled2dBy = require( '@stdlib/array/base/symmetric-banded/filled2d-by' );
116+
117+
function clbk( indices ) {
118+
return indices[ 0 ] + indices[ 1 ];
119+
}
120+
121+
var out = filled2dBy( 3, 1, 0, clbk );
122+
// returns [ [ 0, 1, 0 ], [ 1, 2, 3 ], [ 0, 3, 4 ] ]
123+
124+
out = filled2dBy( 3, 1, null, constantFunction( 'beep' ) );
125+
// returns [ [ 'beep', 'beep', null ], [ 'beep', 'beep', 'beep' ], [ null, 'beep', 'beep' ] ]
126+
```
127+
128+
</section>
129+
130+
<!-- /.examples -->
131+
132+
<!-- 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. -->
133+
134+
<section class="references">
135+
136+
</section>
137+
138+
<!-- /.references -->
139+
140+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
141+
142+
<section class="related">
143+
144+
</section>
145+
146+
<!-- /.related -->
147+
148+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
149+
150+
<section class="links">
151+
152+
</section>
153+
154+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 floor = require( '@stdlib/math/base/special/floor' );
26+
var sqrt = require( '@stdlib/math/base/special/sqrt' );
27+
var isArrayArray = require( '@stdlib/assert/is-array-array' );
28+
var constantFunction = require( '@stdlib/utils/constant-function' );
29+
var pkg = require( './../package.json' ).name;
30+
var filled2dBy = require( './../lib' );
31+
32+
33+
// FUNCTIONS //
34+
35+
/**
36+
* Creates a benchmark function.
37+
*
38+
* @private
39+
* @param {PositiveInteger} N - array lengths
40+
* @returns {Function} benchmark function
41+
*/
42+
function createBenchmark( N ) {
43+
return benchmark;
44+
45+
/**
46+
* Benchmark function.
47+
*
48+
* @private
49+
* @param {Benchmark} b - benchmark instance
50+
*/
51+
function benchmark( b ) {
52+
var out;
53+
var f;
54+
var i;
55+
56+
f = constantFunction( N );
57+
58+
b.tic();
59+
for ( i = 0; i < b.iterations; i++ ) {
60+
out = filled2dBy( N, 2, 0, f );
61+
if ( typeof out !== 'object' ) {
62+
b.fail( 'should return an array of arrays' );
63+
}
64+
}
65+
b.toc();
66+
if ( !isArrayArray( out ) ) {
67+
b.fail( 'should return an array of arrays' );
68+
}
69+
b.pass( 'benchmark finished' );
70+
b.end();
71+
}
72+
}
73+
74+
75+
// MAIN //
76+
77+
/**
78+
* Main execution sequence.
79+
*
80+
* @private
81+
*/
82+
function main() {
83+
var min;
84+
var max;
85+
var N;
86+
var f;
87+
var i;
88+
89+
min = 1; // 10^min
90+
max = 6; // 10^max
91+
92+
for ( i = min; i <= max; i++ ) {
93+
N = floor( sqrt( pow( 10, i ) ) );
94+
95+
f = createBenchmark( N );
96+
bench( pkg+':k=2,size='+(N*N), f );
97+
}
98+
}
99+
100+
main();

0 commit comments

Comments
 (0)