Skip to content

Commit e3425d5

Browse files
committed
Auto-generated commit
1 parent 89c40e5 commit e3425d5

File tree

20 files changed

+2788
-0
lines changed

20 files changed

+2788
-0
lines changed

CHANGELOG.md

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

1111
### Features
1212

13+
- [`54dc71e`](https://github.com/stdlib-js/stdlib/commit/54dc71e0ff4a2b5661d48a1bdee584507f66373f) - add `every` and `includes` to namespace
14+
- [`2349a6e`](https://github.com/stdlib-js/stdlib/commit/2349a6edf849f8f7093a77bbdeb2fdd7d9955f89) - add `vector` to namespace
15+
- [`1ab9f58`](https://github.com/stdlib-js/stdlib/commit/1ab9f58bcd109f19afd9ab08212d69bfe9d32bbe) - add `ndarray/vector` namespace
16+
- [`c08c18d`](https://github.com/stdlib-js/stdlib/commit/c08c18d74faca63932755275c9f9bc08742f1fe6) - add `ndarray/vector/bool`
1317
- [`34aa089`](https://github.com/stdlib-js/stdlib/commit/34aa08963d038cffbee304f6142f10dadfbf3d74) - add `ndarray/vector/uint8c`
1418
- [`1456ea8`](https://github.com/stdlib-js/stdlib/commit/1456ea8d4f5a3519811261ebbaf4760600a4bc6e) - add `ndarray/vector/uint8`
1519
- [`f9923b3`](https://github.com/stdlib-js/stdlib/commit/f9923b3b975f3fe14767d24dbd696bc704da762c) - add `ndarray/vector/uint16`
@@ -400,6 +404,10 @@ A total of 15 issues were closed in this release:
400404

401405
<details>
402406

407+
- [`54dc71e`](https://github.com/stdlib-js/stdlib/commit/54dc71e0ff4a2b5661d48a1bdee584507f66373f) - **feat:** add `every` and `includes` to namespace _(by Athan Reines)_
408+
- [`2349a6e`](https://github.com/stdlib-js/stdlib/commit/2349a6edf849f8f7093a77bbdeb2fdd7d9955f89) - **feat:** add `vector` to namespace _(by Athan Reines)_
409+
- [`1ab9f58`](https://github.com/stdlib-js/stdlib/commit/1ab9f58bcd109f19afd9ab08212d69bfe9d32bbe) - **feat:** add `ndarray/vector` namespace _(by Athan Reines)_
410+
- [`c08c18d`](https://github.com/stdlib-js/stdlib/commit/c08c18d74faca63932755275c9f9bc08742f1fe6) - **feat:** add `ndarray/vector/bool` _(by Athan Reines)_
403411
- [`34aa089`](https://github.com/stdlib-js/stdlib/commit/34aa08963d038cffbee304f6142f10dadfbf3d74) - **feat:** add `ndarray/vector/uint8c` _(by Athan Reines)_
404412
- [`1456ea8`](https://github.com/stdlib-js/stdlib/commit/1456ea8d4f5a3519811261ebbaf4760600a4bc6e) - **feat:** add `ndarray/vector/uint8` _(by Athan Reines)_
405413
- [`f9923b3`](https://github.com/stdlib-js/stdlib/commit/f9923b3b975f3fe14767d24dbd696bc704da762c) - **feat:** add `ndarray/vector/uint16` _(by Athan Reines)_

lib/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ setReadOnly( ns, 'empty', require( './../empty' ) );
162162
*/
163163
setReadOnly( ns, 'emptyLike', require( './../empty-like' ) );
164164

165+
/**
166+
* @name every
167+
* @memberof ns
168+
* @readonly
169+
* @type {Function}
170+
* @see {@link module:@stdlib/ndarray/every}
171+
*/
172+
setReadOnly( ns, 'every', require( './../every' ) );
173+
165174
/**
166175
* @name FancyArray
167176
* @memberof ns
@@ -243,6 +252,15 @@ setReadOnly( ns, 'forEach', require( './../for-each' ) );
243252
*/
244253
setReadOnly( ns, 'scalar2ndarray', require( './../from-scalar' ) );
245254

255+
/**
256+
* @name includes
257+
* @memberof ns
258+
* @readonly
259+
* @type {Function}
260+
* @see {@link module:@stdlib/ndarray/includes}
261+
*/
262+
setReadOnly( ns, 'includes', require( './../includes' ) );
263+
246264
/**
247265
* @name ind2sub
248266
* @memberof ns
@@ -576,6 +594,15 @@ setReadOnly( ns, 'ndarray2fancy', require( './../to-fancy' ) );
576594
*/
577595
setReadOnly( ns, 'ndarray2json', require( './../to-json' ) );
578596

597+
/**
598+
* @name vector
599+
* @memberof ns
600+
* @readonly
601+
* @type {Namespace}
602+
* @see {@link module:@stdlib/ndarray/vector}
603+
*/
604+
setReadOnly( ns, 'vector', require( './../vector' ) );
605+
579606
/**
580607
* @name zeros
581608
* @memberof ns

vector/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
# Vector
22+
23+
> Vector constructors and associated utilities.
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 ns = require( '@stdlib/ndarray/vector' );
41+
```
42+
43+
#### ns
44+
45+
Namespace containing ndarray vector constructors and associated utilities.
46+
47+
```javascript
48+
var o = ns;
49+
// returns {...}
50+
```
51+
52+
The namespace exports the following:
53+
54+
<!-- <toc pattern="*"> -->
55+
56+
<!-- </toc> -->
57+
58+
</section>
59+
60+
<!-- /.usage -->
61+
62+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
63+
64+
<section class="notes">
65+
66+
</section>
67+
68+
<!-- /.notes -->
69+
70+
<!-- Package usage examples. -->
71+
72+
<section class="examples">
73+
74+
## Examples
75+
76+
<!-- TODO: better examples -->
77+
78+
<!-- eslint no-undef: "error" -->
79+
80+
```javascript
81+
var objectKeys = require( '@stdlib/utils/keys' );
82+
var ns = require( '@stdlib/ndarray/vector' );
83+
84+
console.log( objectKeys( ns ) );
85+
```
86+
87+
</section>
88+
89+
<!-- /.examples -->
90+
91+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
92+
93+
<section class="related">
94+
95+
</section>
96+
97+
<!-- /.related -->
98+
99+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
100+
101+
<section class="links">
102+
103+
</section>
104+
105+
<!-- /.links -->

vector/bool/README.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
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+
# BooleanVector
22+
23+
> Create a boolean vector (i.e., a one-dimensional [ndarray][@stdlib/ndarray/ctor]).
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 BooleanVector = require( '@stdlib/ndarray/vector/bool' );
41+
```
42+
43+
#### BooleanVector( \[options] )
44+
45+
Returns a one-dimensional boolean [ndarray][@stdlib/ndarray/ctor].
46+
47+
```javascript
48+
var numel = require( '@stdlib/ndarray/numel' );
49+
50+
var arr = new BooleanVector();
51+
// returns <ndarray>
52+
53+
var len = numel( arr );
54+
// returns 0
55+
```
56+
57+
The function accepts the following options:
58+
59+
- **order**: specifies whether an [ndarray][@stdlib/ndarray/ctor] is `'row-major'` (C-style) or `'column-major'` (Fortran-style). Default: `'row-major'`.
60+
- **mode**: specifies how to handle indices which exceed array dimensions (see [`ndarray`][@stdlib/ndarray/ctor]). Default: `'throw'`.
61+
- **readonly**: boolean indicating whether an array should be **read-only**. Default: `false`.
62+
63+
#### BooleanVector( length\[, options] )
64+
65+
Returns a one-dimensional boolean [ndarray][@stdlib/ndarray/ctor] having a specified `length`.
66+
67+
```javascript
68+
var numel = require( '@stdlib/ndarray/numel' );
69+
70+
var arr = new BooleanVector( 5 );
71+
// returns <ndarray>
72+
73+
var len1 = numel( arr );
74+
// returns 5
75+
```
76+
77+
#### BooleanVector( obj\[, options] )
78+
79+
Creates a one-dimensional boolean [ndarray][@stdlib/ndarray/ctor] from an array-like object or iterable.
80+
81+
```javascript
82+
var numel = require( '@stdlib/ndarray/numel' );
83+
84+
var arr = new BooleanVector( [ true, false, true ] );
85+
// returns <ndarray>
86+
87+
var len1 = numel( arr );
88+
// returns 3
89+
```
90+
91+
#### BooleanVector( buffer\[, byteOffset\[, length]]\[, options] )
92+
93+
Returns a one-dimensional boolean [ndarray][@stdlib/ndarray/ctor] view of an [`ArrayBuffer`][@stdlib/array/buffer].
94+
95+
```javascript
96+
var ArrayBuffer = require( '@stdlib/array/buffer' );
97+
var numel = require( '@stdlib/ndarray/numel' );
98+
99+
var buf = new ArrayBuffer( 32 );
100+
101+
var arr1 = new BooleanVector( buf );
102+
// returns <ndarray>
103+
104+
var len1 = numel( arr1 );
105+
// returns 32
106+
107+
var arr2 = new BooleanVector( buf, 16 );
108+
// returns <ndarray>
109+
110+
var len2 = numel( arr2 );
111+
// returns 16
112+
113+
var arr3 = new BooleanVector( buf, 16, 1 );
114+
// returns <ndarray>
115+
116+
var len3 = numel( arr3 );
117+
// returns 1
118+
```
119+
120+
</section>
121+
122+
<!-- /.usage -->
123+
124+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
125+
126+
<section class="notes">
127+
128+
</section>
129+
130+
<!-- /.notes -->
131+
132+
<!-- Package usage examples. -->
133+
134+
<section class="examples">
135+
136+
## Examples
137+
138+
<!-- eslint no-undef: "error" -->
139+
140+
```javascript
141+
var bernoulli = require( '@stdlib/random/array/bernoulli' );
142+
var every = require( '@stdlib/ndarray/every' );
143+
var map = require( '@stdlib/ndarray/map' );
144+
var BooleanVector = require( '@stdlib/ndarray/vector/bool' );
145+
146+
// Create a vector containing random values:
147+
var x = new BooleanVector( bernoulli( 10, 0.9 ) );
148+
149+
// Determine whether every element is truthy:
150+
var v = every( x );
151+
console.log( v.get() );
152+
153+
// Define a function which inverts individual values:
154+
function invert( v ) {
155+
return !v;
156+
}
157+
158+
// Apply function:
159+
var y = map( x, invert );
160+
161+
// Determine whether every element is truthy:
162+
v = every( y );
163+
console.log( v.get() );
164+
```
165+
166+
</section>
167+
168+
<!-- /.examples -->
169+
170+
<!-- 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. -->
171+
172+
<section class="references">
173+
174+
</section>
175+
176+
<!-- /.references -->
177+
178+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
179+
180+
<section class="related">
181+
182+
</section>
183+
184+
<!-- /.related -->
185+
186+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
187+
188+
<section class="links">
189+
190+
[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer
191+
192+
[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/ndarray/tree/main/ctor
193+
194+
</section>
195+
196+
<!-- /.links -->

0 commit comments

Comments
 (0)