Skip to content

Commit d44c982

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 8baa0ac + 2d0ea39 commit d44c982

File tree

98 files changed

+3653
-704
lines changed

Some content is hidden

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

98 files changed

+3653
-704
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2024 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: cleanup_coverage
21+
22+
# Workflow triggers:
23+
on:
24+
25+
# Trigger the workflow when a pull request is closed (e.g., merged or closed without merging):
26+
pull_request_target:
27+
types:
28+
- closed
29+
30+
# Workflow jobs:
31+
jobs:
32+
33+
# Define a job to perform coverage cleanup...
34+
cleanup:
35+
36+
# Define a display name:
37+
name: 'Cleanup coverage'
38+
39+
# Define the type of virtual host machine:
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
# Delete the 'pr-<number>' branch from the 'stdlib-js/www-test-code-coverage' repository:
44+
- name: 'Delete coverage branch for PR'
45+
env:
46+
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
47+
PR_NUMBER: ${{ github.event.pull_request.number }}
48+
run: |
49+
curl -X DELETE -H "Authorization: token $REPO_GITHUB_TOKEN" \
50+
"https://api.github.com/repos/stdlib-js/www-test-code-coverage/git/refs/heads/pr-${PR_NUMBER}" \
51+
|| echo "Branch pr-${PR_NUMBER} does not exist or could not be deleted."
52+
53+
# Find and update the '## Coverage Report' comment in the PR
54+
- name: 'Update coverage comment in PR'
55+
# Pin action to full length commit SHA
56+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
57+
with:
58+
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
59+
script: |
60+
const prNumber = context.payload.pull_request.number;
61+
const { data: comments } = await github.rest.issues.listComments({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
issue_number: prNumber,
65+
});
66+
const coverageComment = comments.find( comment => comment.body && comment.body.includes( '## Coverage Report' ) );
67+
if ( coverageComment ) {
68+
// Replace URLs with plain text in the coverage report comment body:
69+
const updatedBody = coverageComment.body.replace( /<a href="[^"]+">([^<]+)<\/a>/g, '$1' );
70+
await github.rest.issues.updateComment({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
comment_id: coverageComment.id,
74+
body: updatedBody,
75+
});
76+
} else {
77+
console.log( 'No Coverage Report comment found.' );
78+
}

.github/workflows/pr_merge_develop.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,18 @@ jobs:
108108
BRANCH_NAME: ${{ steps.pr-details.outputs.branch }}
109109
REPO_NAME: ${{ steps.pr-details.outputs.repository }}
110110
run: |
111+
# Configure Git user:
111112
git config --local user.email "[email protected]"
112113
git config --local user.name "stdlib-bot"
113-
git fetch origin develop:develop
114-
git merge develop --no-edit
114+
115+
# Add upstream remote pointing to the original repository:
116+
git remote add upstream https://github.com/stdlib-js/stdlib.git
117+
118+
# Fetch the develop branch from upstream:
119+
git fetch upstream develop
120+
121+
# Merge upstream develop into the current branch:
122+
git merge upstream/develop --no-edit
123+
124+
# Push the updated branch back to the forked repository:
115125
git push "https://$USER_NAME:[email protected]/$REPO_NAME.git" $BRANCH_NAME

.github/workflows/pr_rebase_develop.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,18 @@ jobs:
108108
BRANCH_NAME: ${{ steps.pr-details.outputs.branch }}
109109
REPO_NAME: ${{ steps.pr-details.outputs.repository }}
110110
run: |
111+
# Configure Git user:
111112
git config --local user.email "[email protected]"
112113
git config --local user.name "stdlib-bot"
113-
git fetch origin develop:develop
114-
git rebase develop
114+
115+
# Add upstream remote pointing to the original repository:
116+
git remote add upstream https://github.com/stdlib-js/stdlib.git
117+
118+
# Fetch the develop branch from upstream:
119+
git fetch upstream develop
120+
121+
# Rebase current branch onto upstream develop:
122+
git rebase upstream/develop
123+
124+
# Force push the updated branch back to the forked repository:
115125
git push --force-with-lease "https://$USER_NAME:[email protected]/$REPO_NAME.git" $BRANCH_NAME

.github/workflows/run_tests_coverage.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,22 @@ jobs:
131131
if: github.event_name != 'workflow_dispatch'
132132
id: changed-directories
133133
continue-on-error: true
134+
env:
135+
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
134136
run: |
135137
if [ -n "${{ github.event.pull_request.number }}" ]; then
136138
# Get the list of changed files in pull request:
137-
ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
138-
files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
139+
page=1
140+
files=""
141+
while true; do
142+
changed_files=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $STDLIB_BOT_GITHUB_TOKEN" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
143+
if [ -z "$changed_files" ]; then
144+
break
145+
fi
146+
files="$files $changed_files"
147+
page=$((page+1))
148+
done
149+
files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//')
139150
else
140151
# Get changed files by comparing the current commit to the commit before the push event or with its parent:
141152
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
@@ -167,6 +178,15 @@ jobs:
167178
else
168179
directories="${{ steps.changed-directories.outputs.directories }}"
169180
fi
181+
182+
# Append suffix to coverage base URL for PRs:
183+
if [ -n "${{ github.event.pull_request.number }}" ]; then
184+
PR_NUMBER=${{ github.event.pull_request.number }}
185+
export COVERAGE_BASE_URL="https://coverage.stdlib.io/pr-${PR_NUMBER}"
186+
else
187+
export COVERAGE_BASE_URL="https://coverage.stdlib.io"
188+
fi
189+
170190
. "$GITHUB_WORKSPACE/.github/workflows/scripts/run_tests_coverage" "$directories"
171191
timeout-minutes: 30
172192

.github/workflows/scripts/run_tests_coverage

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ set -o pipefail
4242

4343
# VARIABLES #
4444

45+
# Define the base URL for coverage reports, defaulting to 'https://coverage.stdlib.io':
46+
coverage_base_url="${COVERAGE_BASE_URL:-https://coverage.stdlib.io}"
47+
4548
# Get the list of changed files:
4649
changed="$*"
4750

@@ -159,11 +162,11 @@ main() {
159162
for package in ${directories}; do
160163
# For each package, extract coverage values from the respective coverage report:
161164
pkg=`echo $package | sed -E 's/^.*stdlib\///'`
162-
165+
163166
if [ -f "lib/node_modules/@stdlib/${pkg}/binding.gyp" ]; then
164167
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
165168
fi
166-
169+
167170
make test-javascript-cov TESTS_FILTER=".*/${pkg}/test/.*"
168171

169172
if [ ! -f reports/coverage/lcov-report/${pkg}/lib/index.html ]; then
@@ -187,7 +190,7 @@ main() {
187190
pkg_functions_cov_fraction=${pkg_cov_fractions[2]}
188191
pkg_lines_cov_fraction=${pkg_cov_fractions[3]}
189192

190-
old_cov_report=$(curl -s --fail "https://coverage.stdlib.io/${pkg}/lib/index.html" 2>/dev/null || true)
193+
old_cov_report=$(curl -s --fail "${coverage_base_url}/${pkg}/lib/index.html" 2>/dev/null || true)
191194
if [ -z "$old_cov_report" ]; then
192195
old_statements_cov=0
193196
old_branches_cov=0
@@ -208,7 +211,7 @@ main() {
208211

209212
pkg_cov="| $pkg_statements_cov_fraction <br> $cov_change_statements | $pkg_branches_cov_fraction <br> $cov_change_branches | $pkg_functions_cov_fraction <br> $cov_change_functions | $pkg_lines_cov_fraction <br> $cov_change_lines |"
210213

211-
pkg_url="https://coverage.stdlib.io/${pkg}/index.html"
214+
pkg_url="${coverage_base_url}/${pkg}/index.html"
212215
pkg_link="<a href="$pkg_url">$pkg</a>"
213216
coverage="$coverage\n| $pkg_link $pkg_cov"
214217

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

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Copies values from `X` into `Y`.
245245
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; // interleaved real and imaginary components
246246
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
247247

248-
c_ccopy( 2, (void *)x, 1, (void *)Y, 1 );
248+
c_ccopy( 2, (void *)x, 1, (void *)y, 1 );
249249
```
250250
251251
The function accepts the following arguments:
@@ -260,6 +260,31 @@ The function accepts the following arguments:
260260
void c_ccopy( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
261261
```
262262

263+
#### c_ccopy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY )
264+
265+
Copies values from `X` into `Y` using alternative indexing semantics.
266+
267+
```c
268+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; // interleaved real and imaginary components
269+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
270+
271+
c_ccopy_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0 );
272+
```
273+
274+
The function accepts the following arguments:
275+
276+
- **N**: `[in] CBLAS_INT` number of indexed elements.
277+
- **X**: `[in] void*` input array.
278+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
279+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
280+
- **Y**: `[out] void*` output array.
281+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
282+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
283+
284+
```c
285+
void c_ccopy_ndarray( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
286+
```
287+
263288
</section>
264289

265290
<!-- /.usage -->
@@ -301,6 +326,14 @@ int main( void ) {
301326
for ( int i = 0; i < N; i++ ) {
302327
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
303328
}
329+
330+
// Copy elements using alternative indexing semantics:
331+
c_ccopy_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 );
332+
333+
// Print the result:
334+
for ( int i = 0; i < N; i++ ) {
335+
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
336+
}
304337
}
305338
```
306339

lib/node_modules/@stdlib/blas/base/ccopy/benchmark/c/benchmark.length.c

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static float rand_float( void ) {
9494
* @param len array length
9595
* @return elapsed time in seconds
9696
*/
97-
static double benchmark( int iterations, int len ) {
97+
static double benchmark1( int iterations, int len ) {
9898
double elapsed;
9999
float x[ len*2 ];
100100
float y[ len*2 ];
@@ -122,6 +122,41 @@ static double benchmark( int iterations, int len ) {
122122
return elapsed;
123123
}
124124

125+
/**
126+
* Runs a benchmark.
127+
*
128+
* @param iterations number of iterations
129+
* @param len array length
130+
* @return elapsed time in seconds
131+
*/
132+
static double benchmark2( int iterations, int len ) {
133+
double elapsed;
134+
float x[ len*2 ];
135+
float y[ len*2 ];
136+
double t;
137+
int i;
138+
139+
for ( i = 0; i < len; i++ ) {
140+
x[ i ] = ( rand_float()*10000.0f ) - 5000.0f;
141+
x[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f;
142+
y[ i ] = 0.0f;
143+
y[ i+1 ] = 0.0f;
144+
}
145+
t = tic();
146+
for ( i = 0; i < iterations; i++ ) {
147+
c_ccopy_ndarray( len, (void *)x, 1, 0, (void *)y, 1, 0 );
148+
if ( y[ 0 ] != y[ 0 ] ) {
149+
printf( "should not return NaN\n" );
150+
break;
151+
}
152+
}
153+
elapsed = tic() - t;
154+
if ( y[ 0 ] != y[ 0 ] ) {
155+
printf( "should not return NaN\n" );
156+
}
157+
return elapsed;
158+
}
159+
125160
/**
126161
* Main execution sequence.
127162
*/
@@ -144,7 +179,14 @@ int main( void ) {
144179
for ( j = 0; j < REPEATS; j++ ) {
145180
count += 1;
146181
printf( "# c::%s:len=%d\n", NAME, len );
147-
elapsed = benchmark( iter, len );
182+
elapsed = benchmark1( iter, len );
183+
print_results( iter, elapsed );
184+
printf( "ok %d benchmark finished\n", count );
185+
}
186+
for ( j = 0; j < REPEATS; j++ ) {
187+
count += 1;
188+
printf( "# c::%s:ndarray:len=%d\n", NAME, len );
189+
elapsed = benchmark2( iter, len );
148190
print_results( iter, elapsed );
149191
printf( "ok %d benchmark finished\n", count );
150192
}

lib/node_modules/@stdlib/blas/base/ccopy/examples/c/example.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@ int main( void ) {
3838
for ( int i = 0; i < N; i++ ) {
3939
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
4040
}
41+
42+
// Copy elements using alternative indexing semantics:
43+
c_ccopy_ndarray( N, (void *)x, -strideX, N-1, (void *)y, strideY, N-1 );
44+
45+
// Print the result:
46+
for ( int i = 0; i < N; i++ ) {
47+
printf( "y[ %i ] = %f + %fj\n", i, y[ i*2 ], y[ (i*2)+1 ] );
48+
}
4149
}

lib/node_modules/@stdlib/blas/base/ccopy/include/stdlib/blas/base/ccopy.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ extern "C" {
3636
*/
3737
void API_SUFFIX(c_ccopy)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY );
3838

39+
/**
40+
* Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector using alternative indexing semantics.
41+
*/
42+
void API_SUFFIX(c_ccopy_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
43+
3944
#ifdef __cplusplus
4045
}
4146
#endif

0 commit comments

Comments
 (0)