-
Notifications
You must be signed in to change notification settings - Fork 125
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
[ITensor] [Bug] Fix replaceinds
for long inputs
#1098
Changes from all commits
030862a
fd03770
49a7224
1aaad4d
9fea70d
cbab792
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,7 +557,7 @@ function replaceinds(is::Indices, rep_inds::Tuple{Vararg{Pair{<:Index,<:Index}}} | |
end | ||
|
||
function replaceinds(is::Indices, rep_inds::Pair) | ||
return replaceinds(is, Tuple(first(rep_inds)) .=> Tuple(last(rep_inds))) | ||
return replaceinds(is, first(rep_inds) .=> last(rep_inds)) | ||
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 wonder if we can just use: return replaceinds(is, first(rep_inds), last(rep_inds)) instead, which would then directly call the core version |
||
end | ||
|
||
# Check that the QNs are all the same | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method:
is also potentially problematic since splatting with
...
has similar to usingTuple
when it comes to performance for long lists (i.e. we should avoid splatting long lists).I think we could just use this instead:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I would rewrite:
as:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another simplification I would suggest is changing:
to:
(The
zip
version is too clever by half.)Another thing I noticed looking back through this code is that we might have to add a missing method:
for trying to replace a single
Index
.