Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jan 11, 2025
1 parent fa7acec commit 5fa5280
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 127 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,9 @@ A total of 8 people contributed to this release. Thank you to the following cont

<details>

- [`53c0427`](https://github.com/stdlib-js/stdlib/commit/53c0427db5f49ab6209c55941ff15270a3569d44) - **refactor:** update `blas/ext/base/gcusumors` to follow current project conventions [(#4453)](https://github.com/stdlib-js/stdlib/pull/4453) _(by Muhammad Haris, Athan Reines)_
- [`dbb338e`](https://github.com/stdlib-js/stdlib/commit/dbb338e80336515e9f7ef602188985bbbe9b9010) - **docs:** update related packages sections [(#4690)](https://github.com/stdlib-js/stdlib/pull/4690) _(by stdlib-bot)_
- [`09b5945`](https://github.com/stdlib-js/stdlib/commit/09b5945ae5fedad2de3f3154c599868b8414967d) - **docs:** update namespace TypeScript declaration comments [(#4691)](https://github.com/stdlib-js/stdlib/pull/4691) _(by stdlib-bot, Philipp Burckhardt)_
- [`ba7f732`](https://github.com/stdlib-js/stdlib/commit/ba7f7328fc7fe6e2049f79421f152303daa1f290) - **docs:** update namespace table of contents [(#4693)](https://github.com/stdlib-js/stdlib/pull/4693) _(by stdlib-bot, Philipp Burckhardt)_
- [`bb638df`](https://github.com/stdlib-js/stdlib/commit/bb638df38852d5ba3e341e9d607a0900a5d55723) - **refactor:** update `blas/ext/base/gnannsumkbn` to follow current project conventions [(#4631)](https://github.com/stdlib-js/stdlib/pull/4631) _(by Muhammad Haris)_
- [`0639c11`](https://github.com/stdlib-js/stdlib/commit/0639c11f0aac69a249c9710c9031e4f9cec14f62) - **refactor:** update `blas/ext/base/gsumkbn2` to follow current project conventions [(#4678)](https://github.com/stdlib-js/stdlib/pull/4678) _(by Muhammad Haris)_
Expand Down
4 changes: 2 additions & 2 deletions base/saxpy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ int main( void ) {
## See Also
- <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>
- <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>
- <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>
- <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>
</section>
Expand Down
10 changes: 5 additions & 5 deletions ext/base/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1809,9 +1809,9 @@ interface Namespace {
*
* @param N - number of indexed elements
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param out - output array whose first element is the sum and whose second element is the number of non-NaN elements
* @param strideOut - `out` stride length
* @param strideOut - stride length for `out`
* @returns output array
*
* @example
Expand Down Expand Up @@ -2191,7 +2191,7 @@ interface Namespace {
*
* @param N - number of indexed elements
* @param x - input array
* @param stride - stride length
* @param strideX - stride length
* @returns sum
*
* @example
Expand All @@ -2213,7 +2213,7 @@ interface Namespace {
*
* @param N - number of indexed elements
* @param x - input array
* @param stride - stride length
* @param strideX - stride length
* @returns sum
*
* @example
Expand All @@ -2235,7 +2235,7 @@ interface Namespace {
*
* @param N - number of indexed elements
* @param x - input array
* @param stride - stride length
* @param strideX - stride length
* @returns sum
*
* @example
Expand Down
41 changes: 12 additions & 29 deletions ext/base/gcusumors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,17 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **sum**: initial sum.
- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
- **strideX**: index increment for `x`.
- **strideX**: stride length for `x`.
- **y**: output [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
- **strideY**: index increment for `y`.
- **strideY**: stride length for `y`.

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`,
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:

```javascript
var floor = require( '@stdlib/math/base/special/floor' );

var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];

var N = floor( x.length / 2 );

var v = gcusumors( N, 0.0, x, 2, y, 1 );
var v = gcusumors( 4, 0.0, x, 2, y, 1 );
// y => [ 1.0, 3.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]
```

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

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var floor = require( '@stdlib/math/base/special/floor' );

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

var N = floor( x0.length / 2 );

gcusumors( N, 0.0, x1, -2, y1, 1 );
gcusumors( 4, 0.0, x1, -2, y1, 1 );
// y0 => <Float64Array>[ 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0, 0.0 ]
```

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

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
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:

```javascript
var floor = require( '@stdlib/math/base/special/floor' );

var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
var y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];

var N = floor( x.length / 2 );

gcusumors.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 );
gcusumors.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 );
// y => [ 0.0, 0.0, 0.0, 0.0, 5.0, 1.0, -1.0, 1.0 ]
```

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

```javascript
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var gcusumors = require( '@stdlib/blas/ext/base/gcusumors' );

var y;
var x;
var i;

x = new Float64Array( 10 );
y = new Float64Array( x.length );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = round( randu()*100.0 );
}
var x = discreteUniform( 10, -100, 100, {
'dtype': 'float64'
});
var y = new Float64Array( x.length );
console.log( x );
console.log( y );

Expand Down
22 changes: 11 additions & 11 deletions ext/base/gcusumors/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var gfill = require( './../../../../ext/base/gfill' );
var Float64Array = require( '@stdlib/array/float64' );
var pkg = require( './../package.json' ).name;
var gcusumors = require( './../lib/main.js' );


// VARIABLES //

var options = {
'dtype': 'float64'
};


// FUNCTIONS //

/**
Expand All @@ -39,16 +47,8 @@ var gcusumors = require( './../lib/main.js' );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var y;
var x;
var i;

x = [];
y = [];
for ( i = 0; i < len; i++ ) {
x.push( ( randu()*20.0 ) - 10.0 );
y.push( 0.0 );
}
var x = uniform( len, -100, 100, options );
var y = new Float64Array( len );
return benchmark;

function benchmark( b ) {
Expand Down
22 changes: 11 additions & 11 deletions ext/base/gcusumors/benchmark/benchmark.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var gfill = require( './../../../../ext/base/gfill' );
var Float64Array = require( '@stdlib/array/float64' );
var pkg = require( './../package.json' ).name;
var gcusumors = require( './../lib/ndarray.js' );


// VARIABLES //

var options = {
'dtype': 'float64'
};


// FUNCTIONS //

/**
Expand All @@ -39,16 +47,8 @@ var gcusumors = require( './../lib/ndarray.js' );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;
var y;
var i;

x = [];
y = [];
for ( i = 0; i < len; i++ ) {
x.push( ( randu()*20.0 ) - 10.0 );
y.push( 0.0 );
}
var x = uniform( len, -100, 100, options );
var y = new Float64Array( len );
return benchmark;

function benchmark( b ) {
Expand Down
32 changes: 15 additions & 17 deletions ext/base/gcusumors/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Computes the cumulative sum of strided array elements using ordinary
recursive summation.

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

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

strideX: integer
Index increment for `x`.
Stride length for `x`.

y: Array<number>|TypedArray
Output array.

strideY: integer
Index increment for `y`.
Stride length for `y`.

Returns
-------
Expand All @@ -44,31 +44,30 @@
> {{alias}}( x.length, 0.0, x, 1, y, 1 )
[ 1.0, -1.0, 1.0 ]

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

// Using view offsets:
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
> var y0 = new {{alias:@stdlib/array/float64}}( x0.length );
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
> var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 );
> N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
> {{alias}}( N, 0.0, x1, 2, y1, 1 )
> {{alias}}( 3, 0.0, x1, 2, y1, 1 )
<Float64Array>[ -2.0, 0.0, -1.0 ]
> y0
<Float64Array>[ 0.0, 0.0, 0.0, -2.0, 0.0, -1.0 ]


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

While typed array views mandate a view offset based on the underlying
buffer, the `offset` parameter supports indexing semantics based on a
starting index.
buffer, the offset parameters support indexing semantics based on starting
indices.

Parameters
----------
Expand All @@ -82,7 +81,7 @@
Input array.

strideX: integer
Index increment for `x`.
Stride length for `x`.

offsetX: integer
Starting index for `x`.
Expand All @@ -91,7 +90,7 @@
Output array.

strideY: integer
Index increment for `y`.
Stride length for `y`.

offsetY: integer
Starting index for `y`.
Expand All @@ -107,14 +106,13 @@
> var x = [ 1.0, -2.0, 2.0 ];
> var y = [ 0.0, 0.0, 0.0 ];
> {{alias}}.ndarray( x.length, 0.0, x, 1, 0, y, 1, 0 )
<Float64Array>[ 1.0, -1.0, 1.0 ]
[ 1.0, -1.0, 1.0 ]

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

See Also
--------
Expand Down
12 changes: 6 additions & 6 deletions ext/base/gcusumors/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param y - output array
* @param strideY - `y` stride length
* @param strideY - stride length for `y`
* @returns output array
*
* @example
Expand All @@ -52,10 +52,10 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param offsetX - starting index for `x`
* @param y - output array
* @param strideY - `y` stride length
* @param strideY - stride length for `y`
* @param offsetY - starting index for `y`
* @returns output array
*
Expand All @@ -75,9 +75,9 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param y - output array
* @param strideY - `y` stride length
* @param strideY - stride length for `y`
* @returns output array
*
* @example
Expand Down
Loading

0 comments on commit 5fa5280

Please sign in to comment.