I am working on an implementation of the RQAOA algorithm on the Maxcut problem in Cirq. My graph G has n vertices. And after running a QAOA circuit with n qubits I obtain a state gammabeta (a vertical vector with 2^n entries).
I want to calculate M(e) = <gammabeta|Z(e)|gammabeta> for all edges e of G.
I want Z(e) to be an observable of the form $I\otimes \dots \otimes I \otimes Z_i \otimes I \otimes \dots \otimes I \otimes Z_j \otimes I \otimes \dots \otimes I$ (two dimensional $I$'s), with $i -1$ $I$'s in front if $Z_i$, $j -i -1$ in the middle and $n - j - 1$ behind $Z_j$.
That way I can use Z(e).expectation_from_state_vector(gammabeta, qubit_map=qubit_map)) to calculate M(e)
The problem I ran into is that I do not know how to do $I \otimes Z$ in cirq. If I write cirq.Z * cirq.Z I get $Z\otimes Z$, but if I do cirq.I * cirq.Z it does the regular product, and I get $Z$ back.
Does any one know how to make observable Z(e)? Or altenatively how to compute the expectation value of a circuit B with state vector a: <a|B|a>? Building the Z(e) circuit is easier, but I don't know how to calculate the expectation value if a state vector from one circuit, on another circuit.