|
2 | 2 | processcontractions(ex, treebuilder, treesorter, costcheck)
|
3 | 3 |
|
4 | 4 | Process the contractions in `ex` using the given `treebuilder` and `treesorter` functions.
|
5 |
| -This is done by first extracting a network representation from the expression, then |
6 |
| -building and sorting the contraction trees with a given `treebuilder` and `treesorter` |
7 |
| -function, and finally inserting the contraction trees back into the expression. When the |
8 |
| -`costcheck` function is provided, the cost of each contraction is computed and comp |
| 5 | +This is done by first extracting a network representation from the expression, then building |
| 6 | +and sorting the contraction trees with a given `treebuilder` and `treesorter` function, and |
| 7 | +finally inserting the contraction trees back into the expression. When the `costcheck` |
| 8 | +argument equals `:warn` or `:cache` (as opposed to `:nothing`), the optimal contraction |
| 9 | +order is computed at runtime using the actual values of [`tensorcost`](@ref) and this |
| 10 | +optimal order is compared to the contraction order that was determined at compile time. If |
| 11 | +the compile time order deviated from the optimal order, a warning will be printed (in case |
| 12 | +of `costcheck == :warn`) or this particular contraction will be recorded in |
| 13 | +`TensorOperations.costcache` (in case of `costcheck == :cache`). Both the warning or the |
| 14 | +recorded cache entry contain a `order` suggestion that can be passed to the `@tensor` macro |
| 15 | +in order to encode the optimal contraction order at compile time.. |
9 | 16 | """
|
10 | 17 | function processcontractions(ex, treebuilder, treesorter, costcheck)
|
11 | 18 | if isexpr(ex, :block)
|
|
0 commit comments