Skip to content

Commit d60fca2

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 8d4fc66 + be4a2ee commit d60fca2

File tree

464 files changed

+29075
-2191
lines changed

Some content is hidden

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

464 files changed

+29075
-2191
lines changed

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,12 +1444,12 @@ interface Namespace {
14441444
dsumpw: typeof dsumpw;
14451445

14461446
/**
1447-
* Adds a constant to each element in a strided array.
1447+
* Adds a scalar constant to each element in a strided array.
14481448
*
14491449
* @param N - number of indexed elements
1450-
* @param alpha - constant
1450+
* @param alpha - scalar constant
14511451
* @param x - input array
1452-
* @param stride - stride length
1452+
* @param strideX - stride length
14531453
* @returns `x`
14541454
*
14551455
* @example
@@ -1467,12 +1467,12 @@ interface Namespace {
14671467
gapx: typeof gapx;
14681468

14691469
/**
1470-
* Adds a constant to each strided array element and computes the sum.
1470+
* Adds a scalar constant to each strided array element and computes the sum.
14711471
*
14721472
* @param N - number of indexed elements
14731473
* @param alpha - constant
14741474
* @param x - input array
1475-
* @param stride - stride length
1475+
* @param strideX - stride length
14761476
* @returns sum
14771477
*
14781478
* @example
@@ -1513,12 +1513,12 @@ interface Namespace {
15131513
gapxsumkbn: typeof gapxsumkbn;
15141514

15151515
/**
1516-
* Adds a constant to each strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm.
1516+
* Adds a scalar constant to each strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm.
15171517
*
15181518
* @param N - number of indexed elements
1519-
* @param alpha - constant
1519+
* @param alpha - scalar constant
15201520
* @param x - input array
1521-
* @param stride - stride length
1521+
* @param strideX - stride length
15221522
* @returns sum
15231523
*
15241524
* @example
@@ -1536,12 +1536,12 @@ interface Namespace {
15361536
gapxsumkbn2: typeof gapxsumkbn2;
15371537

15381538
/**
1539-
* Adds a constant to each strided array element and computes the sum using ordinary recursive summation.
1539+
* Adds a scalar constant to each strided array element and computes the sum using ordinary recursive summation.
15401540
*
15411541
* @param N - number of indexed elements
1542-
* @param alpha - constant
1542+
* @param alpha - scalar constant
15431543
* @param x - input array
1544-
* @param stride - stride length
1544+
* @param strideX - stride length
15451545
* @returns sum
15461546
*
15471547
* @example
@@ -1559,12 +1559,12 @@ interface Namespace {
15591559
gapxsumors: typeof gapxsumors;
15601560

15611561
/**
1562-
* Adds a constant to each strided array element and computes the sum using pairwise summation.
1562+
* Adds a scalar constant to each strided array element and computes the sum using pairwise summation.
15631563
*
15641564
* @param N - number of indexed elements
1565-
* @param alpha - constant
1565+
* @param alpha - scalar constant
15661566
* @param x - input array
1567-
* @param stride - stride length
1567+
* @param strideX - stride length
15681568
* @returns sum
15691569
*
15701570
* @example
@@ -1586,7 +1586,7 @@ interface Namespace {
15861586
*
15871587
* @param N - number of indexed elements
15881588
* @param x - input array
1589-
* @param stride - stride length
1589+
* @param strideX - stride length
15901590
* @returns sum
15911591
*
15921592
* @example
@@ -1609,9 +1609,9 @@ interface Namespace {
16091609
* @param N - number of indexed elements
16101610
* @param sum - initial sum
16111611
* @param x - input array
1612-
* @param strideX - `x` stride length
1612+
* @param strideX - stride length for `x`
16131613
* @param y - output array
1614-
* @param strideY - `y` stride length
1614+
* @param strideY - stride length for `y`
16151615
* @returns output array
16161616
*
16171617
* @example
@@ -1663,9 +1663,9 @@ interface Namespace {
16631663
* @param N - number of indexed elements
16641664
* @param sum - initial sum
16651665
* @param x - input array
1666-
* @param strideX - `x` stride length
1666+
* @param strideX - stride length for `x`
16671667
* @param y - output array
1668-
* @param strideY - `y` stride length
1668+
* @param strideY - stride length for `y`
16691669
* @returns output array
16701670
*
16711671
* @example
@@ -1717,9 +1717,9 @@ interface Namespace {
17171717
* @param N - number of indexed elements
17181718
* @param sum - initial sum
17191719
* @param x - input array
1720-
* @param strideX - `x` stride length
1720+
* @param strideX - stride length for `x`
17211721
* @param y - output array
1722-
* @param strideY - `y` stride length
1722+
* @param strideY - stride length for `y`
17231723
* @returns output array
17241724
*
17251725
* @example
@@ -1739,12 +1739,12 @@ interface Namespace {
17391739
gcusumpw: typeof gcusumpw;
17401740

17411741
/**
1742-
* Fills a strided array with a specified scalar value.
1742+
* Fills a strided array with a specified scalar constant.
17431743
*
17441744
* @param N - number of indexed elements
1745-
* @param alpha - constant
1745+
* @param alpha - scalar constant
17461746
* @param x - input array
1747-
* @param stride - stride length
1747+
* @param strideX - stride length
17481748
* @returns `x`
17491749
*
17501750
* @example
@@ -1777,8 +1777,8 @@ interface Namespace {
17771777
*
17781778
* @param N - number of indexed elements
17791779
* @param x - input array
1780-
* @param stride - stride length
1781-
* @param clbk - callback
1780+
* @param strideX - stride length
1781+
* @param clbk - callback function
17821782
* @param thisArg - execution context
17831783
* @returns `x`
17841784
*
@@ -2169,7 +2169,7 @@ interface Namespace {
21692169
*
21702170
* @param N - number of indexed elements
21712171
* @param x - input array
2172-
* @param stride - stride length
2172+
* @param strideX - stride length
21732173
* @returns sum
21742174
*
21752175
* @example
@@ -2307,12 +2307,12 @@ interface Namespace {
23072307
sapxsum: typeof sapxsum;
23082308

23092309
/**
2310-
* Adds a constant to each single-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm.
2310+
* Adds a scalar constant to each single-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm.
23112311
*
23122312
* @param N - number of indexed elements
2313-
* @param alpha - constant
2313+
* @param alpha - scalar constant
23142314
* @param x - input array
2315-
* @param stride - stride length
2315+
* @param strideX - stride length
23162316
* @returns sum
23172317
*
23182318
* @example
@@ -2446,9 +2446,9 @@ interface Namespace {
24462446
* @param N - number of indexed elements
24472447
* @param sum - initial sum
24482448
* @param x - input array
2449-
* @param strideX - `x` stride length
2449+
* @param strideX - stride length for `x`
24502450
* @param y - output array
2451-
* @param strideY - `y` stride length
2451+
* @param strideY - stride length for `y`
24522452
* @returns output array
24532453
*
24542454
* @example

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

Lines changed: 132 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# sapx
2222

23-
> Add a constant to each element in a single-precision floating-point strided array.
23+
> Add a scalar constant to each element in a single-precision floating-point strided array.
2424
2525
<section class="usage">
2626

@@ -30,9 +30,9 @@ limitations under the License.
3030
var sapx = require( '@stdlib/blas/ext/base/sapx' );
3131
```
3232

33-
#### sapx( N, alpha, x, stride )
33+
#### sapx( N, alpha, x, strideX )
3434

35-
Adds a constant `alpha` to each element in a single-precision floating-point strided array `x`.
35+
Adds a scalar constant to each element in a single-precision floating-point strided array.
3636

3737
```javascript
3838
var Float32Array = require( '@stdlib/array/float32' );
@@ -48,9 +48,9 @@ The function has the following parameters:
4848
- **N**: number of indexed elements.
4949
- **alpha**: scalar constant.
5050
- **x**: input [`Float32Array`][@stdlib/array/float32].
51-
- **stride**: index increment.
51+
- **strideX**: stride length.
5252

53-
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element
53+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element:
5454

5555
```javascript
5656
var Float32Array = require( '@stdlib/array/float32' );
@@ -77,9 +77,9 @@ sapx( 3, 5.0, x1, 2 );
7777
// x0 => <Float32Array>[ 1.0, 3.0, 3.0, 1.0, 5.0, -1.0 ]
7878
```
7979

80-
#### sapx.ndarray( N, alpha, x, stride, offset )
80+
#### sapx.ndarray( N, alpha, x, strideX, offsetX )
8181

82-
Adds a constant `alpha` to each element in a single-precision floating-point strided array `x` using alternative indexing semantics.
82+
Adds a scalar constant to each element in a single-precision floating-point strided array using alternative indexing semantics.
8383

8484
```javascript
8585
var Float32Array = require( '@stdlib/array/float32' );
@@ -92,9 +92,9 @@ sapx.ndarray( x.length, 5.0, x, 1, 0 );
9292

9393
The function has the following additional parameters:
9494

95-
- **offset**: starting index.
95+
- **offsetX**: starting index.
9696

97-
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 access only the last three elements of the strided array
97+
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 access only the last three elements of the strided array:
9898

9999
```javascript
100100
var Float32Array = require( '@stdlib/array/float32' );
@@ -126,11 +126,12 @@ sapx.ndarray( 3, 5.0, x, 1, x.length-3 );
126126
<!-- eslint no-undef: "error" -->
127127

128128
```javascript
129-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
130-
var filledarrayBy = require( '@stdlib/array/filled-by' );
129+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
131130
var sapx = require( '@stdlib/blas/ext/base/sapx' );
132131

133-
var x = filledarrayBy( 10, 'float32', uniform( -100.0, 100.0 ) );
132+
var x = discreteUniform( 10, -100, 100, {
133+
'dtype': 'float32'
134+
});
134135
console.log( x );
135136

136137
sapx( x.length, 5.0, x, 1 );
@@ -141,6 +142,125 @@ console.log( x );
141142

142143
<!-- /.examples -->
143144

145+
<!-- C interface documentation. -->
146+
147+
* * *
148+
149+
<section class="c">
150+
151+
## C APIs
152+
153+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
154+
155+
<section class="intro">
156+
157+
</section>
158+
159+
<!-- /.intro -->
160+
161+
<!-- C usage documentation. -->
162+
163+
<section class="usage">
164+
165+
### Usage
166+
167+
```c
168+
#include "stdlib/blas/ext/base/sapx.h"
169+
```
170+
171+
#### stdlib_strided_sapx( N, alpha, \*X, strideX )
172+
173+
Adds a scalar constant to each element in a single-precision floating-point strided array.
174+
175+
```c
176+
float x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
177+
178+
stdlib_strided_sapx( 4, 5.0f, x, 1 );
179+
```
180+
181+
The function accepts the following arguments:
182+
183+
- **N**: `[in] CBLAS_INT` number of indexed elements.
184+
- **alpha**: `[in] float` scalar constant.
185+
- **X**: `[inout] float*` input array.
186+
- **strideX**: `[in] CBLAS_INT` stride length.
187+
188+
```c
189+
void stdlib_strided_sapx( const CBLAS_INT N, const float alpha, float *X, const CBLAS_INT strideX );
190+
```
191+
192+
#### stdlib_strided_sapx_ndarray( N, alpha, \*X, strideX, offsetX )
193+
194+
Adds a scalar constant to each element in a single-precision floating-point strided array using alternative indexing semantics.
195+
196+
```c
197+
float x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
198+
199+
stdlib_strided_sapx_ndarray( 4, 5.0f, x, 1, 0 );
200+
```
201+
202+
The function accepts the following arguments:
203+
204+
- **N**: `[in] CBLAS_INT` number of indexed elements.
205+
- **alpha**: `[in] float` scalar constant.
206+
- **X**: `[inout] float*` input array.
207+
- **strideX**: `[in] CBLAS_INT` stride length.
208+
- **offsetX**: `[in] CBLAS_INT` starting index.
209+
210+
```c
211+
void stdlib_strided_sapx_ndarray( const CBLAS_INT N, const float alpha, float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
212+
```
213+
214+
</section>
215+
216+
<!-- /.usage -->
217+
218+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
219+
220+
<section class="notes">
221+
222+
</section>
223+
224+
<!-- /.notes -->
225+
226+
<!-- C API usage examples. -->
227+
228+
<section class="examples">
229+
230+
### Examples
231+
232+
```c
233+
#include "stdlib/blas/ext/base/sapx.h"
234+
#include <stdio.h>
235+
236+
int main( void ) {
237+
// Create a strided array:
238+
float x[] = { 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, -8.0f };
239+
240+
// Specify the number of indexed elements:
241+
const int N = 8;
242+
243+
// Specify a stride:
244+
const int strideX = 1;
245+
246+
// Add a constant to each element:
247+
stdlib_strided_sapx( N, 5.0f, x, strideX );
248+
249+
// Print the result:
250+
for ( int i = 0; i < 8; i++ ) {
251+
printf( "x[ %i ] = %f\n", i, x[ i ] );
252+
}
253+
}
254+
```
255+
256+
</section>
257+
258+
<!-- /.examples -->
259+
260+
</section>
261+
262+
<!-- /.c -->
263+
144264
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
145265
146266
<section class="related">

0 commit comments

Comments
 (0)