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

Add essential IR tree operations #58

Open
5 of 14 tasks
dcerkoney opened this issue Nov 27, 2022 · 0 comments
Open
5 of 14 tasks

Add essential IR tree operations #58

dcerkoney opened this issue Nov 27, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dcerkoney
Copy link
Collaborator

dcerkoney commented Nov 27, 2022

Write unit tests and functions for essential tree transformations in the intermediate (computational graph) representation:

Transformations

Transformations for tree sanitization:

  • prune_unary — Prune trivial unary operations, e.g., $(+a) \rightarrow a$ and $(*a) \equiv (1*a) \rightarrow a$.
  • inplace_prod — Propagate subgraph factors up multiplicative chains and merge.
  • merge_prefactors — Factorize multiplicative graph prefactors, e.g., $a * G + b * G \rightarrow (a + b) * G$.
  • merge_chains — Merge operator chains into a single operation, e.g., $a+(+(\cdots+(+b)\cdots)) \rightarrow a+b$ and $G_1 +(+(\cdots+)+)\; G_2 \rightarrow G_1 + G_2$.
  • merge_operators — Use the associativity of an operator $\mathcal{O}$ to "deparenthesize" an expression, i.e., join two sub-operations into a single $n$-ary form. Use with $\mathcal{O} = \bigotimes$ requires Base.:*(g1, g2).
  • split_operator — Use the associativity of an operator $\mathcal{O}$ to "parenthesize" an expression, i.e., split the $n$-ary form of a node into two sub-operations. Use with $\mathcal{O} = \bigotimes$ requires Base.:/(g1, g2).

High-priority transformations for the Parquet front-end:

  • relabel — Update the label(s) of quantum operators in a graph and its subgraphs, e.g., {{1,2}=>3, 3=>4}.
  • standarize_labels — Finds all labels in a graph and its subgraphs (e.g., 1,4,5,7...) and then relabels them in standard order 1,2,3,4,...
  • unghost_legs — A special case of split_operator for graph decomposition $(\mathcal{O} = \bigotimes)$ which does not require Base.:/(g1, g2). Extracts a vertex with ghost legs and its connected propagators into a new $\bigotimes$ node, thereby "unghosting" its legs.
  • replace_subgraph — Replace one subgraph of a graph g with another one of possibly different topology.

Low-priority transformations requiring associative graph (de)composition to be defined via Base.:*(g1, g2) and Base.:/(g1, g2):

  • expand — Expand a factorized graph expression: $(G_1 + G_2) * W \mapsto G_1 * W + G_2 * W$. The recursive depth should be specified by an argument depth which is 1 by default.
  • factorize — Factorize a graph expression (the inverse of expand): $G_1 * W + G_2 * W \mapsto (G_1 + G_2) * W$. The recursive depth should be specified by an argument depth which is 1 by default. Requires Base.:/(g1, g2).
  • tofeynmanrep — Convert a general graph to the Feynman representation by chaining expand and merge_chains.
  • fromfeynmanrep — Optimize a graph in the Feynman representation by chaining factorize and merge_chains.

Definitions/Examples



@dcerkoney dcerkoney added the enhancement New feature or request label Nov 27, 2022
@dcerkoney dcerkoney self-assigned this Dec 7, 2022
@dcerkoney dcerkoney changed the title Add basic IR tree operations Add essential IR tree operations Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants