# inner function with different site indices

**URL:** <https://itensor.discourse.group/t/inner-function-with-different-site-indices/114>\
**Category:** ITensor Julia Questions\
**Tags:** mps\
**Created:** [May 5, 2022, 7:18am UTC](https://itensor.discourse.group/t/inner-function-with-different-site-indices/114 "2022-05-05T07:18:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinh](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/kevinh/32/139_2.png) [@kevinh](https://itensor.discourse.group/u/kevinh)\
**Post date:** [May 5, 2022, 7:18am UTC](https://itensor.discourse.group/t/inner-function-with-different-site-indices/114/1 "2022-05-05T07:18:04Z")

</div>

Hi ITensor,  
I have difficulty with the use of the `inner` function. In the case of **no quantum numbers** , I have two different MPS and I want them to compute their inner product like they have the same site indices.

This seems to be related to the substitution of indices, but I’m not skilled enough to do this. Can you provide a minimal example?

Thank you for your kindness.

---

<div class="post-metadata">

**Author:** ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)\
**Post date:** [May 5, 2022, 11:12am UTC](https://itensor.discourse.group/t/inner-function-with-different-site-indices/114/2 "2022-05-05T11:12:49Z")

</div>

Good question – we don’t have a place in the docs where we explicitly explain this.

Say you have two MPS `psi1` and `psi2`, then you can do the following:

```auto
s1 = siteinds(psi1)
s2 = siteinds(psi2)
for j=1:length(psi1)
  replaceind!(psi1[j],s1[j],s2[j])
end

```

Afterwards, `psi1` will have the same site indices as `psi21`. You can print out the MPS to check this, or try taking `inner(psi1,psi2)` and it should now work.

---

<div class="post-metadata">

**Author:** ![kevinh](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/kevinh/32/139_2.png) [@kevinh](https://itensor.discourse.group/u/kevinh)\
**Post date:** [May 5, 2022, 12:04pm UTC](https://itensor.discourse.group/t/inner-function-with-different-site-indices/114/3 "2022-05-05T12:04:45Z")

</div>

This method is very effective, thank you very much for your help,
