# Problem with multiplying MPO with MPS: Index Contraction

**URL:** <https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675>\
**Category:** ITensor Julia Questions\
**Created:** [April 30, 2024, 11:34pm UTC](https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675 "2024-04-30T23:34:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avishipoddar](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@avishipoddar](https://itensor.discourse.group/u/avishipoddar)\
**Post date:** [April 30, 2024, 11:34pm UTC](https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675/1 "2024-04-30T23:34:08Z")

</div>

this is what I am trying to implement:

psi=apply(detEv,psi\_old,maxdim=50)

Here detEv is an MPO: Vector{Index{Int64}}[[(dim=3|id=170|“S=1,Site,n=1”)‘, (dim=3|id=170|“S=1,Site,n=1”)], [(dim=3|id=879|“S=1,Site,n=2”)’, (dim=3|id=879|“S=1,Site,n=2”)], [(dim=3|id=363|“S=1,Site,n=3”)‘, (dim=3|id=363|“S=1,Site,n=3”)], [(dim=3|id=602|“S=1,Site,n=4”)’, (dim=3|id=602|“S=1,Site,n=4”)]]

and psi\_old is an MPS: Vector{Index{Int64}}[[(dim=3|id=658|“S=1,Site,n=1”)], [(dim=3|id=39|“S=1,Site,n=2”)], [(dim=3|id=414|“S=1,Site,n=3”)], [(dim=3|id=599|“S=1,Site,n=4”)]]

I get the following error: In `contract(A::MPO, x::MPS)`, `A` and `x` must share a set of site indices.

I am not really sure how to fix this

---

<div class="post-metadata">

**Author:** ![avishipoddar](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@avishipoddar](https://itensor.discourse.group/u/avishipoddar)\
**Post date:** [May 1, 2024, 12:58am UTC](https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675/2 "2024-05-01T00:58:17Z")

</div>

Fixed!

---

<div class="post-metadata">

**Author:** ![ajuum](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ajuum/32/598_2.png) [@ajuum](https://itensor.discourse.group/u/ajuum)\
**Post date:** [July 9, 2024, 10:06pm UTC](https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675/3 "2024-07-09T22:06:34Z")

</div>

could you expain how you fix it?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [February 26, 2025, 3:15am UTC](https://itensor.discourse.group/t/problem-with-multiplying-mpo-with-mps-index-contraction/1675/4 "2025-02-26T03:15:54Z")

</div>

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