Skip to content

Commit aca52ad

Browse files
authored
Merge branch 'develop' into blas/cindex-of-row
2 parents 123ad03 + 62019bc commit aca52ad

293 files changed

Lines changed: 22928 additions & 108 deletions

File tree

Some content is hidden

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

lib/node_modules/@stdlib/array/base/falses/docs/types/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import falses = require( './index' );
2929
// The compiler throws an error if the function is provided an argument which is not a number...
3030
{
3131
falses( 'abc' ); // $ExpectError
32+
falses( true ); // $ExpectError
3233
falses( false ); // $ExpectError
33-
falses( false ); // $ExpectError
34-
falses( false ); // $ExpectError
34+
falses( null ); // $ExpectError
3535
falses( [] ); // $ExpectError
3636
falses( {} ); // $ExpectError
3737
falses( ( x: number ): number => x ); // $ExpectError

lib/node_modules/@stdlib/array/base/trues/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import trues = require( './index' );
3131
trues( 'abc' ); // $ExpectError
3232
trues( true ); // $ExpectError
3333
trues( false ); // $ExpectError
34-
trues( true ); // $ExpectError
34+
trues( null ); // $ExpectError
3535
trues( [] ); // $ExpectError
3636
trues( {} ); // $ExpectError
3737
trues( ( x: number ): number => x ); // $ExpectError

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/array/nulls/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bench( pkg, function benchmark( b ) {
4141
}
4242
b.toc();
4343
if ( !isCollection( arr ) ) {
44-
b.fail( 'should return a typed array' );
44+
b.fail( 'should return an array' );
4545
}
4646
b.pass( 'benchmark finished' );
4747
b.end();

lib/node_modules/@stdlib/assert/has-dataview-support/test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ tape( 'if `DataView` is supported, detection result is `true`', function test( t
7171
}
7272
out = {};
7373
out.buffer = buf;
74-
out._buffer = new Array( byteLength ); // eslint-disable-line no-underscore-dangle
74+
out._buffer = []; // eslint-disable-line no-underscore-dangle
7575
for ( i = 0; i < byteLength; i++ ) {
76-
out._buffer[ i ] = 0; // eslint-disable-line no-underscore-dangle
76+
out._buffer.push( 0 ); // eslint-disable-line no-underscore-dangle
7777
}
7878
out.byteLength = byteLength;
7979
out.byteOffset = byteOffset;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import matrixTriangleResolveEnum = require( '@stdlib/blas/base/matrix-triangle-r
8383
import matrixTriangleResolveStr = require( '@stdlib/blas/base/matrix-triangle-resolve-str' );
8484
import matrixTriangleStr2Enum = require( '@stdlib/blas/base/matrix-triangle-str2enum' );
8585
import matrixTriangles = require( '@stdlib/blas/base/matrix-triangles' );
86+
import ndarray = require( '@stdlib/blas/base/ndarray' );
8687
import operationSideEnum2Str = require( '@stdlib/blas/base/operation-side-enum2str' );
8788
import operationSideResolveEnum = require( '@stdlib/blas/base/operation-side-resolve-enum' );
8889
import operationSideResolveStr = require( '@stdlib/blas/base/operation-side-resolve-str' );
@@ -1705,6 +1706,11 @@ interface Namespace {
17051706
*/
17061707
matrixTriangles: typeof matrixTriangles;
17071708

1709+
/**
1710+
* Base ndarray BLAS functions.
1711+
*/
1712+
ndarray: typeof ndarray;
1713+
17081714
/**
17091715
* Returns the BLAS operation side string associated with a BLAS operation side enumeration constant.
17101716
*

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ The namespace exposes the following APIs:
4747

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>
50+
- <span class="signature">[`gasum( arrays )`][@stdlib/blas/base/ndarray/gasum]</span><span class="delimiter">: </span><span class="description">calculate the sum of absolute values for all elements in a one-dimensional ndarray.</span>
5051
- <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>
52+
- <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>
5153
- <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>
5254

5355
</div>
@@ -95,8 +97,12 @@ console.log( objectKeys( ns ) );
9597

9698
[@stdlib/blas/base/ndarray/ddot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/ddot
9799

100+
[@stdlib/blas/base/ndarray/gasum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/gasum
101+
98102
[@stdlib/blas/base/ndarray/gdot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/gdot
99103

104+
[@stdlib/blas/base/ndarray/sasum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sasum
105+
100106
[@stdlib/blas/base/ndarray/sdot]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/ndarray/sdot
101107

102108
<!-- </toc-links> -->

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

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,131 @@
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 gasum = require( '@stdlib/blas/base/ndarray/gasum' );
26+
import gdot = require( '@stdlib/blas/base/ndarray/gdot' );
27+
import sasum = require( '@stdlib/blas/base/ndarray/sasum' );
28+
import sdot = require( '@stdlib/blas/base/ndarray/sdot' );
2429

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

35150
/**
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)