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 23, 2024
1 parent cc8cf1d commit 3c5a85f
Show file tree
Hide file tree
Showing 31 changed files with 520 additions and 195 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: '39 15 * * 0'

# 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,7 +4,17 @@
<section class="release" id="unreleased">

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

<section class="features">

### Features

- [`6ae3c11`](https://github.com/stdlib-js/stdlib/commit/6ae3c11e5494f6e5750638535b46454e3e325b6e) - add C `ndarray` API and refactor `blas/ext/base/dsapxsum` [(#3225)](https://github.com/stdlib-js/stdlib/pull/3225)

</section>

<!-- /.features -->

<section class="bug-fixes">

Expand All @@ -22,6 +32,7 @@

<details>

- [`6ae3c11`](https://github.com/stdlib-js/stdlib/commit/6ae3c11e5494f6e5750638535b46454e3e325b6e) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dsapxsum` [(#3225)](https://github.com/stdlib-js/stdlib/pull/3225) _(by Muhammad Haris)_
- [`e4de24f`](https://github.com/stdlib-js/stdlib/commit/e4de24f1e086063876214e73f1f6b659dc624eb1) - **fix:** resolve bugs in addon.c files _(by Philipp Burckhardt)_
- [`7e366ae`](https://github.com/stdlib-js/stdlib/commit/7e366ae8bd41439be0e99e958d1c3fbb1b7dd0c2) - **chore:** update package.json descriptions _(by Philipp Burckhardt)_
- [`ed44fee`](https://github.com/stdlib-js/stdlib/commit/ed44feecb9eaa5e0849d1a533e5415624d0aa338) - **style:** use imperative in package.json description and end with period _(by Philipp Burckhardt)_
Expand All @@ -38,9 +49,10 @@

### Contributors

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

- Athan Reines
- Muhammad Haris
- Philipp Burckhardt

</section>
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com>
Momtchil Momtchev <momtchil@momtchev.com>
Muhammad Haris <harriskhan047@outlook.com>
Naresh Jagadeesan <naresh.naresh000@gmail.com>
Neeraj Pathak <neerajrpathak710@gmail.com>
NightKnight <Ahmedatwa866@yahoo.com>
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
Expand All @@ -69,6 +70,7 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
Pranav Goswami <goswami.4@iitj.ac.in>
Praneki <97080887+PraneGIT@users.noreply.github.com>
Pratik <97464067+Pratik772846@users.noreply.github.com>
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
RISHAV <115060907+rishav2404@users.noreply.github.com>
Expand All @@ -79,9 +81,11 @@ Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
Robert Gislason <gztown2216@yahoo.com>
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
Rutam <138517416+performant23@users.noreply.github.com>
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
Ryan Seal <splrk@users.noreply.github.com>
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
Shivam <11shivam00@gmail.com>
Expand Down
149 changes: 135 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ limitations under the License.

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->

> Add a constant to each single-precision floating-point strided array element and compute the sum using extended accumulation and returning an extended precision result.
> Add a scalar constant to each single-precision floating-point strided array element, and compute the sum using extended accumulation and returning an extended precision result.
<section class="intro">

Expand Down Expand Up @@ -69,26 +69,27 @@ To view installation and usage instructions specific to each branch build, be su
var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );
```

#### dsapxsum( N, alpha, x, stride )
#### dsapxsum( N, alpha, x, strideX )

Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and returning an extended precision result.
Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.

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

var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );

var v = dsapxsum( 3, 5.0, x, 1 );
var v = dsapxsum( x.length, 5.0, x, 1 );
// returns 16.0
```

The function has the following parameters:

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

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

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

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

Adds a constant to each single-precision floating-point strided array element and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.
Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using 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, 2.0 ] );

var v = dsapxsum.ndarray( 3, 5.0, x, 1, 0 );
var v = dsapxsum.ndarray( x.length, 5.0, x, 1, 0 );
// returns 16.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 access every other value in the strided array 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 access every other element starting from the second element:

```javascript
var Float32Array = require( '@stdlib/array-float32' );
Expand Down Expand Up @@ -163,11 +164,12 @@ var v = dsapxsum.ndarray( 4, 5.0, x, 2, 1 );
<!-- eslint no-undef: "error" -->

```javascript
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
var filledarrayBy = require( '@stdlib/array-filled-by' );
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
var dsapxsum = require( '@stdlib/blas-ext-base-dsapxsum' );

var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
var x = discreteUniform( 10.0, -100, 100, {
'dtype': 'float32'
});
console.log( x );

var v = dsapxsum( x.length, 5.0, x, 1 );
Expand All @@ -178,6 +180,125 @@ 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/dsapxsum.h"
```

#### stdlib_strided_dsapxsum( N, alpha, \*X, strideX )

Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and returning an extended precision result.

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

double v = stdlib_strided_dsapxsum( 3, 5.0f, x, 1 );
// returns 16.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **alpha**: `[in] float` scalar constant.
- **X**: `[in] float*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
```c
double stdlib_strided_dsapxsum( const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX );
```

#### stdlib_strided_dsapxsum_ndarray( N, alpha, \*X, strideX, offsetX )

Adds a scalar constant to each single-precision floating-point strided array element, and computes the sum using extended accumulation and alternative indexing semantics and returning an extended precision result.

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

double v = stdlib_strided_dsapxsum_ndarray( 3, 5.0f, x, 1, 0 );
// returns 16.0
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **alpha**: `[in] float` scalar constant.
- **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_dsapxsum_ndarray( const CBLAS_INT N, const float alpha, 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/dsapxsum.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 };

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

// Specify a stride:
const int strideX = 1;

// Compute the sum:
double v = stdlib_strided_dsapxsum( N, 5.0f, x, strideX );

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

0 comments on commit 3c5a85f

Please sign in to comment.