Skip to content

Commit 10da5ef

Browse files
committed
Auto-generated commit
1 parent b72b73f commit 10da5ef

File tree

12 files changed

+750
-0
lines changed

12 files changed

+750
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`85543bf`](https://github.com/stdlib-js/stdlib/commit/85543bf5fd13e8014bfa2b81ce950f5172d4d4b0) - add `ndarray/base/falses` [(#11529)](https://github.com/stdlib-js/stdlib/pull/11529)
1314
- [`a12ba0a`](https://github.com/stdlib-js/stdlib/commit/a12ba0a26b7e11e99b04627e57a1dd2f21ca4ad0) - add `ndarray/base/tile` [(#11499)](https://github.com/stdlib-js/stdlib/pull/11499)
1415
- [`97fd5b7`](https://github.com/stdlib-js/stdlib/commit/97fd5b7de7e74e99e0ffb4ccd27c5ae555aa02cb) - add `toUnflattened` to namespace
1516
- [`737511b`](https://github.com/stdlib-js/stdlib/commit/737511bad0cbe580a8771094f13ef75fd8975f01) - add `ndarray/base/to-unflattened` [(#11493)](https://github.com/stdlib-js/stdlib/pull/11493)
@@ -845,6 +846,7 @@ A total of 49 issues were closed in this release:
845846

846847
<details>
847848

849+
- [`85543bf`](https://github.com/stdlib-js/stdlib/commit/85543bf5fd13e8014bfa2b81ce950f5172d4d4b0) - **feat:** add `ndarray/base/falses` [(#11529)](https://github.com/stdlib-js/stdlib/pull/11529) _(by Muhammad Haris)_
848850
- [`a12ba0a`](https://github.com/stdlib-js/stdlib/commit/a12ba0a26b7e11e99b04627e57a1dd2f21ca4ad0) - **feat:** add `ndarray/base/tile` [(#11499)](https://github.com/stdlib-js/stdlib/pull/11499) _(by Muhammad Haris, Athan Reines)_
849851
- [`2505815`](https://github.com/stdlib-js/stdlib/commit/25058156cf7b1138c5c33209a5143100c376b46d) - **docs:** update namespace table of contents [(#11520)](https://github.com/stdlib-js/stdlib/pull/11520) _(by stdlib-bot)_
850852
- [`3af178c`](https://github.com/stdlib-js/stdlib/commit/3af178cc07862b3070234245f015a4bdc8370acb) - **style:** use single quotes for require calls [(#11516)](https://github.com/stdlib-js/stdlib/pull/11516) _(by Philipp Burckhardt)_

base/falses/README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 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+
# falses
22+
23+
> Create an [ndarray][@stdlib/ndarray/base/ctor] filled with `false` values and having a specified shape and [data type][@stdlib/ndarray/dtypes].
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 falses = require( '@stdlib/ndarray/base/falses' );
41+
```
42+
43+
#### falses( dtype, shape, order )
44+
45+
Creates an [ndarray][@stdlib/ndarray/base/ctor] filled with `false` values and having a specified shape and [data type][@stdlib/ndarray/dtypes].
46+
47+
```javascript
48+
var getDType = require( '@stdlib/ndarray/dtype' );
49+
50+
var arr = falses( 'bool', [ 2, 2 ], 'row-major' );
51+
// returns <ndarray>[ [ false, false ], [ false, false ] ]
52+
53+
var dt = String( getDType( arr ) );
54+
// returns 'bool'
55+
```
56+
57+
The function accepts the following arguments:
58+
59+
- **dtype**: underlying [data type][@stdlib/ndarray/dtypes]. Must be a "boolean" [data type][@stdlib/ndarray/dtypes].
60+
- **shape**: array shape.
61+
- **order**: specifies whether an [ndarray][@stdlib/ndarray/base/ctor] is `'row-major'` (C-style) or `'column-major'` (Fortran-style).
62+
63+
</section>
64+
65+
<!-- /.usage -->
66+
67+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
68+
69+
<section class="notes">
70+
71+
</section>
72+
73+
<!-- /.notes -->
74+
75+
<!-- Package usage examples. -->
76+
77+
<section class="examples">
78+
79+
## Examples
80+
81+
<!-- eslint no-undef: "error" -->
82+
83+
```javascript
84+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
85+
var falses = require( '@stdlib/ndarray/base/falses' );
86+
87+
var arr = falses( 'bool', [ 2, 2 ], 'row-major' );
88+
console.log( ndarray2array( arr ) );
89+
```
90+
91+
</section>
92+
93+
<!-- /.examples -->
94+
95+
<!-- 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. -->
96+
97+
<section class="references">
98+
99+
</section>
100+
101+
<!-- /.references -->
102+
103+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
104+
105+
<section class="related">
106+
107+
</section>
108+
109+
<!-- /.related -->
110+
111+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
112+
113+
<section class="links">
114+
115+
[@stdlib/ndarray/base/ctor]: https://github.com/stdlib-js/ndarray/tree/main/base/ctor
116+
117+
[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray/tree/main/dtypes
118+
119+
</section>
120+
121+
<!-- /.links -->

base/falses/benchmark/benchmark.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
25+
var format = require( '@stdlib/string/format' );
26+
var pkg = require( './../package.json' ).name;
27+
var falses = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( format( '%s:dtype=bool', pkg ), function benchmark( b ) {
33+
var arr;
34+
var i;
35+
b.tic();
36+
for ( i = 0; i < b.iterations; i++ ) {
37+
arr = falses( 'bool', [ 0 ], 'row-major' );
38+
if ( arr.length !== 0 ) {
39+
b.fail( 'should have length 0' );
40+
}
41+
}
42+
b.toc();
43+
if ( !isndarrayLike( arr ) ) {
44+
b.fail( 'should return an ndarray' );
45+
}
46+
b.pass( 'benchmark finished' );
47+
b.end();
48+
});
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
26+
var format = require( '@stdlib/string/format' );
27+
var pkg = require( './../package.json' ).name;
28+
var falses = require( './../lib' );
29+
30+
31+
// FUNCTIONS //
32+
33+
/**
34+
* Creates a benchmark function.
35+
*
36+
* @private
37+
* @param {PositiveInteger} len - array length
38+
* @returns {Function} benchmark function
39+
*/
40+
function createBenchmark( len ) {
41+
return benchmark;
42+
43+
/**
44+
* Benchmark function.
45+
*
46+
* @private
47+
* @param {Benchmark} b - benchmark instance
48+
*/
49+
function benchmark( b ) {
50+
var arr;
51+
var i;
52+
53+
b.tic();
54+
for ( i = 0; i < b.iterations; i++ ) {
55+
arr = falses( 'bool', [ len ], 'row-major' );
56+
if ( arr.length !== len ) {
57+
b.fail( 'unexpected length' );
58+
}
59+
}
60+
b.toc();
61+
if ( !isndarrayLike( arr ) ) {
62+
b.fail( 'should return an ndarray' );
63+
}
64+
b.pass( 'benchmark finished' );
65+
b.end();
66+
}
67+
}
68+
69+
70+
// MAIN //
71+
72+
/**
73+
* Main execution sequence.
74+
*
75+
* @private
76+
*/
77+
function main() {
78+
var len;
79+
var min;
80+
var max;
81+
var f;
82+
var i;
83+
84+
min = 1; // 10^min
85+
max = 6; // 10^max
86+
87+
for ( i = min; i <= max; i++ ) {
88+
len = pow( 10, i );
89+
f = createBenchmark( len );
90+
bench( format( '%s:dtype=bool,size=%d', pkg, len ), f );
91+
}
92+
}
93+
94+
main();

base/falses/docs/repl.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
{{alias}}( dtype, shape, order )
3+
Returns an ndarray filled with `false` values and having a specified shape
4+
and data type.
5+
6+
Parameters
7+
----------
8+
dtype: string|DataType
9+
Underlying data type. Must be a "boolean" data type.
10+
11+
shape: ArrayLikeObject<integer>
12+
Array shape.
13+
14+
order: string
15+
Specifies whether an array is row-major (C-style) or column-major
16+
(Fortran-style).
17+
18+
Returns
19+
-------
20+
out: ndarray
21+
Output array.
22+
23+
Examples
24+
--------
25+
> var arr = {{alias}}( 'bool', [ 2, 2 ], 'row-major' )
26+
<ndarray>[ [ false, false ], [ false, false ] ]
27+
28+
See Also
29+
--------
30+

base/falses/docs/types/index.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 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+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { Shape, Order, boolndarray, BooleanDataType } from '@stdlib/types/ndarray';
24+
25+
/**
26+
* Creates an ndarray filled with `false` values and having a specified shape and data type.
27+
*
28+
* @param dtype - underlying data type
29+
* @param shape - array shape
30+
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
31+
* @returns `false`-filled array
32+
*
33+
* @example
34+
* var getDType = require( '@stdlib/ndarray/dtype' );
35+
*
36+
* var arr = falses( 'bool', [ 2, 2 ], 'row-major' );
37+
* // returns <ndarray>[ [ false, false ], [ false, false ] ]
38+
*
39+
* var dt = String( getDType( arr ) );
40+
* // returns 'bool'
41+
*/
42+
declare function falses( dtype: BooleanDataType, shape: Shape, order: Order ): boolndarray;
43+
44+
45+
// EXPORTS //
46+
47+
export = falses;

0 commit comments

Comments
 (0)