-
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
[ITensors] Add docstrings for tr and update ITensor example #1186
Changes from all commits
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 |
---|---|---|
|
@@ -531,6 +531,11 @@ function logdot(M1::MPO, M2::MPO; make_inds_match::Bool=false, kwargs...) | |
return _log_or_not_dot(M1, M2, true; make_inds_match=make_inds_match) | ||
end | ||
|
||
""" | ||
tr(M::MPO; kwargs...) | ||
|
||
Compute the trace of the MPO `M`. | ||
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. Maybe cross reference |
||
""" | ||
function tr(M::MPO; plev::Pair{Int,Int}=0 => 1, tags::Pair=ts"" => ts"") | ||
N = length(M) | ||
# | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,9 +13,14 @@ function _tr(T::ITensor; plev::Pair{Int,Int}=0 => 1, tags::Pair=ts"" => ts"") | |||||
return Tᶜ | ||||||
end | ||||||
|
||||||
# Trace an ITensor over pairs of indices determined by | ||||||
# the prime levels and tags. Indices that are not in pairs | ||||||
# are not traced over, corresponding to a "batched" trace. | ||||||
""" | ||||||
tr(T::ITensor; kwargs...) | ||||||
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.
Suggested change
|
||||||
|
||||||
Trace an ITensor over pairs of indices determined by | ||||||
the optional prime levels and tags passed as keyword arguments. | ||||||
Comment on lines
+19
to
+20
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. Should reword to say it is over pairs of indices with prime levels 0 and 1. |
||||||
Indices that are not in pairs are not traced over, corresponding | ||||||
to a "batched" trace. | ||||||
""" | ||||||
function tr(T::ITensor; kwargs...) | ||||||
return _tr(T; kwargs...) | ||||||
end | ||||||
|
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.