Skip to content

Commit 5d35cf0

Browse files
authored
Add warning to docs about mixing contraction order specification styles (#229)
1 parent b3f19b8 commit 5d35cf0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/src/man/indexnotation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,23 @@ however different strategies to modify this order.
243243
because they share an index label which is next in the `order` list, all other indices
244244
with shared label among them will be contracted, irrespective of their order.
245245

246+
!!! warning "Combining order specifications"
247+
248+
Note that it is currently not possible to combine the NCON style convention of specifying
249+
indices with the use of parentheses. If both are used at the same time, the parentheses
250+
take precedence and the NCON style will be ignored. Any remaining contraction orders
251+
will be evaluated in the default left to right order. For example, in the following
252+
contractions, we have `E1 = A * ((B * D) * C)`, but `E2 = A * ((B * C) * D)`. This is
253+
true even when the parentheses are compatible with the NCON contraction order, as is
254+
the case here.
255+
256+
```julia
257+
@tensor E1[-1 -2 -3; -4] := A[-1 -2 -3; 4 5] * B[4; 1] * C[5; 2] * D[1 2; -4]
258+
@tensor E2[-1 -2 -3; -4] := A[-1 -2 -3; 4 5] * (B[4; 1] * C[5; 2] * D[1 2; -4])
259+
```
260+
261+
Additionally, combining the `order = (...)` keyword with parentheses is currently not supported.
262+
246263
In the case of more complex tensor networks, the optimal contraction order cannot always
247264
easily be guessed or determined on plain sight. It is then useful to be able to optimize the
248265
contraction order automatically, given a model for the complexity of contracting the

0 commit comments

Comments
 (0)