Skip to content
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

Pass common keyword arguments to local updaters in a NamedTuple internal_kwargs #177

Open
mtfishman opened this issue May 13, 2024 · 4 comments

Comments

@mtfishman
Copy link
Member

Pass common keyword arguments to local updaters in a keyword argument internal_kwargs that stores them in a NamedTuple instead of individually/splatted into the updater. Many updaters don't use most of the keyword arguments being passed to them from alternating_update: https://github.com/ITensor/ITensorNetworks.jl/tree/v0.11.6/src/solvers/local_solvers so that would simplify the code a lot.

I plan to use that design in ITensorTDVP.jl v0.4: ITensor/ITensorTDVP.jl#74 and I think it is quite nice, since then updaters only need to do a bit of extra work to extract the keyword arguments they are actually using. updater_kwargs will still be splatted into the updaters.

@b-kloss I think we discussed this design and decided against it but now I'm convinced it is the way to go since it makes most updater definitions a lot simpler.

@emstoudenmire
Copy link
Contributor

I agree this sounds nice. I like the options in Julia for extracting keyword arguments now too, like the (; a,b,c) destructuring syntax if that's applicable here.

@b-kloss
Copy link
Contributor

b-kloss commented May 13, 2024

Sounds good. I assume the idea is to put the common keyword arguments into the existing NamedTuple internal_kwargs, which is currently reserved for keyword arguments that can only be inferred when the sweep_plan is created? Or would these be kept in a separate one?

@mtfishman
Copy link
Member Author

I guess so, I forget why in the current code certain keyword arguments are going into internal_kwargs while others are not but I don't see why they couldn't all just go into a single internal_kwargs.

@mtfishman
Copy link
Member Author

I agree this sounds nice. I like the options in Julia for extracting keyword arguments now too, like the (; a,b,c) destructuring syntax if that's applicable here.

That syntax is relevant here, see examples in ITensor/ITensorTDVP.jl#74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants