Skip to content

Commit

Permalink
Merge pull request #508 from willow-ahrens/wma/fix_einsum
Browse files Browse the repository at this point in the history
reduce style correctly
  • Loading branch information
willow-ahrens authored Apr 26, 2024
2 parents 0ffa443 + 3e78a76 commit e1c46b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Finch"
uuid = "9177782c-1635-4eb9-9bfb-d9dfa25e6bce"
authors = ["Willow Ahrens"]
version = "0.6.22"
version = "0.6.23"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
2 changes: 1 addition & 1 deletion src/interface/einsum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ einsum_access(tns::EinsumTensor, idxs...) = EinsumArgument{eltype(tns.arg)}(
)

einsum_op(op, args::EinsumArgument...) = EinsumArgument{combine_eltypes(op, args)}(
result_style((arg.style for arg in args)...),
reduce(result_style, [arg.style for arg in args]; init=EinsumEagerStyle()),
mapjoin(op, (arg.data for arg in args)...),
mergewith(&, (arg.extrude for arg in args)...),
op((arg.default for arg in args)...)
Expand Down
7 changes: 7 additions & 0 deletions test/test_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ using Finch: AsArray
using Test

@testset "Einsum Tests" begin
# Test 0
A = [1 2; 3 4]
B = [5 6; 7 8]
s = Scalar(0)
@einsum s[] += abs(A[i, k] * B[k, j])
@test s[] == 134

# Test 1
A = [1 2; 3 4]
B = [5 6; 7 8]
Expand Down

2 comments on commit e1c46b0

@willow-ahrens
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/105674

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.23 -m "<description of version>" e1c46b0cbc37736dea7e038607544b22f02d7b6d
git push origin v0.6.23

Please sign in to comment.