-
Notifications
You must be signed in to change notification settings - Fork 49
Fix rrules for Fermionic symmetries #126
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
466226f
initial work
lkdvos 9331ad7
fermionic ad stuff
qmortier 96e0d99
Formatter
lkdvos 3a168fd
Fix Base.summary
lkdvos 3dbd33c
Refactor AD tests for more coverage
lkdvos dc5f098
Vectorize twist(!)
lkdvos 3e62047
Simplify tensoradd rrule
lkdvos 6f72e00
Add vectorized twist to tensorcontract
lkdvos 6c2d90c
Refactor tensorproduct rrule
lkdvos 6447f06
Refactor tensortrace rrule
lkdvos 64a6f40
Clean up ChainRulesCoreExt
lkdvos c3dc374
Improve tensortrace rrule tests
lkdvos 4264ec6
Fix syntax error
lkdvos f82dae0
Fix tensortrace error
lkdvos 02af560
Fix extensions on julia 1.6
lkdvos 60fce38
Reduce weight tests
lkdvos 164ddbe
Fix issue with reducing over empty set
lkdvos 1a04143
More retries to avoid empty tensors
lkdvos 0ccab5a
More changes to fix AD tests
lkdvos d39f44d
Simplify to_vec for TensorMaps
lkdvos 501fbe4
Add tests for empty domain/codomain
lkdvos 73992c9
Change spaces until RNG gods bless me
lkdvos 39942c1
Add TODO for using planar rules in rrules [skip ci]
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,8 +226,8 @@ end | |
|
||
# Twist | ||
""" | ||
twist!(t::AbstractTensorMap, i::Int; inv::Bool=false) | ||
-> t | ||
twist!(t::AbstractTensorMap, i::Int; inv::Bool=false) -> t | ||
twist!(t::AbstractTensorMap, is; inv::Bool=false) -> t | ||
|
||
Apply a twist to the `i`th index of `t`, storing the result in `t`. | ||
If `inv=true`, use the inverse twist. | ||
|
@@ -248,17 +248,31 @@ function twist!(t::AbstractTensorMap, i::Int; inv::Bool=false) | |
end | ||
return t | ||
end | ||
function twist!(t::AbstractTensorMap, is; inv::Bool=false) | ||
if !all(in(allind(t)), is) | ||
msg = "Can't twist indices $is of a tensor with only $(numind(t)) indices." | ||
throw(ArgumentError(msg)) | ||
end | ||
(BraidingStyle(sectortype(t)) == Bosonic() || isempty(is)) && return t | ||
N₁ = numout(t) | ||
for (f₁, f₂) in fusiontrees(t) | ||
θ = prod(i -> i <= N₁ ? twist(f₁.uncoupled[i]) : twist(f₂.uncoupled[i - N₁]), is) | ||
inv && (θ = θ') | ||
rmul!(t[f₁, f₂], θ) | ||
end | ||
return t | ||
end | ||
|
||
""" | ||
twist(t::AbstractTensorMap, i::Int; inv::Bool=false) | ||
-> t | ||
twist(tsrc::AbstractTensorMap, i::Int; inv::Bool=false) -> tdst | ||
twist(tsrc::AbstractTensorMap, is; inv::Bool=false) -> tdst | ||
|
||
Apply a twist to the `i`th index of `t` and return the result as a new tensor. | ||
Apply a twist to the `i`th index of `tsrc` and return the result as a new tensor. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to mention that the doc string needed an update to reflect the |
||
If `inv=true`, use the inverse twist. | ||
|
||
See [`twist!`](@ref) for storing the result in place. | ||
""" | ||
twist(t::AbstractTensorMap, i::Int; inv::Bool=false) = twist!(copy(t), i; inv=inv) | ||
twist(t::AbstractTensorMap, i; inv::Bool=false) = twist!(copy(t), i; inv) | ||
|
||
# Fusing and splitting | ||
# TODO: add functionality for easy fusing and splitting of tensor indices | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.