Skip to content

Closes #4468 aligning vecdot function to numpy - #4472

Merged
ajpotts merged 2 commits into
Bears-R-Us:masterfrom
drculhane:Closes-4468
Jun 9, 2025
Merged

ajpotts merged 2 commits into
Bears-R-Us:masterfrom
drculhane:Closes-4468

Conversation

@drculhane

@drculhane drculhane commented May 30, 2025 •

Copy link
Copy Markdown
Contributor

Closes #4468


Update to the update

I rebased, and seem to have included changes that were already in the most recent master.


Update

The array_api tests had a test of vecdot which included the comment "because numpy doesn't have a vecdot," and so it compared to something that performed the old computation. That comment has been removed, and the test now compares the result to np.vecdot.


Still a draft, for one more round of tests.

The old vecdot has been removed. The new vecdot matches the performance of numpy vecdot, and includes an optional axis parameter which can be used when the input arrays have matching shape. This didn't require any chapel-side code, just the use of broadcasting, binops, and ak.sum along the last axis.

I've added a comment in the Notes section of the docstring describing how to replicate the previous vecdot computation.

@drculhane
drculhane force-pushed the Closes-4468 branch 2 times, most recently from 343b1d2 to ef6e703 Compare May 30, 2025 16:25

@1RyanK 1RyanK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! My personal opinion is that we should match numpy behavior, so assuming no one is currently using the old version of vecdot I'd be okay with this overwriting the old one.

@drculhane drculhane changed the title Draft closure for 4468 with vecdot2 function Closes #4468 aligning vecdot function to numpy Jun 4, 2025
@drculhane
drculhane marked this pull request as ready for review June 4, 2025 16:30

@ajpotts ajpotts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Thanks for fixing this. I like all the tests.

Comment thread tests/numpy/numeric_test.py Resolved
@ajpotts
ajpotts enabled auto-merge June 9, 2025 14:19
@ajpotts
ajpotts added this pull request to the merge queue Jun 9, 2025
Merged via the queue into Bears-R-Us:master with commit e85d8d9 Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align ak.vecdot to np.vecdot

3 participants