Skip to content

Commit 89c40e5

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

Some content is hidden

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

78 files changed

+16199
-1
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-05-17)
7+
## Unreleased (2025-05-19)
88

99
<section class="features">
1010

1111
### Features
1212

13+
- [`34aa089`](https://github.com/stdlib-js/stdlib/commit/34aa08963d038cffbee304f6142f10dadfbf3d74) - add `ndarray/vector/uint8c`
14+
- [`1456ea8`](https://github.com/stdlib-js/stdlib/commit/1456ea8d4f5a3519811261ebbaf4760600a4bc6e) - add `ndarray/vector/uint8`
15+
- [`f9923b3`](https://github.com/stdlib-js/stdlib/commit/f9923b3b975f3fe14767d24dbd696bc704da762c) - add `ndarray/vector/uint16`
16+
- [`b7c276b`](https://github.com/stdlib-js/stdlib/commit/b7c276b5d4e32dd0409afb946319d4581b8f6ff1) - add `ndarray/vector/uint32`
17+
- [`3e6bb9d`](https://github.com/stdlib-js/stdlib/commit/3e6bb9d2c5d0977b0e101d89d6db13772aabb17c) - add `ndarray/vector/int8`
18+
- [`ea3f7af`](https://github.com/stdlib-js/stdlib/commit/ea3f7afc1eed9b9d6c7964b8e984dd1e205bcd24) - add `ndarray/vector/int16`
19+
- [`031fecf`](https://github.com/stdlib-js/stdlib/commit/031fecf3ade6e37cf1cda50ea30303cd922310b3) - add `ndarray/vector/int32`
1320
- [`2501de9`](https://github.com/stdlib-js/stdlib/commit/2501de9d60e1239dc54568fff1c6ecdf2770e3fa) - add `ndarray/vector/float64`
1421
- [`e8064cd`](https://github.com/stdlib-js/stdlib/commit/e8064cdc716fc9381a143620ef291722dba49228) - add `ndarray/vector/float32`
1522
- [`b2cefbe`](https://github.com/stdlib-js/stdlib/commit/b2cefbe2b2192cb705b85c43ffac2f57ca782c42) - add custom `valueOf` method
@@ -393,6 +400,13 @@ A total of 15 issues were closed in this release:
393400

394401
<details>
395402

403+
- [`34aa089`](https://github.com/stdlib-js/stdlib/commit/34aa08963d038cffbee304f6142f10dadfbf3d74) - **feat:** add `ndarray/vector/uint8c` _(by Athan Reines)_
404+
- [`1456ea8`](https://github.com/stdlib-js/stdlib/commit/1456ea8d4f5a3519811261ebbaf4760600a4bc6e) - **feat:** add `ndarray/vector/uint8` _(by Athan Reines)_
405+
- [`f9923b3`](https://github.com/stdlib-js/stdlib/commit/f9923b3b975f3fe14767d24dbd696bc704da762c) - **feat:** add `ndarray/vector/uint16` _(by Athan Reines)_
406+
- [`b7c276b`](https://github.com/stdlib-js/stdlib/commit/b7c276b5d4e32dd0409afb946319d4581b8f6ff1) - **feat:** add `ndarray/vector/uint32` _(by Athan Reines)_
407+
- [`3e6bb9d`](https://github.com/stdlib-js/stdlib/commit/3e6bb9d2c5d0977b0e101d89d6db13772aabb17c) - **feat:** add `ndarray/vector/int8` _(by Athan Reines)_
408+
- [`ea3f7af`](https://github.com/stdlib-js/stdlib/commit/ea3f7afc1eed9b9d6c7964b8e984dd1e205bcd24) - **feat:** add `ndarray/vector/int16` _(by Athan Reines)_
409+
- [`031fecf`](https://github.com/stdlib-js/stdlib/commit/031fecf3ade6e37cf1cda50ea30303cd922310b3) - **feat:** add `ndarray/vector/int32` _(by Athan Reines)_
396410
- [`2501de9`](https://github.com/stdlib-js/stdlib/commit/2501de9d60e1239dc54568fff1c6ecdf2770e3fa) - **feat:** add `ndarray/vector/float64` _(by Athan Reines)_
397411
- [`f75732b`](https://github.com/stdlib-js/stdlib/commit/f75732ba5e3117ae0f9336722834307243eca2be) - **docs:** update example _(by Athan Reines)_
398412
- [`5662f92`](https://github.com/stdlib-js/stdlib/commit/5662f920d833b3033ac24e38ef2a13b7506f7495) - **docs:** update example _(by Athan Reines)_

vector/int16/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+
# Int16Vector
22+
23+
> Create a signed 16-bit integer 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 Int16Vector = require( '@stdlib/ndarray/vector/int16' );
41+
```
42+
43+
#### Int16Vector( \[options] )
44+
45+
Returns a one-dimensional signed 16-bit integer [ndarray][@stdlib/ndarray/ctor].
46+
47+
```javascript
48+
var numel = require( '@stdlib/ndarray/numel' );
49+
50+
var arr = new Int16Vector();
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+
#### Int16Vector( length\[, options] )
64+
65+
Returns a one-dimensional signed 16-bit integer [ndarray][@stdlib/ndarray/ctor] having a specified `length`.
66+
67+
```javascript
68+
var numel = require( '@stdlib/ndarray/numel' );
69+
70+
var arr = new Int16Vector( 5 );
71+
// returns <ndarray>
72+
73+
var len1 = numel( arr );
74+
// returns 5
75+
```
76+
77+
#### Int16Vector( obj\[, options] )
78+
79+
Creates a one-dimensional signed 16-bit integer [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 Int16Vector( [ 1, 2, 3 ] );
85+
// returns <ndarray>
86+
87+
var len1 = numel( arr );
88+
// returns 3
89+
```
90+
91+
#### Int16Vector( buffer\[, byteOffset\[, length]]\[, options] )
92+
93+
Returns a one-dimensional signed 16-bit integer [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 Int16Vector( buf );
102+
// returns <ndarray>
103+
104+
var len1 = numel( arr1 );
105+
// returns 16
106+
107+
var arr2 = new Int16Vector( buf, 16 );
108+
// returns <ndarray>
109+
110+
var len2 = numel( arr2 );
111+
// returns 8
112+
113+
var arr3 = new Int16Vector( 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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
142+
var sum = require( '@stdlib/blas/ext/sum' );
143+
var map = require( '@stdlib/ndarray/map' );
144+
var Int16Vector = require( '@stdlib/ndarray/vector/int16' );
145+
146+
// Create a vector containing random values:
147+
var x = new Int16Vector( discreteUniform( 10, 0, 100 ) );
148+
149+
// Compute the sum:
150+
var v = sum( x );
151+
console.log( v.get() );
152+
153+
// Define a function which applies a threshold to individual values:
154+
function threshold( v ) {
155+
return ( v > 10 ) ? v : 0;
156+
}
157+
158+
// Apply threshold:
159+
var y = map( x, threshold );
160+
161+
// Recompute the sum:
162+
v = sum( 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 -->

vector/int16/benchmark/benchmark.js

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

0 commit comments

Comments
 (0)