# Is there a built-in algorithm in ITensor to calculate the inverse of MPO?

**URL:** <https://itensor.discourse.group/t/is-there-a-built-in-algorithm-in-itensor-to-calculate-the-inverse-of-mpo/1765>\
**Category:** DMRG and Numerical Methods\
**Tags:** mpo\
**Created:** [May 30, 2024, 3:36pm UTC](https://itensor.discourse.group/t/is-there-a-built-in-algorithm-in-itensor-to-calculate-the-inverse-of-mpo/1765 "2024-05-30T15:36:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yedi](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@yedi](https://itensor.discourse.group/u/yedi)\
**Post date:** [May 30, 2024, 3:36pm UTC](https://itensor.discourse.group/t/is-there-a-built-in-algorithm-in-itensor-to-calculate-the-inverse-of-mpo/1765/1 "2024-05-30T15:36:11Z")

</div>

Hi, dear developers

Recently I use Itensor to calculate the ground state energy and ground state of a one-dimensional antiferromagnetic Heisenberg chain. I would like to further obtain its dynamical spin Green’s functions. It can be defined as: \langle \Phi\_{0}| S\_{-\mathbf{q}}^z \frac{1}{\mathcal{H}-\omega-\omega\_{0}+i\eta}S\_{\mathbf{q}}^z |\Phi\_{0}\rangle=\langle \Phi^{\prime}|\frac{1}{\mathcal{H}-\omega-\omega\_{0}+i\eta} |\Phi^{\prime} \rangle. Here |\Phi\_{0}\rangle is the ground state, which can be obtained from DMRG. |\Phi^{\prime}\rangle =S\_{\mathbf{q}}^z |\Phi\_{0}\rangle=\sum\_{\mathbf{R}} S\_{\mathbf{R}}^z e^{i \mathbf{k} \cdot \mathbf{R}}|\Phi\_{0}\rangle, which can be calculated by using MPO S\_{\mathbf{R}}^{z} times the ground state MPS. \mathcal{H} is the Hamiltonian of system, which is written as MPO in Itensor. \omega, \omega\_{0}, and \eta are real numbers time a diagITensor. i is the square root of -1. The tricky part is how we get the inverse of MPO \mathcal{H} and apply it to |\Phi^{\prime}\rangle. So I would like to ask the developers if there is a built-in algorithm in ITensor to calculate the inverse of MPO or other suggestions?

Thank you for your patience, and I am looking to to hearing from you.

Regards,  
Y.D.Shen.

---

<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:** [May 30, 2024, 3:44pm UTC](https://itensor.discourse.group/t/is-there-a-built-in-algorithm-in-itensor-to-calculate-the-inverse-of-mpo/1765/2 "2024-05-30T15:44:49Z")

</div>

Instead of computing |x\rangle=A^{-1}|y\rangle by explicitly taking the inverse A^{-1} it is probably better to reframe it as a linear equation, i.e. solve A|x\rangle=|y\rangle for |x\rangle. We have experimental support for MPS linear equation solving, if you load [ITensorMPS.jl](https://github.com/ITensor/ITensorMPS.jl) you can use the function `linsolve` which has very similar syntax to the other solvers. See [ITensorMPS.jl/examples at main · ITensor/ITensorMPS.jl · GitHub](https://github.com/ITensor/ITensorMPS.jl/tree/main/examples) for examples of using the other solvers, we don’t have an example of using `linsolve` yet since we still don’t know the best practices for that solver. Also see [KrylovKit.linsolve](https://jutho.github.io/KrylovKit.jl/stable/man/linear/#KrylovKit.linsolve).

---

<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:** [July 7, 2024, 5:04pm UTC](https://itensor.discourse.group/t/is-there-a-built-in-algorithm-in-itensor-to-calculate-the-inverse-of-mpo/1765/3 "2024-07-07T17:04:51Z")

</div>

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