Operating on an MPO from the right

Hi,

Is it possible to operate on an MPO from both directions? It seems that the following is correct:

using ITensors, ITensorMPS

let
    s = siteinds("Qubit",2)
    
    oper = op("Rx", s[1], θ=π/5)

    mpo = MPO(s, "I")

    mpo =apply(oper, mpo)

end

However, changing the apply command to mpo = apply(mpo, oper) throws an error. In some cases it would be useful to build an MPO from both directions, not only by applying the operators naively from left to right.

You can use mpot = swapprime(mpo, 0 => 1) and opert = swapprime(oper, 0 => 1) to transpose the MPO and operator so that swapprime(apply(opert, mpot), 0 => 1) applies the operator on the other side (and transposes back).

Though probably we should support apply(mpo, oper) as a shorthand for that.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.