ITensor / ITensors.jl

A Julia library for efficient tensor computations and tensor network calculations
https://itensor.org
Apache License 2.0
513 stars 119 forks source link

[NDTensors] Create a new `KeyOperations` library #1328

Open mtfishman opened 5 months ago

mtfishman commented 5 months ago

Create a new KeyOperations library that defines functions like:

for dictionary-like objects, such as Base.NamedTuple, Base.Dict, and Dictionaries.Dictionary (which could be implemented in a package extension KeyOperationsDictionariesExt).

Some of this was already started as part of the Sectors library to help implement fusion of CategoryProducts that have named categories, though with names like sort_keys, union_keys, etc. (see https://github.com/ITensor/ITensors.jl/blob/v0.3.55/NDTensors/src/lib/Sectors/src/namedtuple_operations.jl).

Some related discussions in the Julia ecosystem:

@emstoudenmire

emstoudenmire commented 5 months ago

Great – I was really interested to see how the named tuples in Julia can actually function as a very fast, heterogeneous dictionary. That makes them a very powerful datatype to have, but of course the interface could be nicer for using them in this way and more fleshed out. So this PR should help with that.