Skip to content

upgrade optimal and greedy algorithms with versions from cotengra #249

Description

@jcmgray

I wrote upgraded versions of both the 'dp' (i.e. optimal), greedy and random-greedy pathfinders for cotengra: https://github.com/jcmgray/cotengra/blob/main/cotengra/pathfinders/path_basic.py.

They have some main advantages:

  1. they perform various simplifications first, namely:
    • ignore any indices that appear in all terms
    • combine any repeated indices within a single term
    • reduce any non-output indices that only appear on a single term
    • combine any scalar terms
    • combine any tensors with matching indices (hadamard products)
  2. they are faster thanks to a tweak of how the indices are counted .
  3. they have drop-in rust versions in https://github.com/jcmgray/cotengrust that are even faster
  4. the random greedy algorithm produces better paths by sampling an 'alpha' parameter.

Some disadvantages:

  • no memory_limit support
  • probably some other minor options dropped for random-greedy.

Including dropping the current optimal (non-dp) implementation these should fix #99, #112, #114, #167, #189, #243, #248, #233, #94.

Raising this issue to:

  1. gauge interest in porting these over to opt_einsum to replace greedy, dp, optimal and possibly random-greedy,
  2. see whether e.g. changes like dropping the memory_limit kwarg would be acceptable.
  3. see if anyone would like to take on this task!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions