# "ops" bug with ITensorMPS

**URL:** <https://itensor.discourse.group/t/ops-bug-with-itensormps/1948>\
**Category:** ITensor Julia Questions\
**Tags:** julia\
**Created:** [August 30, 2024, 7:54am UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948 "2024-08-30T07:54:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![asing](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@asing](https://itensor.discourse.group/u/asing)\
**Post date:** [August 30, 2024, 7:54am UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/1 "2024-08-30T07:54:13Z")

</div>

Hi!

I started to migrate my code with ITensorMPS and I encountered an error while running the following example from the libraray:

> <https://github.com/ITensor/ITensors.jl/blob/main/src/lib/ITensorMPS/examples/gate_evolution/mpo_gate_evolution.jl>

WARNING: both ITensorMPS and ITensors export “ops”; uses of it in module Main must be qualified  
**ERROR:** LoadError: UndefVarError: `ops` not defined

This error doesn’t appear while only using ITensors library, however, the inner function throws an error in that case.

Is there a way to define these gates with ITensorMPS library?

---

<div class="post-metadata">

**Author:** ![ryanlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ryanlevy/32/150_2.png) [@ryanlevy](https://itensor.discourse.group/u/ryanlevy)\
**Post date:** [August 30, 2024, 12:54pm UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/2 "2024-08-30T12:54:23Z")

</div>

If you change the line to `gates = ITensors.ops(...` things should work

For the warning, the line should be `@show inner(psi', rho, psi)`, the inner is missing a prime.

(also it would be helpful if you wanted to open a PR on github to fix these!)

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [September 1, 2024, 7:55pm UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/3 "2024-09-01T19:55:52Z")

</div>

That looks like a bug, the code in your original post should work. I’ll take a look.

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [September 1, 2024, 10:03pm UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/4 "2024-09-01T22:03:15Z")

</div>

Fixing this in [Fix `ops` export by mtfishman · Pull Request #26 · ITensor/ITensorMPS.jl · GitHub](https://github.com/ITensor/ITensorMPS.jl/pull/26).

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [September 2, 2024, 12:24am UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/5 "2024-09-02T00:24:41Z")

</div>

The fix is being registered in ITensorMPS.jl v0.2.5, please update your packages and let us know if that fixes your original issue.

---

<div class="post-metadata">

**Author:** ![asing](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@asing](https://itensor.discourse.group/u/asing)\
**Post date:** [September 2, 2024, 1:58am UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/6 "2024-09-02T01:58:12Z")

</div>

Thank you for fixing the bug quickly.  
However, I am having trouble with updating to v.0.2.5.  
I removed the current version and tried to install it again, I am getting the following error:

**(@v1.9) pkg\>** add ITensorMPS@v0.2.5  
**Resolving** package versions…  
**ERROR:** Unsatisfiable requirements detected for package ITensorMPS [0d1a4710]:  
ITensorMPS [0d1a4710] log:  
├─possible versions are: 0.1.0-0.2.4 or uninstalled  
└─restricted to versions 0.2.5 by an explicit requirement — no versions left

---

<div class="post-metadata">

**Author:** ![mtfishman](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/mtfishman/32/11_2.png) [@mtfishman](https://itensor.discourse.group/u/mtfishman)\
**Post date:** [September 2, 2024, 3:42pm UTC](https://itensor.discourse.group/t/ops-bug-with-itensormps/1948/7 "2024-09-02T15:42:58Z")

</div>

Please try again, I’m able to update to ITensorMPS v0.2.5. You may have just tried too quickly and the registration process hadn’t completed.
