Skip to content

Commit ad713e4

Browse files
committed
Auto-generated commit
1 parent 7c30ecd commit ad713e4

File tree

7 files changed

+151
-88
lines changed

7 files changed

+151
-88
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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: test_published_package
21+
22+
# Workflow triggers:
23+
on:
24+
# Run workflow on a weekly schedule:
25+
schedule:
26+
# * is a special character in YAML so you have to quote this string
27+
- cron: '29 17 * * 1'
28+
29+
# Run workflow upon completion of `publish` workflow run:
30+
workflow_run:
31+
workflows: ["publish"]
32+
types: [completed]
33+
34+
# Allow workflow to be manually run:
35+
workflow_dispatch:
36+
37+
# Workflow jobs:
38+
jobs:
39+
test-published:
40+
# Define a display name:
41+
name: 'Test running examples of published package'
42+
43+
# Define the type of virtual host machine:
44+
runs-on: ubuntu-latest
45+
46+
# Define environment variables:
47+
env:
48+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
49+
50+
# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
51+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
52+
53+
# Define the job's steps:
54+
steps:
55+
# Checkout the repository:
56+
- name: 'Checkout repository'
57+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
58+
59+
# Install Node.js:
60+
- name: 'Install Node.js'
61+
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
62+
with:
63+
node-version: 20
64+
timeout-minutes: 5
65+
66+
# Create test directory and run examples:
67+
- name: 'Create test directory and run examples'
68+
run: |
69+
cd ..
70+
mkdir test-published
71+
cd test-published
72+
73+
# Copy example file:
74+
cp $GITHUB_WORKSPACE/examples/index.js .
75+
76+
# Create a minimal package.json
77+
echo '{
78+
"name": "test-published",
79+
"version": "1.0.0",
80+
"main": "index.js",
81+
"dependencies": {}
82+
}' > package.json
83+
84+
# Get package name and modify example file:
85+
PACKAGE_NAME=$(jq -r '.name' $GITHUB_WORKSPACE/package.json)
86+
ESCAPED_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | sed 's/[\/&]/\\&/g')
87+
88+
sed -i "s/require( '.\/..\/lib' )/require( '$ESCAPED_PACKAGE_NAME' )/g" index.js
89+
90+
# Extract and install dependencies:
91+
DEPS=$(grep -oP "require\(\s*'([^']+)'\s*\)" index.js | sed "s/require(\s*'//" | sed "s/'\s*)//" | grep -v "^\.")
92+
for dep in $DEPS; do
93+
npm install $dep --save
94+
done
95+
96+
# Run the example:
97+
node index.js
98+
99+
# Send Slack notification if job fails:
100+
- name: 'Send notification to Slack in case of failure'
101+
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
102+
with:
103+
status: ${{ job.status }}
104+
channel: '#npm-ci'
105+
if: failure()

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-09-28)
7+
## Unreleased (2024-12-14)
88

99
<section class="features">
1010

@@ -16,12 +16,23 @@
1616

1717
<!-- /.features -->
1818

19+
<section class="bug-fixes">
20+
21+
### Bug Fixes
22+
23+
- [`b4502fb`](https://github.com/stdlib-js/stdlib/commit/b4502fbc4da03910f86c66e68b53e93e99e3e933) - remove perf logic in order to ensure expected indices in callback
24+
25+
</section>
26+
27+
<!-- /.bug-fixes -->
28+
1929
<section class="commits">
2030

2131
### Commits
2232

2333
<details>
2434

35+
- [`b4502fb`](https://github.com/stdlib-js/stdlib/commit/b4502fbc4da03910f86c66e68b53e93e99e3e933) - **fix:** remove perf logic in order to ensure expected indices in callback _(by Athan Reines)_
2536
- [`abf0407`](https://github.com/stdlib-js/stdlib/commit/abf040787f6598438b0100a729a8331b7f80f62f) - **chore:** resolve lint errors in TS files _(by Philipp Burckhardt)_
2637
- [`5debe82`](https://github.com/stdlib-js/stdlib/commit/5debe8216a1449be68fad01af52d896e63163191) - **test:** add tests to `ndarray/base/map` [(#2810)](https://github.com/stdlib-js/stdlib/pull/2810) _(by Muhammad Haris, Athan Reines)_
2738
- [`6a3b3d7`](https://github.com/stdlib-js/stdlib/commit/6a3b3d731ca697a62e3d58900e1b6cb06e7667dd) - **chore:** update directories meta data _(by Athan Reines)_

CONTRIBUTORS

+26-11
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
#
33
# Contributors listed in alphabetical order.
44

5-
Aayush Khanna <[email protected]>
5+
Aayush Khanna <[email protected]>
6+
Abhijit Raut <[email protected]>
67
Adarsh Palaskar <[email protected]>
78
Aditya Sapra <[email protected]>
8-
AgPriyanshu18 <[email protected]>
9+
Ahmed Atwa <[email protected]>
10+
Ahmed Kashkoush <[email protected]>
911
Aleksandr <[email protected]>
1012
Ali Salesi <[email protected]>
1113
Aman Bhansali <[email protected]>
@@ -22,12 +24,14 @@ Dan Rose <[email protected]>
2224
Daniel Killenberger <[email protected]>
2325
Daniel Yu <[email protected]>
2426
Debashis Maharana <[email protected]>
27+
Dominic Lim <[email protected]>
2528
Dominik Moritz <[email protected]>
2629
Dorrin Sotoudeh <[email protected]>
2730
EuniceSim142 <[email protected]>
2831
Frank Kovacs <[email protected]>
2932
Golden Kumar <[email protected]>
3033
Gunj Joshi <[email protected]>
34+
Gururaj Gurram <[email protected]>
3135
3236
Harshita Kalani <[email protected]>
3337
Hridyanshu <[email protected]>
@@ -41,42 +45,52 @@ Joey Reed <[email protected]>
4145
Jordan Gallivan <[email protected]>
4246
Joris Labie <[email protected]>
4347
Justin Dennison <[email protected]>
44-
Kaif Mohd <[email protected]>
4548
Karthik Prakash <[email protected]>
4649
50+
Kohantika Nath <[email protected]>
4751
Krishnendu Das <[email protected]>
52+
Kshitij-Dale <[email protected]>
4853
4954
Manik Sharma <[email protected]>
55+
Manvith M <[email protected]>
5056
Marcus Fantham <[email protected]>
5157
Matt Cochrane <[email protected]>
5258
Mihir Pandit <[email protected]>
5359
Milan Raj <[email protected]>
54-
Mohammad Kaif <[email protected].com>
60+
Mohammad Kaif <mdkaifprofession@gmail.com>
5561
Momtchil Momtchev <[email protected]>
5662
Muhammad Haris <[email protected]>
5763
Naresh Jagadeesan <[email protected]>
58-
NightKnight <[email protected]>
64+
Neeraj Pathak <[email protected]>
65+
Nishant Shinde <[email protected]>
5966
Nithin Katta <[email protected]>
6067
Nourhan Hasan <[email protected]>
6168
Ognjen Jevremović <[email protected]>
6269
Oneday12323 <[email protected]>
70+
Ori Miles <[email protected]>
6371
Philipp Burckhardt <[email protected]>
6472
Prajwal Kulkarni <[email protected]>
6573
Pranav Goswami <[email protected]>
6674
6775
76+
Pratyush Kumar Chouhan <[email protected]>
6877
78+
Priyanshu Agarwal <[email protected]>
6979
Pushpendra Chandravanshi <[email protected]>
7080
Raunak Kumar Gupta <[email protected]>
7181
Rejoan Sardar <[email protected]>
7282
Ricky Reusser <[email protected]>
7383
Ridam Garg <[email protected]>
84+
7485
Robert Gislason <[email protected]>
7586
Roman Stetsyk <[email protected]>
76-
87+
Rutam Kathale <[email protected]>
88+
Ruthwik Chikoti <[email protected]>
7789
Ryan Seal <[email protected]>
90+
Rylan Yang <[email protected]>
7891
Sai Srikar Dumpeti <[email protected]>
79-
SarthakPaandey <[email protected]>
92+
Sarthak Paandey <[email protected]>
93+
Saurabh Singh <[email protected]>
8094
Seyyed Parsa Neshaei <[email protected]>
8195
Shashank Shekhar Singh <[email protected]>
8296
@@ -88,20 +102,21 @@ Snehil Shah <[email protected]>
88102
Soumajit Chatterjee <[email protected]>
89103
Spandan Barve <[email protected]>
90104
Stephannie Jiménez Gacha <[email protected]>
91-
Suraj kumar <[email protected]>
105+
Suraj Kumar <[email protected]>
92106
Tirtadwipa Manunggal <[email protected]>
93107
Tudor Pagu <[email protected]>
94108
Tufailahmed Bargir <[email protected]>
95109
Utkarsh <http://[email protected]>
96110
Utkarsh Raj <[email protected]>
111+
UtkershBasnet <[email protected]>
97112
Vaibhav Patel <[email protected]>
98113
Varad Gupta <[email protected]>
114+
Vinit Pandit <[email protected]>
115+
Vivek maurya <[email protected]>
99116
Xiaochuan Ye <[email protected]>
117+
Yaswanth Kosuru <[email protected]>
100118
Yernar Yergaziyev <[email protected]>
101119
102-
nishant-s7 <[email protected]>
103120
olenkabilonizhka <[email protected]>
104-
orimiles5 <[email protected]>
105121
106122
107-

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main.js

+3-70
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var iterationOrder = require( '@stdlib/ndarray-base-iteration-order' );
24-
var minmaxViewBufferIndex = require( '@stdlib/ndarray-base-minmax-view-buffer-index' );
2524
var ndarray2object = require( '@stdlib/ndarray-base-ndarraylike2object' );
2625
var blockedaccessormap2d = require( './2d_blocked_accessors.js' );
2726
var blockedaccessormap3d = require( './3d_blocked_accessors.js' );
@@ -191,18 +190,11 @@ var MAX_DIMS = MAP.length -1;
191190
*/
192191
function map( arrays, fcn, thisArg ) {
193192
var ndims;
194-
var xmmv;
195-
var ymmv;
196193
var shx;
197194
var shy;
198195
var iox;
199196
var ioy;
200197
var len;
201-
var sx;
202-
var sy;
203-
var ox;
204-
var oy;
205-
var ns;
206198
var x;
207199
var y;
208200
var i;
@@ -228,19 +220,13 @@ function map( arrays, fcn, thisArg ) {
228220
}
229221
// Verify that the input and output arrays have the same dimensions...
230222
len = 1; // number of elements
231-
ns = 0; // number of singleton dimensions
232223
for ( i = 0; i < ndims; i++ ) {
233224
d = shx[ i ];
234225
if ( d !== shy[ i ] ) {
235226
throw new Error( 'invalid arguments. Array must have the same shape.' );
236227
}
237228
// Note that, if one of the dimensions is `0`, the length will be `0`...
238229
len *= d;
239-
240-
// Check whether the current dimension is a singleton dimension...
241-
if ( d === 1 ) {
242-
ns += 1;
243-
}
244230
}
245231
// Check whether we were provided empty ndarrays...
246232
if ( len === 0 ) {
@@ -253,63 +239,12 @@ function map( arrays, fcn, thisArg ) {
253239
}
254240
return MAP[ ndims ]( x, y, fcn, thisArg );
255241
}
256-
257-
sx = x.strides;
258-
sy = y.strides;
259-
260-
// Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays...
261-
if ( ns === ndims-1 ) {
262-
// Get the index of the non-singleton dimension...
263-
for ( i = 0; i < ndims; i++ ) {
264-
if ( shx[ i ] !== 1 ) {
265-
break;
266-
}
267-
}
268-
x.shape = [ shx[i] ];
269-
y.shape = x.shape;
270-
x.strides = [ sx[i] ];
271-
y.strides = [ sy[i] ];
272-
if ( x.accessorProtocol || y.accessorProtocol ) {
273-
return ACCESSOR_MAP[ 1 ]( x, y, fcn, thisArg );
274-
}
275-
return MAP[ 1 ]( x, y, fcn, thisArg );
276-
}
277-
278-
iox = iterationOrder( sx ); // +/-1
279-
ioy = iterationOrder( sy ); // +/-1
242+
// Determine iteration order:
243+
iox = iterationOrder( x.strides ); // +/-1
244+
ioy = iterationOrder( y.strides ); // +/-1
280245

281246
// Determine whether we can avoid blocked iteration...
282247
if ( iox !== 0 && ioy !== 0 && iox === ioy ) {
283-
// Determine the minimum and maximum linear indices which are accessible by the array views:
284-
xmmv = minmaxViewBufferIndex( shx, sx, x.offset );
285-
ymmv = minmaxViewBufferIndex( shy, sy, y.offset );
286-
287-
// Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays...
288-
if ( len === ( xmmv[1]-xmmv[0]+1 ) && len === ( ymmv[1]-ymmv[0]+1 ) ) {
289-
// Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values...
290-
if ( iox === 1 ) {
291-
ox = xmmv[ 0 ];
292-
} else {
293-
ox = xmmv[ 1 ];
294-
}
295-
if ( ioy === 1 ) {
296-
oy = ymmv[ 0 ];
297-
} else {
298-
oy = ymmv[ 1 ];
299-
}
300-
x.shape = [ len ];
301-
y.shape = x.shape;
302-
x.strides = [ iox ];
303-
y.strides = [ ioy ];
304-
x.offset = ox;
305-
y.offset = oy;
306-
if ( x.accessorProtocol || y.accessorProtocol ) {
307-
return ACCESSOR_MAP[ 1 ]( x, y, fcn, thisArg );
308-
}
309-
return MAP[ 1 ]( x, y, fcn, thisArg );
310-
}
311-
// At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...
312-
313248
// Determine whether we can use simple nested loops...
314249
if ( ndims <= MAX_DIMS ) {
315250
// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...
@@ -320,8 +255,6 @@ function map( arrays, fcn, thisArg ) {
320255
}
321256
// Fall-through to blocked iteration...
322257
}
323-
// At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration...
324-
325258
// Determine whether we can perform blocked iteration...
326259
if ( ndims <= MAX_DIMS ) {
327260
if ( x.accessorProtocol || y.accessorProtocol ) {

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@
4242
"@stdlib/array-base-zero-to": "^0.2.1",
4343
"@stdlib/ndarray-base-ind2sub": "^0.2.2",
4444
"@stdlib/ndarray-base-iteration-order": "^0.2.2",
45-
"@stdlib/ndarray-base-minmax-view-buffer-index": "^0.2.2",
4645
"@stdlib/ndarray-base-ndarraylike2object": "^0.2.2",
4746
"@stdlib/ndarray-base-numel": "^0.2.2",
4847
"@stdlib/ndarray-base-unary-loop-interchange-order": "^0.2.1",
4948
"@stdlib/ndarray-base-unary-tiling-block-size": "^0.2.2",
5049
"@stdlib/ndarray-base-vind2bind": "^0.2.2",
51-
"@stdlib/types": "^0.4.1"
50+
"@stdlib/types": "^0.4.3"
5251
},
5352
"devDependencies": {
5453
"@stdlib/array-complex128": "^0.3.0",

0 commit comments

Comments
 (0)