ITensor / ITensor/ITensorNetworksNext.jl
Implement pre/post processing convenience functions for e.g. `MessageCache`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 3
- Forks
- 3
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 9
Description
An example is converting the dimension names of a cache of messages to match that of the norm network:
function validate_message(nn::NormNetwork, message)
return if !any(name -> has_dimname(KetView(nn), name), dimnames(message))
error(
"provided message does not have have any index \
names in common with the tensor network contained in the norm."
)
end
end
function stateform(nn::NormNetwork, messages)
renamed_messages = map(messages) do msg
if !any(name -> has_dimname(KetView(nn), name), dimnames(msg))
error(
"provided message does not have have any index \
names in common with the tensor network contained in the norm."
)
end
bramap = Dict(codomainnames(msg) .=> Base.Fix1(braname, nn).(domainnames(msg)))
return replacedimnames(name -> get(bramap, name, name), state(msg))
end
return MessageCache(renamed_messages)
end
function operatorform(nn::NormNetwork, messages)
return messagecache(keys(messages)) do edge
validate_message(nn, messages[edge])
ketnames = linknames(KetView(nn), edge)
branames = linknames(BraView(nn), edge)
bramap = Dict(branames .=> Base.Fix1(braname, nn).(ketnames))
renamed_message = replacedimnames(name -> get(bramap, name, name), messages[edge])
return operator(renamed_message, branames, ketnames)
end
end
Originally posted by @jack-dunham in https://github.com/ITensor/ITensorNetworksNext.jl/pull/119#discussion_r3494007113
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the MessageCache and NormNetwork APIs, then compare their existing message and dimension-name handling with the validate_message, stateform, and operatorform examples in this issue. Define the convenience-function entry points and verify that they perform the shown validation, renaming, and operator conversion behavior for cached messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100