Skip to content

Commit 1796f6e

Browse files
committed
Merge branch 'develop' into feat/ulp-diff-f32
2 parents 2906134 + bac5dfa commit 1796f6e

File tree

370 files changed

+45262
-645
lines changed

Some content is hidden

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

370 files changed

+45262
-645
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/cdf`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/4883
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/pmf`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/4996
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/kurtosis`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/4899
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/variance`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/4907
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/logpmf`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/5000
7+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for stats/base/dists/weibull/skewness
5+
6+
PR-URL: https://github.com/stdlib-js/stdlib/pull/4053
7+
Closes: https://github.com/stdlib-js/stdlib/issues/3849
8+
9+
Co-authored-by: Philipp Burckhardt <[email protected]>
10+
Co-authored-by: stdlib-bot <[email protected]>
11+
Reviewed-by: Philipp Burckhardt <[email protected]>
12+
Signed-off-by: Philipp Burckhardt <[email protected]>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: amend-message
3+
---
4+
feat: add C implementation for `stats/base/dists/planck/skewness`
5+
6+
Closes: https://github.com/stdlib-js/stdlib/issues/4905
7+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
24+
var isFunction = require( '@stdlib/assert/is-function' );
25+
26+
27+
// MAIN //
28+
29+
/**
30+
* Returns a boolean indicating if a value is a `struct` constructor.
31+
*
32+
* @private
33+
* @param {*} value - value to test
34+
* @returns {boolean} boolean indicating if a value is a `struct` constructor
35+
*/
36+
function isStructConstructor( value ) {
37+
return (
38+
isFunction( value ) &&
39+
isPositiveInteger( value.alignment ) &&
40+
isPositiveInteger( value.byteLength ) &&
41+
isFunction( value.byteLengthOf ) &&
42+
isFunction( value.byteOffsetOf ) &&
43+
isFunction( value.bufferOf ) &&
44+
isFunction( value.viewOf )
45+
);
46+
}
47+
48+
49+
// EXPORTS //
50+
51+
module.exports = isStructConstructor;

lib/node_modules/@stdlib/array/struct-factory/lib/main.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
26-
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
2726
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2827
var isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' );
2928
var isCollection = require( '@stdlib/assert/is-collection' );
@@ -43,6 +42,7 @@ var accessorGetter = require( '@stdlib/array/base/accessor-getter' );
4342
var gcopy = require( '@stdlib/blas/base/gcopy' ).ndarray;
4443
var structFactory = require( '@stdlib/dstructs/struct' );
4544
var format = require( '@stdlib/string/format' );
45+
var isStructConstructor = require( './is_struct_constructor.js' );
4646
var fromArray = require( './from_array.js' );
4747
var fromIterator = require( './from_iterator.js' );
4848

@@ -53,28 +53,6 @@ var HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();
5353
var CTOR_NAME = 'StructArray';
5454

5555

56-
// FUNCTIONS //
57-
58-
/**
59-
* Returns a boolean indicating if a value is a `struct` constructor.
60-
*
61-
* @private
62-
* @param {*} value - value to test
63-
* @returns {boolean} boolean indicating if a value is a `struct` constructor
64-
*/
65-
function isStructConstructor( value ) {
66-
return (
67-
isFunction( value ) &&
68-
isPositiveInteger( value.alignment ) &&
69-
isPositiveInteger( value.byteLength ) &&
70-
isFunction( value.byteLengthOf ) &&
71-
isFunction( value.byteOffsetOf ) &&
72-
isFunction( value.bufferOf ) &&
73-
isFunction( value.viewOf )
74-
);
75-
}
76-
77-
7856
// MAIN //
7957

8058
/**
@@ -169,7 +147,7 @@ function factory( arg ) { // eslint-disable-line stdlib/jsdoc-require-throws-tag
169147
} else if ( isStructConstructor( arg ) ) {
170148
Struct = arg;
171149
} else {
172-
throw new TypeError( format( 'invalid argument. First argument must be either a struct constructor or struct schema. Value: `%s`.', Struct ) );
150+
throw new TypeError( format( 'invalid argument. First argument must be either a struct constructor or struct schema. Value: `%s`.', arg ) );
173151
}
174152
BYTES_PER_ELEMENT = Struct.byteLength;
175153
LAYOUT = Struct.layout; // TODO: consider whether to lazily materialize the struct layout, as this could potentially be a long string (hence increased memory consumption) depending on the complexity of the struct
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+
# igamax
22+
23+
> Find the index of the first element having the maximum absolute value.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var igamax = require( '@stdlib/blas/base/igamax' );
31+
```
32+
33+
#### igamax( N, x, strideX )
34+
35+
Finds the index of the first element having the maximum absolute value.
36+
37+
```javascript
38+
var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
39+
40+
var idx = igamax( x.length, x, 1 );
41+
// returns 3
42+
```
43+
44+
The function has the following parameters:
45+
46+
- **N**: number of indexed elements.
47+
- **x**: input array.
48+
- **strideX**: stride length for `x`.
49+
50+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to traverse every other value,
51+
52+
```javascript
53+
var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
54+
55+
var idx = igamax( 4, x, 2 );
56+
// returns 2
57+
```
58+
59+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
60+
61+
```javascript
62+
var Float64Array = require( '@stdlib/array/float64' );
63+
64+
// Initial array:
65+
var x0 = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
66+
67+
// Create an offset view:
68+
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
69+
70+
// Find index of element having the maximum absolute value:
71+
var idx = igamax( 3, x1, 2 );
72+
// returns 2
73+
```
74+
75+
#### igamax.ndarray( N, x, strideX, offset )
76+
77+
Finds the index of the first element having the maximum absolute value using alternative indexing semantics.
78+
79+
```javascript
80+
var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
81+
82+
var idx = igamax.ndarray( x.length, x, 1, 0 );
83+
// returns 3
84+
```
85+
86+
The function has the following additional parameters:
87+
88+
- **offsetX**: starting index.
89+
90+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to start from the second index,
91+
92+
```javascript
93+
var x = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ];
94+
95+
var idx = igamax.ndarray( 5, x, 1, 1 );
96+
// returns 4
97+
```
98+
99+
</section>
100+
101+
<!-- /.usage -->
102+
103+
<section class="notes">
104+
105+
## Notes
106+
107+
- If `N < 1`, both functions return `-1`.
108+
- `igamax()` corresponds to the [BLAS][blas] level 1 function [`idamax`][idamax] with the exception that this implementation works with any array type, not just Float64Arrays. Depending on the environment, the typed versions ([`idamax`][@stdlib/blas/base/idamax], [`isamax`][@stdlib/blas/base/isamax], etc.) are likely to be significantly more performant.
109+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
110+
111+
</section>
112+
113+
<!-- /.notes -->
114+
115+
<section class="examples">
116+
117+
## Examples
118+
119+
<!-- eslint no-undef: "error" -->
120+
121+
```javascript
122+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
123+
var igamax = require( '@stdlib/blas/base/igamax' );
124+
125+
var opts = {
126+
'dtype': 'generic'
127+
};
128+
var x = discreteUniform( 10, -100, 100, opts );
129+
console.log( x );
130+
131+
var idx = igamax( x.length, x, 1 );
132+
console.log( idx );
133+
```
134+
135+
</section>
136+
137+
<!-- /.examples -->
138+
139+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
140+
141+
<section class="related">
142+
143+
</section>
144+
145+
<!-- /.related -->
146+
147+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
148+
149+
<section class="links">
150+
151+
[blas]: http://www.netlib.org/blas
152+
153+
[idamax]: https://netlib.org/lapack/explore-html-3.6.1/dd/de0/idamax_8f_a285793254ff0adaf58c605682efb880c.html
154+
155+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
156+
157+
[@stdlib/blas/base/idamax]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/idamax
158+
159+
[@stdlib/blas/base/isamax]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/isamax
160+
161+
[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
162+
163+
</section>
164+
165+
<!-- /.links -->

0 commit comments

Comments
 (0)