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 Nov 26, 2024
1 parent 354fbb5 commit e52487e
Show file tree
Hide file tree
Showing 28 changed files with 593 additions and 245 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

105 changes: 105 additions & 0 deletions .github/workflows/test_published_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2024 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

# Workflow name:
name: test_published_package

# Workflow triggers:
on:
# Run workflow on a weekly schedule:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '50 14 * * 2'

# Run workflow upon completion of `publish` workflow run:
workflow_run:
workflows: ["publish"]
types: [completed]

# Allow workflow to be manually run:
workflow_dispatch:

# Workflow jobs:
jobs:
test-published:
# Define a display name:
name: 'Test running examples of published package'

# Define the type of virtual host machine:
runs-on: ubuntu-latest

# Define environment variables:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}

# Define the job's steps:
steps:
# Checkout the repository:
- name: 'Checkout repository'
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Install Node.js:
- name: 'Install Node.js'
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 20
timeout-minutes: 5

# Create test directory and run examples:
- name: 'Create test directory and run examples'
run: |
cd ..
mkdir test-published
cd test-published
# Copy example file:
cp $GITHUB_WORKSPACE/examples/index.js .
# Create a minimal package.json
echo '{
"name": "test-published",
"version": "1.0.0",
"main": "index.js",
"dependencies": {}
}' > package.json
# Get package name and modify example file:
PACKAGE_NAME=$(jq -r '.name' $GITHUB_WORKSPACE/package.json)
ESCAPED_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | sed 's/[\/&]/\\&/g')
sed -i "s/require( '.\/..\/lib' )/require( '$ESCAPED_PACKAGE_NAME' )/g" index.js
# Extract and install dependencies:
DEPS=$(grep -oP "require\(\s*'([^']+)'\s*\)" index.js | sed "s/require(\s*'//" | sed "s/'\s*)//" | grep -v "^\.")
for dep in $DEPS; do
npm install $dep --save
done
# Run the example:
node index.js
# Send Slack notification if job fails:
- name: 'Send notification to Slack in case of failure'
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
with:
status: ${{ job.status }}
channel: '#npm-ci'
if: failure()
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@
<section class="release" id="unreleased">

## Unreleased (2024-11-01)
## Unreleased (2024-11-26)

<section class="features">

### Features

- [`de75f04`](https://github.com/stdlib-js/stdlib/commit/de75f0465fdaa762112195f16f6334b121204664) - add C `ndarray` API and refactor `blas/ext/base/dsnansumpw` [(#3262)](https://github.com/stdlib-js/stdlib/pull/3262)

</section>

<!-- /.features -->

<section class="commits">

### Commits

<details>

- [`de75f04`](https://github.com/stdlib-js/stdlib/commit/de75f0465fdaa762112195f16f6334b121204664) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dsnansumpw` [(#3262)](https://github.com/stdlib-js/stdlib/pull/3262) _(by Muhammad Haris, Philipp Burckhardt)_
- [`e9f4e07`](https://github.com/stdlib-js/stdlib/commit/e9f4e0759a14b8da93d4e0837b886d8ed56bc696) - **refactor:** update `blas/ext/base/dsnansumpw` to follow current conventions _(by yaswanth, Philipp Burckhardt)_
- [`272ae7a`](https://github.com/stdlib-js/stdlib/commit/272ae7ac5c576c68cfab1b6e304c86407faa20cd) - **docs:** remove comment _(by Athan Reines)_
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
Expand All @@ -26,9 +37,10 @@

### Contributors

A total of 3 people contributed to this release. Thank you to the following contributors:
A total of 4 people contributed to this release. Thank you to the following contributors:

- Athan Reines
- Muhammad Haris
- Philipp Burckhardt
- yaswanth

Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Contributors listed in alphabetical order.

Aayush Khanna <[email protected]>
Abhijit <[email protected]>
AbhijitRaut04 <[email protected]>
Adarsh Palaskar <[email protected]>
Aditya Sapra <[email protected]>
Expand Down Expand Up @@ -59,6 +60,7 @@ Mohammad Kaif <[email protected]>
Momtchil Momtchev <[email protected]>
Muhammad Haris <[email protected]>
Naresh Jagadeesan <[email protected]>
Neeraj Pathak <[email protected]>
NightKnight <[email protected]>
Nithin Katta <[email protected]>
Nourhan Hasan <[email protected]>
Expand All @@ -69,6 +71,7 @@ Prajwal Kulkarni <[email protected]>
Pranav Goswami <[email protected]>
Praneki <[email protected]>
Pratik <[email protected]>
Pratyush Kumar Chouhan <[email protected]>
Priyansh <[email protected]>
Pushpendra Chandravanshi <[email protected]>
RISHAV <[email protected]>
Expand All @@ -79,9 +82,12 @@ Ridam Garg <[email protected]>
Robert Gislason <[email protected]>
Roman Stetsyk <[email protected]>
Rutam <[email protected]>
Ruthwik Chikoti <[email protected]>
Ryan Seal <[email protected]>
Rylan Yang <[email protected]>
Sai Srikar Dumpeti <[email protected]>
SarthakPaandey <[email protected]>
Saurabh Singh <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shashank Shekhar Singh <[email protected]>
Shivam <[email protected]>
Expand All @@ -102,6 +108,7 @@ Utkarsh Raj <[email protected]>
UtkershBasnet <[email protected]>
Vaibhav Patel <[email protected]>
Varad Gupta <[email protected]>
Vinit Pandit <[email protected]>
Xiaochuan Ye <[email protected]>
Yernar Yergaziyev <[email protected]>
naveen <[email protected]>
Expand Down
135 changes: 124 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,26 @@ To view installation and usage instructions specific to each branch build, be su
var dsnansumpw = require( '@stdlib/blas-ext-base-dsnansumpw' );
```

#### dsnansumpw( N, x, stride )
#### dsnansumpw( N, x, strideX )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using pairwise summation with extended accumulation, and returning an extended precision result.

```javascript
var Float32Array = require( '@stdlib/array-float32' );

var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
var N = x.length;

var v = dsnansumpw( N, x, 1 );
var v = dsnansumpw( x.length, x, 1 );
// returns 1.0
```

The function has the following parameters:

- **N**: number of indexed elements.
- **x**: input [`Float32Array`][@stdlib/array/float32].
- **stride**: index increment for `x`.
- **stride**: stride length for `x`.

The `N` and `stride` parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in `x`,
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element:

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand All @@ -114,25 +113,24 @@ var v = dsnansumpw( 4, x1, 2 );
// returns 5.0
```

#### dsnansumpw.ndarray( N, x, stride, offset )
#### dsnansumpw.ndarray( N, x, strideX, offsetX )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation with extended accumulation and alternative indexing semantics.
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using pairwise summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.

```javascript
var Float32Array = require( '@stdlib/array-float32' );

var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
var N = x.length;

var v = dsnansumpw.ndarray( N, x, 1, 0 );
var v = dsnansumpw.ndarray( x.length, x, 1, 0 );
// returns 1.0
```

The function has the following additional parameters:

- **offset**: starting index for `x`.
- **offsetX**: starting index for `x`.

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 calculate the sum of every other value in `x` starting from the second value
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 calculate the sum of every other element starting from the second element:

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand Down Expand Up @@ -188,8 +186,123 @@ console.log( v );

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/blas/ext/base/dsnansumpw.h"
```

#### stdlib_strided_dsnansumpw( N, \*X, strideX )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using pairwise summation with extended accumulation, and returning an extended precision result.

```c
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };

double v = stdlib_strided_dsnansumpw( 4, x, 1 );
// returns 1.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] float*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
```c
double stdlib_strided_dsnansumpw( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
```

#### stdlib_strided_dsnansumpw_ndarray( N, \*X, strideX, offsetX )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using pairwise summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.

```c
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };

double v = stdlib_strided_dsnansumpw_ndarray( 4, x, 1, 0 );
// returns 1.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] float*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
```c
double stdlib_strided_dsnansumpw_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
#include "stdlib/blas/ext/base/dsnansumpw.h"
#include <stdio.h>

int main( void ) {
// Create a strided array:
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0f/0.0f, 0.0f/0.0f };

// Specify the number of elements:
const int N = 5;

// Specify the stride length:
const int strideX = 2;

// Compute the sum:
double v = stdlib_strided_dsnansumpw( N, x, strideX );

// Print the result:
printf( "sum: %lf\n", v );
}
```
</section>
<!-- /.examples -->
</section>
<!-- /.c -->
<section class="references">
## References
Expand Down
Loading

0 comments on commit e52487e

Please sign in to comment.