Skip to content

Commit d93dd11

Browse files
authored
Merge branch 'develop' into javascript-linting-fail
2 parents 3424c1b + 5bde225 commit d93dd11

Some content is hidden

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

60 files changed

+6411
-3
lines changed

lib/node_modules/@stdlib/array/docs/types/index.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import mskreject = require( '@stdlib/array/mskreject' );
6262
import nans = require( '@stdlib/array/nans' );
6363
import nansLike = require( '@stdlib/array/nans-like' );
6464
import nextDataType = require( '@stdlib/array/next-dtype' );
65+
import nulls = require( '@stdlib/array/nulls' );
6566
import oneTo = require( '@stdlib/array/one-to' );
6667
import oneToLike = require( '@stdlib/array/one-to-like' );
6768
import ones = require( '@stdlib/array/ones' );
@@ -1008,6 +1009,27 @@ interface Namespace {
10081009
*/
10091010
nextDataType: typeof nextDataType;
10101011

1012+
/**
1013+
* Creates an array filled with nulls and having a specified length.
1014+
*
1015+
* The function recognizes the following data types:
1016+
*
1017+
* - `generic`: generic JavaScript values
1018+
*
1019+
* @param length - array length
1020+
* @param dtype - data type (default: 'generic')
1021+
* @returns filled array
1022+
*
1023+
* @example
1024+
* var arr = ns.nulls( 2 );
1025+
* // returns [ null, null ]
1026+
*
1027+
* @example
1028+
* var arr = ns.nulls( 2, 'generic' );
1029+
* // returns [ null, null ]
1030+
*/
1031+
nulls: typeof nulls;
1032+
10111033
/**
10121034
* Generates a linearly spaced numeric array whose elements increment by 1 starting from one.
10131035
*

lib/node_modules/@stdlib/blas/base/ndarray/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The namespace exposes the following APIs:
4848
- <span class="signature">[`dasum( arrays )`][@stdlib/blas/base/ndarray/dasum]</span><span class="delimiter">: </span><span class="description">calculate the sum of absolute values for all elements in a one-dimensional double-precision floating-point ndarray.</span>
4949
- <span class="signature">[`ddot( arrays )`][@stdlib/blas/base/ndarray/ddot]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two one-dimensional double-precision floating-point ndarrays.</span>
5050
- <span class="signature">[`gdot( arrays )`][@stdlib/blas/base/ndarray/gdot]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two one-dimensional ndarrays.</span>
51+
- <span class="signature">[`sasum( arrays )`][@stdlib/blas/base/ndarray/sasum]</span><span class="delimiter">: </span><span class="description">calculate the sum of absolute values for all elements in a one-dimensional single-precision floating-point ndarray.</span>
5152
- <span class="signature">[`sdot( arrays )`][@stdlib/blas/base/ndarray/sdot]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two one-dimensional single-precision floating-point ndarrays.</span>
5253

5354
</div>
@@ -97,6 +98,8 @@ console.log( objectKeys( ns ) );
9798

9899
[@stdlib/blas/base/ndarray/gdot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/gdot
99100

101+
[@stdlib/blas/base/ndarray/sasum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sasum
102+
100103
[@stdlib/blas/base/ndarray/sdot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sdot
101104

102105
<!-- </toc-links> -->

lib/node_modules/@stdlib/blas/base/ndarray/docs/types/index.d.ts

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,113 @@
2020

2121
/* eslint-disable max-lines */
2222

23+
import dasum = require( '@stdlib/blas/base/ndarray/dasum' );
2324
import ddot = require( '@stdlib/blas/base/ndarray/ddot' );
25+
import gdot = require( '@stdlib/blas/base/ndarray/gdot' );
26+
import sasum = require( '@stdlib/blas/base/ndarray/sasum' );
27+
import sdot = require( '@stdlib/blas/base/ndarray/sdot' );
2428

2529
/**
2630
* Interface describing the `ndarray` namespace.
2731
*/
2832
interface Namespace {
2933
/**
30-
* TODO
34+
* Computes the sum of absolute values for all elements in a one-dimensional double-precision floating-point ndarray.
35+
*
36+
* @param arrays - array-like object containing a one-dimensional input ndarray
37+
* @returns sum
38+
*
39+
* @example
40+
* var Float64Array = require( '@stdlib/array/float64' );
41+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
42+
*
43+
* var xbuf = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] );
44+
* var x = new ndarray( 'float64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
45+
*
46+
* var y = ns.dasum( [ x ] );
47+
* // returns 15.0
48+
*/
49+
dasum: typeof dasum;
50+
51+
/**
52+
* Computes the dot product of two one-dimensional double-precision floating-point ndarrays.
53+
*
54+
* @param arrays - array-like object containing two one-dimensional input ndarrays
55+
* @returns dot product
56+
*
57+
* @example
58+
* var Float64Array = require( '@stdlib/array/float64' );
59+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
60+
*
61+
* var xbuf = new Float64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
62+
* var x = new ndarray( 'float64', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
63+
*
64+
* var ybuf = new Float64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
65+
* var y = new ndarray( 'float64', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
66+
*
67+
* var z = ns.ddot( [ x, y ] );
68+
* // returns -5.0
3169
*/
3270
ddot: typeof ddot;
71+
72+
/**
73+
* Computes the dot product of two one-dimensional ndarrays.
74+
*
75+
* @param arrays - array-like object containing two one-dimensional input ndarrays
76+
* @returns dot product
77+
*
78+
* @example
79+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
80+
*
81+
* var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ];
82+
* var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
83+
*
84+
* var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ];
85+
* var y = new ndarray( 'generic', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
86+
*
87+
* var z = ns.gdot( [ x, y ] );
88+
* // returns -5.0
89+
*/
90+
gdot: typeof gdot;
91+
92+
/**
93+
* Computes the sum of absolute values for all elements in a one-dimensional single-precision floating-point ndarray.
94+
*
95+
* @param arrays - array-like object containing a one-dimensional input ndarray
96+
* @returns sum
97+
*
98+
* @example
99+
* var Float32Array = require( '@stdlib/array/float32' );
100+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
101+
*
102+
* var xbuf = new Float32Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] );
103+
* var x = new ndarray( 'float32', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
104+
*
105+
* var y = ns.sasum( [ x ] );
106+
* // returns 15.0
107+
*/
108+
sasum: typeof sasum;
109+
110+
/**
111+
* Computes the dot product of two one-dimensional single-precision floating-point ndarrays.
112+
*
113+
* @param arrays - array-like object containing two one-dimensional input ndarrays
114+
* @returns dot product
115+
*
116+
* @example
117+
* var Float32Array = require( '@stdlib/array/float32' );
118+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
119+
*
120+
* var xbuf = new Float32Array( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
121+
* var x = new ndarray( 'float32', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
122+
*
123+
* var ybuf = new Float32Array( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
124+
* var y = new ndarray( 'float32', ybuf, [ 5 ], [ 1 ], 0, 'row-major' );
125+
*
126+
* var z = ns.sdot( [ x, y ] );
127+
* // returns -5.0
128+
*/
129+
sdot: typeof sdot;
33130
}
34131

35132
/**
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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+
# gasum
22+
23+
> Calculate the sum of absolute values for all elements in a one-dimensional ndarray.
24+
25+
<section class="intro">
26+
27+
The [_L1_ norm][l1norm] is defined as
28+
29+
<!-- <equation class="equation" label="eq:l1norm" align="center" raw="\|\mathbf{x}\|_1 = \sum_{i=0}^{n-1} \vert x_i \vert" alt="L1 norm definition."> -->
30+
31+
```math
32+
\|\mathbf{x}\|_1 = \sum_{i=0}^{n-1} \vert x_i \vert
33+
```
34+
35+
<!-- <div class="equation" align="center" data-raw-text="\|\mathbf{x}\|_1 = \sum_{i=0}^{n-1} \vert x_i \vert" data-equation="eq:l1norm">
36+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@30de397fadee10fa175a8332ae1447737f201818/lib/node_modules/@stdlib/blas/base/gasum/docs/img/equation_l1norm.svg" alt="L1 norm definition.">
37+
<br>
38+
</div> -->
39+
40+
<!-- </equation> -->
41+
42+
</section>
43+
44+
<!-- /.intro -->
45+
46+
<section class="usage">
47+
48+
## Usage
49+
50+
```javascript
51+
var gasum = require( '@stdlib/blas/base/ndarray/gasum' );
52+
```
53+
54+
#### gasum( arrays )
55+
56+
Computes the sum of absolute values for all elements in a one-dimensional ndarray.
57+
58+
```javascript
59+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
60+
61+
var xbuf = [ 1.0, -2.0, 3.0, -4.0, 5.0 ];
62+
var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
63+
64+
var y = gasum( [ x ] );
65+
// returns 15.0
66+
```
67+
68+
The function has the following parameters:
69+
70+
- **arrays**: array-like object containing a one-dimensional input ndarray.
71+
72+
</section>
73+
74+
<!-- /.usage -->
75+
76+
<section class="notes">
77+
78+
</section>
79+
80+
<!-- /.notes -->
81+
82+
<section class="examples">
83+
84+
## Examples
85+
86+
<!-- eslint no-undef: "error" -->
87+
88+
```javascript
89+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
90+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
91+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
92+
var gasum = require( '@stdlib/blas/base/ndarray/gasum' );
93+
94+
var opts = {
95+
'dtype': 'generic'
96+
};
97+
98+
var xbuf = discreteUniform( 10, -500, 500, opts );
99+
var x = new ndarray( opts.dtype, xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
100+
console.log( ndarray2array( x ) );
101+
102+
var out = gasum( [ x ] );
103+
console.log( out );
104+
```
105+
106+
</section>
107+
108+
<!-- /.examples -->
109+
110+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
111+
112+
<section class="related">
113+
114+
</section>
115+
116+
<!-- /.related -->
117+
118+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
119+
120+
<section class="links">
121+
122+
[l1norm]: https://en.wikipedia.org/wiki/Norm_%28mathematics%29
123+
124+
</section>
125+
126+
<!-- /.links -->

0 commit comments

Comments
 (0)