ITensor / ITensor/ITensorBase.jl

[ENHANCEMENT] Interface for adding multiple tags at a time

Open
#29 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
0
Forks
0
Avg merge
3h 27m
Merged PRs (30d)
7

Description

Currently with the new "named tags" design based on a dictionary, you can add or update a tag using its name with:

i = Index(2)
j = settag(i, "site", "1")

and delete a tag using its name with:

k = unsettag(j, "site")
k == i # true

It might be nice to have a syntax for adding multiple tags at once. Currently, settags is used as an internal function for setting all the tags at once, with existing ones getting removed:

i = Index(2)
j = settag(i, "site", "1")
k = settags(j, Dict(["link" => "3"])) # This is currently only defined in `IndexName` but this is for demonstration purposes
hastag(k, "site") # false

so it is meant to be low-level, and I think it is a good name for that.

Maybe we can use the syntax mergetags, i.e.:

i = Index(2)
j = settag(i, "site", "1")
k = mergetags(j, Dict(["link" => "3"]))
gettag(k, "site") == "1" # true
gettag(k, "link") == "3" # true

following the usage of Base.merge on Base.Dict:

julia> merge(Dict("foo" => 0.0, "bar" => 42.0), Dict("baz" => 17, "bar" => 4711))
Dict{String, Float64} with 3 entries:
  "bar" => 4711.0
  "baz" => 17.0
  "foo" => 0.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by locating the Index tag methods and the existing settags implementation. Compare the proposed merge behavior with current settag, unsettag, and settags usage, then confirm the public API and collision semantics with maintainers. Done means an agreed interface and tests covering preservation and replacement of tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.