Skip to content

Commit cbe9d1a

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 741b6f1 + 53c0427 commit cbe9d1a

File tree

141 files changed

+5994
-1139
lines changed

Some content is hidden

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

141 files changed

+5994
-1139
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ int main( void ) {
307307
308308
## See Also
309309
310-
- <span class="package-name">[`@stdlib/blas/base/daxpy`][@stdlib/blas/base/daxpy]</span><span class="delimiter">: </span><span class="description">multiply a vector x by a constant and add the result to y.</span>
311-
- <span class="package-name">[`@stdlib/blas/base/gaxpy`][@stdlib/blas/base/gaxpy]</span><span class="delimiter">: </span><span class="description">multiply x by a constant and add the result to y.</span>
310+
- <span class="package-name">[`@stdlib/blas/base/daxpy`][@stdlib/blas/base/daxpy]</span><span class="delimiter">: </span><span class="description">multiply a vector `x` by a constant and add the result to `y`.</span>
311+
- <span class="package-name">[`@stdlib/blas/base/gaxpy`][@stdlib/blas/base/gaxpy]</span><span class="delimiter">: </span><span class="description">multiply a vector `x` by a constant and add the result to `y`.</span>
312312
313313
</section>
314314

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ var ns = extblas;
118118
- <span class="signature">[`gsortsh( N, order, x, stride )`][@stdlib/blas/ext/base/gsortsh]</span><span class="delimiter">: </span><span class="description">sort a strided array using Shellsort.</span>
119119
- <span class="signature">[`gsum( N, x, stride )`][@stdlib/blas/ext/base/gsum]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements.</span>
120120
- <span class="signature">[`gsumkbn( N, x, stride )`][@stdlib/blas/ext/base/gsumkbn]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using an improved Kahan–Babuška algorithm.</span>
121-
- <span class="signature">[`gsumkbn2( N, x, stride )`][@stdlib/blas/ext/base/gsumkbn2]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using a second-order iterative Kahan–Babuška algorithm.</span>
122-
- <span class="signature">[`gsumors( N, x, stride )`][@stdlib/blas/ext/base/gsumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using ordinary recursive summation.</span>
123-
- <span class="signature">[`gsumpw( N, x, stride )`][@stdlib/blas/ext/base/gsumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using pairwise summation.</span>
121+
- <span class="signature">[`gsumkbn2( N, x, strideX )`][@stdlib/blas/ext/base/gsumkbn2]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using a second-order iterative Kahan–Babuška algorithm.</span>
122+
- <span class="signature">[`gsumors( N, x, strideX )`][@stdlib/blas/ext/base/gsumors]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using ordinary recursive summation.</span>
123+
- <span class="signature">[`gsumpw( N, x, strideX )`][@stdlib/blas/ext/base/gsumpw]</span><span class="delimiter">: </span><span class="description">calculate the sum of strided array elements using pairwise summation.</span>
124124
- <span class="signature">[`sapx( N, alpha, x, stride )`][@stdlib/blas/ext/base/sapx]</span><span class="delimiter">: </span><span class="description">add a constant to each element in a single-precision floating-point strided array.</span>
125125
- <span class="signature">[`sapxsum( N, alpha, x, stride )`][@stdlib/blas/ext/base/sapxsum]</span><span class="delimiter">: </span><span class="description">add a constant to each single-precision floating-point strided array element and compute the sum.</span>
126126
- <span class="signature">[`sapxsumkbn( N, alpha, x, stride )`][@stdlib/blas/ext/base/sapxsumkbn]</span><span class="delimiter">: </span><span class="description">add a constant to each single-precision floating-point strided array element and compute the sum using an improved Kahan–Babuška algorithm.</span>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,9 +1809,9 @@ interface Namespace {
18091809
*
18101810
* @param N - number of indexed elements
18111811
* @param x - input array
1812-
* @param strideX - `x` stride length
1812+
* @param strideX - stride length for `x`
18131813
* @param out - output array whose first element is the sum and whose second element is the number of non-NaN elements
1814-
* @param strideOut - `out` stride length
1814+
* @param strideOut - stride length for `out`
18151815
* @returns output array
18161816
*
18171817
* @example
@@ -2191,7 +2191,7 @@ interface Namespace {
21912191
*
21922192
* @param N - number of indexed elements
21932193
* @param x - input array
2194-
* @param stride - stride length
2194+
* @param strideX - stride length
21952195
* @returns sum
21962196
*
21972197
* @example
@@ -2213,7 +2213,7 @@ interface Namespace {
22132213
*
22142214
* @param N - number of indexed elements
22152215
* @param x - input array
2216-
* @param stride - stride length
2216+
* @param strideX - stride length
22172217
* @returns sum
22182218
*
22192219
* @example
@@ -2235,7 +2235,7 @@ interface Namespace {
22352235
*
22362236
* @param N - number of indexed elements
22372237
* @param x - input array
2238-
* @param stride - stride length
2238+
* @param strideX - stride length
22392239
* @returns sum
22402240
*
22412241
* @example

lib/node_modules/@stdlib/blas/ext/base/gcusumors/README.md

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,17 @@ The function has the following parameters:
5959
- **N**: number of indexed elements.
6060
- **sum**: initial sum.
6161
- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
62-
- **strideX**: index increment for `x`.
62+
- **strideX**: stride length for `x`.
6363
- **y**: output [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
64-
- **strideY**: index increment for `y`.
64+
- **strideY**: stride length for `y`.
6565

66-
The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to compute the cumulative sum of every other element in `x`,
66+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element:
6767

6868
```javascript
69-
var floor = require( '@stdlib/math/base/special/floor' );
70-
7169
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
7270
var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
7371

74-
var N = floor( x.length / 2 );
75-
76-
var v = gcusumors( N, 0.0, x, 2, y, 1 );
72+
var v = gcusumors( 4, 0.0, x, 2, y, 1 );
7773
// y => [ 1.0, 3.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]
7874
```
7975

@@ -83,7 +79,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [
8379

8480
```javascript
8581
var Float64Array = require( '@stdlib/array/float64' );
86-
var floor = require( '@stdlib/math/base/special/floor' );
8782

8883
// Initial arrays...
8984
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
@@ -93,9 +88,7 @@ var y0 = new Float64Array( x0.length );
9388
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
9489
var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element
9590

96-
var N = floor( x0.length / 2 );
97-
98-
gcusumors( N, 0.0, x1, -2, y1, 1 );
91+
gcusumors( 4, 0.0, x1, -2, y1, 1 );
9992
// y0 => <Float64Array>[ 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0, 0.0 ]
10093
```
10194

@@ -116,17 +109,13 @@ The function has the following additional parameters:
116109
- **offsetX**: starting index for `x`.
117110
- **offsetY**: starting index for `y`.
118111

119-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in `x` starting from the second value and to store in the last `N` elements of `y` starting from the last element
112+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other element in the strided input array starting from the second element and to store in the last `N` elements of the strided output array starting from the last element:
120113

121114
```javascript
122-
var floor = require( '@stdlib/math/base/special/floor' );
123-
124115
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
125116
var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
126117

127-
var N = floor( x.length / 2 );
128-
129-
gcusumors.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 );
118+
gcusumors.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 );
130119
// y => [ 0.0, 0.0, 0.0, 0.0, 5.0, 1.0, -1.0, 1.0 ]
131120
```
132121

@@ -153,20 +142,14 @@ gcusumors.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 );
153142
<!-- eslint no-undef: "error" -->
154143

155144
```javascript
156-
var randu = require( '@stdlib/random/base/randu' );
157-
var round = require( '@stdlib/math/base/special/round' );
145+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
158146
var Float64Array = require( '@stdlib/array/float64' );
159147
var gcusumors = require( '@stdlib/blas/ext/base/gcusumors' );
160148

161-
var y;
162-
var x;
163-
var i;
164-
165-
x = new Float64Array( 10 );
166-
y = new Float64Array( x.length );
167-
for ( i = 0; i < x.length; i++ ) {
168-
x[ i ] = round( randu()*100.0 );
169-
}
149+
var x = discreteUniform( 10, -100, 100, {
150+
'dtype': 'float64'
151+
});
152+
var y = new Float64Array( x.length );
170153
console.log( x );
171154
console.log( y );
172155

lib/node_modules/@stdlib/blas/ext/base/gcusumors/benchmark/benchmark.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var gfill = require( '@stdlib/blas/ext/base/gfill' );
28+
var Float64Array = require( '@stdlib/array/float64' );
2829
var pkg = require( './../package.json' ).name;
2930
var gcusumors = require( './../lib/main.js' );
3031

3132

33+
// VARIABLES //
34+
35+
var options = {
36+
'dtype': 'float64'
37+
};
38+
39+
3240
// FUNCTIONS //
3341

3442
/**
@@ -39,16 +47,8 @@ var gcusumors = require( './../lib/main.js' );
3947
* @returns {Function} benchmark function
4048
*/
4149
function createBenchmark( len ) {
42-
var y;
43-
var x;
44-
var i;
45-
46-
x = [];
47-
y = [];
48-
for ( i = 0; i < len; i++ ) {
49-
x.push( ( randu()*20.0 ) - 10.0 );
50-
y.push( 0.0 );
51-
}
50+
var x = uniform( len, -100, 100, options );
51+
var y = new Float64Array( len );
5252
return benchmark;
5353

5454
function benchmark( b ) {

lib/node_modules/@stdlib/blas/ext/base/gcusumors/benchmark/benchmark.ndarray.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var gfill = require( '@stdlib/blas/ext/base/gfill' );
28+
var Float64Array = require( '@stdlib/array/float64' );
2829
var pkg = require( './../package.json' ).name;
2930
var gcusumors = require( './../lib/ndarray.js' );
3031

3132

33+
// VARIABLES //
34+
35+
var options = {
36+
'dtype': 'float64'
37+
};
38+
39+
3240
// FUNCTIONS //
3341

3442
/**
@@ -39,16 +47,8 @@ var gcusumors = require( './../lib/ndarray.js' );
3947
* @returns {Function} benchmark function
4048
*/
4149
function createBenchmark( len ) {
42-
var x;
43-
var y;
44-
var i;
45-
46-
x = [];
47-
y = [];
48-
for ( i = 0; i < len; i++ ) {
49-
x.push( ( randu()*20.0 ) - 10.0 );
50-
y.push( 0.0 );
51-
}
50+
var x = uniform( len, -100, 100, options );
51+
var y = new Float64Array( len );
5252
return benchmark;
5353

5454
function benchmark( b ) {

lib/node_modules/@stdlib/blas/ext/base/gcusumors/docs/repl.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Computes the cumulative sum of strided array elements using ordinary
44
recursive summation.
55

6-
The `N` and `stride` parameters determine which elements in `x` and `y` are
7-
accessed at runtime.
6+
The `N` and stride parameters determine which elements in the strided arrays
7+
are accessed at runtime.
88

99
Indexing is relative to the first index. To introduce an offset, use a typed
1010
array view.
@@ -23,13 +23,13 @@
2323
Input array.
2424

2525
strideX: integer
26-
Index increment for `x`.
26+
Stride length for `x`.
2727

2828
y: Array<number>|TypedArray
2929
Output array.
3030

3131
strideY: integer
32-
Index increment for `y`.
32+
Stride length for `y`.
3333

3434
Returns
3535
-------
@@ -44,31 +44,30 @@
4444
> {{alias}}( x.length, 0.0, x, 1, y, 1 )
4545
[ 1.0, -1.0, 1.0 ]
4646

47-
// Using `N` and `stride` parameters:
47+
// Using `N` and stride parameters:
4848
> x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ];
4949
> y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
50-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
51-
> {{alias}}( N, 0.0, x, 2, y, 2 )
50+
> {{alias}}( 3, 0.0, x, 2, y, 2 )
5251
[ -2.0, 0.0, -1.0, 0.0, 1.0, 0.0 ]
5352

5453
// Using view offsets:
5554
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
5655
> var y0 = new {{alias:@stdlib/array/float64}}( x0.length );
5756
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
5857
> var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 );
59-
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
60-
> {{alias}}( N, 0.0, x1, 2, y1, 1 )
58+
> {{alias}}( 3, 0.0, x1, 2, y1, 1 )
6159
<Float64Array>[ -2.0, 0.0, -1.0 ]
6260
> y0
6361
<Float64Array>[ 0.0, 0.0, 0.0, -2.0, 0.0, -1.0 ]
6462

63+
6564
{{alias}}.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY )
6665
Computes the cumulative sum of strided array elements using ordinary
6766
recursive summation and alternative indexing semantics.
6867

6968
While typed array views mandate a view offset based on the underlying
70-
buffer, the `offset` parameter supports indexing semantics based on a
71-
starting index.
69+
buffer, the offset parameters support indexing semantics based on starting
70+
indices.
7271

7372
Parameters
7473
----------
@@ -82,7 +81,7 @@
8281
Input array.
8382

8483
strideX: integer
85-
Index increment for `x`.
84+
Stride length for `x`.
8685

8786
offsetX: integer
8887
Starting index for `x`.
@@ -91,7 +90,7 @@
9190
Output array.
9291

9392
strideY: integer
94-
Index increment for `y`.
93+
Stride length for `y`.
9594

9695
offsetY: integer
9796
Starting index for `y`.
@@ -107,14 +106,13 @@
107106
> var x = [ 1.0, -2.0, 2.0 ];
108107
> var y = [ 0.0, 0.0, 0.0 ];
109108
> {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
110-
<Float64Array>[ 1.0, -1.0, 1.0 ]
109+
[ 1.0, -1.0, 1.0 ]
111110

112111
// Advanced indexing:
113112
> x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ];
114113
> y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
115-
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
116-
> {{alias}}.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 )
117-
<Float64Array>[ 0.0, 0.0, 0.0, -1.0, 0.0, -2.0 ]
114+
> {{alias}}.ndarray( 3, 0.0, x, 2, 1, y, -1, y.length-1 )
115+
[ 0.0, 0.0, 0.0, -1.0, 0.0, -2.0 ]
118116

119117
See Also
120118
--------

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ interface Routine {
3232
* @param N - number of indexed elements
3333
* @param sum - initial sum
3434
* @param x - input array
35-
* @param strideX - `x` stride length
35+
* @param strideX - stride length for `x`
3636
* @param y - output array
37-
* @param strideY - `y` stride length
37+
* @param strideY - stride length for `y`
3838
* @returns output array
3939
*
4040
* @example
@@ -52,10 +52,10 @@ interface Routine {
5252
* @param N - number of indexed elements
5353
* @param sum - initial sum
5454
* @param x - input array
55-
* @param strideX - `x` stride length
55+
* @param strideX - stride length for `x`
5656
* @param offsetX - starting index for `x`
5757
* @param y - output array
58-
* @param strideY - `y` stride length
58+
* @param strideY - stride length for `y`
5959
* @param offsetY - starting index for `y`
6060
* @returns output array
6161
*
@@ -75,9 +75,9 @@ interface Routine {
7575
* @param N - number of indexed elements
7676
* @param sum - initial sum
7777
* @param x - input array
78-
* @param strideX - `x` stride length
78+
* @param strideX - stride length for `x`
7979
* @param y - output array
80-
* @param strideY - `y` stride length
80+
* @param strideY - stride length for `y`
8181
* @returns output array
8282
*
8383
* @example

0 commit comments

Comments
 (0)