Simple circuit operations on MPS

,

Hi,

I am trying to do simple unitary circuits (MPO) on MPS . For example, I want to get a MPS representation of the states:

\displaystyle |\Psi_1 \rangle =\left[ \prod_{i=1}^{N} CZ_{i,i+1}\right]\; \ket{++\dots +}

\displaystyle |\Psi_2(\alpha) \rangle = \bigotimes_{i=1}^{N}\exp{(-i\alpha X_i)} |\Psi_1 \rangle .

\displaystyle |\Psi_3 (\alpha,\beta)\rangle =\prod_{i=1}^{N}\exp(-i\beta Z_{i-1}Z_{i+1}) |\Psi_2(\alpha) \rangle .

In this regard, I was following the sample code available at: ITensorMPS.jl/examples/gate_evolution/quantum_simulator.jl at main · ITensor/ITensorMPS.jl · GitHub

but I keep getting the error:

UndefVarError: ops not defined in Main
Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from.
Hint: a global variable of this name also exists in ITensors.
Hint: a global variable of this name also exists in ITensorMPS.

At any rate, would it be possible to get an idea of how to produce minimum working code for say, |\Psi_2\rangle above?

Thanks in advance!

Arnab

You could try ITensorMPS.ops(...) in the sample code. There seems to be a conflict with the ops() function being defined in both the packages that are being imported.

1 Like

Thanks Matt for your quick response. I am sorry to bother you again with bugs again but here is what I get when I run it with that modification:

MethodError: no method matching ops(::Vector{Index{Int64}}, ::Vector{Tuple{String, Int64}})
The function ops exists, but no method is defined for this combination of argument types.
Closest candidates are:
ops(::DMRGObserver)
@ ITensors ~/.julia/packages/ITensors/4M2ep/src/ITensorMPS/observer.jl:133

Also, I am not sure how to apply the gate \exp(-i\alpha X_i) as an MPO to an MPS.

Could you please provide the versions you are using? you can do that as follows:

(@temp) pkg> status ITensors ITensorMPS
Status `~/.julia/environments/temp/Project.toml`
  [0d1a4710] ITensorMPS v0.3.16
  [9136182c] ITensors v0.9.2

For the application of the operator, you can use the built-in operator Rx (SiteTypes Included with ITensor · ITensorMPS.jl)

1 Like