Applying dag on subset of indices

Hello,

I am working with Kraus operators in ITensor, and would like to apply dag only to the site legs of a Kraus tensor, and not on the virtual index, to implement the following:

\sum_i K_i \rho K_i^\dagger

Is there a good way to do this with the ITensor library? I thought there could be something like dag(K, oninds=listofinds) or dag(K, ignoreids=virtualidx).

Thank you!

Take a look at the apply/product function, the docstring should help:

julia> using ITensors

julia> ?

help?> product
[...]

EDIT: I noticed the docstring doesn’t cover the keyword argument apply_dag, if you do product(A, B; apply_dag=true) or apply(A, B; apply_dag=true) it performs what would be comparable to the linear algebra operation ABA^{\dagger} treating the ITensors A and B as matrices from the primed to the unprimed site/external indices.

Also PastaQ.jl may be useful: https://github.com/GTorlai/PastaQ.jl

Thank you for the reply! I got apply to work for the quantum channel \rho' = \sum_i K_i \rho K_i^\dagger. However, apply does not allow me to express the completeness condition \sum_i K_i^\dagger K_i = I, since that would require running apply(Kdag, \delta(...), apply_dag=true), and I do not have Kdag. Do you have any suggestions for this case? It is also inconvenient to have to include the \delta(...).

What about Kdag = swapprime(dag(K), 0 => 1)?

Thank you for the tip. This seems to work, though I have to contract the result with δ(krausidx, prime(krausidx)) to unprime the virtual index that is being summed over. Ideally, there would be a kwarg for dag to list indices to not dag on.