Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unicode alternatives: otimes and oplus #109

Merged
merged 2 commits into from
Mar 30, 2024
Merged

Add unicode alternatives: otimes and oplus #109

merged 2 commits into from
Mar 30, 2024

Conversation

lkdvos
Copy link
Collaborator

@lkdvos lkdvos commented Mar 27, 2024

Adds a non-unicode alternative to \otimes for sectors: fusionproduct.

Fixes #108 .

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.40%. Comparing base (726c044) to head (f367a3e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #109   +/-   ##
=======================================
  Coverage   81.40%   81.40%           
=======================================
  Files          42       42           
  Lines        5565     5565           
=======================================
  Hits         4530     4530           
  Misses       1035     1035           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jutho
Copy link
Owner

Jutho commented Mar 29, 2024

Probably needs some coverage :-). I am also wondering whether it is not better to really just have a unicode alternative to \otimes, that does not depend on the argument types (which is probably what you had suggested at first). Otherwise, we further complicate the interface. I would be fine with, otimes, tensorproduct, tensorprod. In TensorCore.jl, they simply call this tensor, but this is maybe a bit confusing (although one does read it like "a tensor b").

@lkdvos
Copy link
Collaborator Author

lkdvos commented Mar 29, 2024

I definitely also prefer having a fixed unicode alternative for this. It also creates less confusion when implementing the interface, as with the current implementation you would have to implement \otimes and not fusionproduct.

I do think tensor might be confusing, so I would vote otimes, and then use const ⊗ = otimes.

@Jutho
Copy link
Owner

Jutho commented Mar 29, 2024

Ok sounds good. However, I would keep using the actual unicode in all of the method definitions; I do like it more than the ascii otimes.

@lkdvos
Copy link
Collaborator Author

lkdvos commented Mar 29, 2024

I'll implement when I find some time.

Just for completeness: I double-checked and the alias thing works how you would expect: they are completely equivalent and defining methods for either implements them for both, so we can definitely just keep using the unicode everywhere.

julia> otimes(a, b) = a * b
otimes (generic function with 1 method)

julia> const  = otimes
otimes (generic function with 1 method)

julia> (a::Int, b::Int) = 2 * a * b
otimes (generic function with 2 methods)

julia> otimes(1, 2)
4

julia> (1, 2)
4

julia> 1  2
4

julia> (1.0, 2.0)
2.0

@lkdvos
Copy link
Collaborator Author

lkdvos commented Mar 30, 2024

I implemented the changes, and in the meantime also added a non-unicode alternative for oplus. As these are now true aliases, I don't think I need to add coverage?

@lkdvos lkdvos changed the title Add fusionproduct Add unicode alternatives: otimes and oplus Mar 30, 2024
@Jutho Jutho merged commit aada0b2 into master Mar 30, 2024
14 checks passed
@lkdvos lkdvos deleted the ld/fusiontensor branch March 30, 2024 21:58
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.

\otimes+TAB in PyJulia
2 participants