# QuanticsTCI package

**URL:** <https://itensor.discourse.group/t/quanticstci-package/1641>\
**Category:** ITensor Julia Questions\
**Created:** [April 18, 2024, 10:01am UTC](https://itensor.discourse.group/t/quanticstci-package/1641 "2024-04-18T10:01:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faridun](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Faridun](https://itensor.discourse.group/u/Faridun)\
**Post date:** [April 18, 2024, 10:01am UTC](https://itensor.discourse.group/t/quanticstci-package/1641/1 "2024-04-18T10:01:51Z")

</div>

Hello, does anyone have information about QuanticsTCI and is it possible to apply this package together with ITensor?  
I am interested in obtaining ground state wavefunction by using tensor train network.

---

<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:** [April 18, 2024, 2:07pm UTC](https://itensor.discourse.group/t/quanticstci-package/1641/2 "2024-04-18T14:07:07Z")

</div>

You can find the TensorCrossInterpolation and QuanticsTCI packages by Marc Ritter at these links:  
[https://gitlab.com/tensors4fields/TensorCrossInterpolation.jl](https://gitlab.com/tensors4fields/TensorCrossInterpolation.jl)  
[https://gitlab.com/tensors4fields/QuanticsTCI.jl](https://gitlab.com/tensors4fields/QuanticsTCI.jl)  
The packages include a function `MPS` which converts the result of the calculation into an ITensor MPS object.

I would not know how to use TCI to compute a ground state. What is your thinking about that? TCI solves the problem of evaluating a function f(s1,s2,…,sn) at a set of interpolating points and then produces an accurate approximation of this function as an MPS whose site indices are the variables s1,s2,…sn.

To compute a ground state as an MPS or tensor train (which is the same thing as an MPS), the DMRG algorithm is the best choice.

---

<div class="post-metadata">

**Author:** ![Faridun](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Faridun](https://itensor.discourse.group/u/Faridun)\
**Post date:** [April 18, 2024, 3:04pm UTC](https://itensor.discourse.group/t/quanticstci-package/1641/3 "2024-04-18T15:04:31Z")

</div>

Thank you for your reply and clarification.  
Coming back to this discussion [Ground state wavefunction](https://itensor.discourse.group/t/ground-state-wavefunction/1470)  
I wanted to use tensor cross interpolation to obtain to obtain the ground state wavefunction for systems with large number of sites (L\>100). So I am looking for ways to do this. Is there a package in Julia or Python that does it or is it necessary to write my own code for it?

---

<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:** [April 18, 2024, 3:31pm UTC](https://itensor.discourse.group/t/quanticstci-package/1641/4 "2024-04-18T15:31:20Z")

</div>

You cannot use tensor cross interpolation to obtain a ground state wavefunction. Part of what I was clarifying above is that it is not the purpose of that algorithm.

Is there a reason you are not wanting to use DMRG to find a ground state? What is the precise problem that you are trying to solve? E.g. do you have a Hamiltonian or some other starting point?

---

<div class="post-metadata">

**Author:** ![Faridun](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Faridun](https://itensor.discourse.group/u/Faridun)\
**Post date:** [April 19, 2024, 10:07am UTC](https://itensor.discourse.group/t/quanticstci-package/1641/5 "2024-04-19T10:07:28Z")

</div>

The reason is that the by using contract(Psi) I could not obtain the whole ground state wavefunction for the systems with L\>12. The problem is to calculate the following:

![Снимок экрана 2024-04-19 в 13.01.48](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/15205487ef00e294519f10c5a97a65749a9ed199.png)

I am looking for an algorithm (like tensor cross interpolation) with already implemented code to solve the problem.

---

<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:** [April 19, 2024, 3:02pm UTC](https://itensor.discourse.group/t/quanticstci-package/1641/6 "2024-04-19T15:02:54Z")

</div>

I see. So by “obtain” you mean “access the individual amplitudes of the ground state in a given basis”. I thought by obtain you meant obtaining an MPS representation of the ground state.

So yes, I do think TCI could be helpful for computing Sq. Here are the steps I would do:

1. use DMRG to find the ground state as an MPS
2. using the following code:  
[https://gitlab.com/tensors4fields/TensorCrossInterpolation.jl](https://gitlab.com/tensors4fields/TensorCrossInterpolation.jl)
3. create a function which obtains individual amplitudes of your ground state from the MPS individually, using a pattern similar to [the one in this code example](https://itensor.github.io/ITensors.jl/dev/examples/MPSandMPO.html#Obtaining-Elements-of-a-Tensor-Represented-by-an-MPS) where the “el” array would be the inputs to the function called by the TCI code
4. before returning the amplitude a, compute |a|^2 and return that from the function instead
5. if all goes well, you will now have an MPS which represents |\psi(s)|^2.
6. now you can use the `inner` function from ITensor to contract this MPS with itself to obtain the result \sum\_s |\psi(s)|^2 |\psi(s)|^2 = \sum\_s |\psi(s)|^4 and finally take the log of this number

If that works, it would be a very neat and interesting application of TCI!

---

<div class="post-metadata">

**Author:** ![Faridun](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@Faridun](https://itensor.discourse.group/u/Faridun)\
**Post date:** [April 23, 2024, 6:37pm UTC](https://itensor.discourse.group/t/quanticstci-package/1641/7 "2024-04-23T18:37:23Z")

</div>

Dear Miles,

Thank you for your reply.  
I would like to ask you about the step 3. Which function in the TCI code should I use to obtain individual amplitudes of your ground state from the MPS?  
I have found the `evaluate()` function and when I try to use this function with my MPS obtained from ITensors, it gives an error:

```julia
import TensorCrossInterpolation as TCI
using ITensors

N = 10
s = siteinds(2, N)
chi = 4
psi = randomMPS(s; linkdims=chi)

index1 = Index(2, "index1")  
index2 = Index(2, "index2") 
index3 = Index(2, "index3")  
index4 = Index(2, "index4") 
index5 = Index(2, "index5") 
index6 = Index(2, "index6")  
index7 = Index(2, "index7") 
index8 = Index(2, "index8")  
index9 = Index(2, "index9") 
index10 = Index(2, "index10") 
indexspecs = [(index1, 1), (index2, 2), (index3, 1), (index4, 1), (index5, 2), (index6, 1), (index7, 2), (index8, 2), (index9, 2), (index10, 1)] # el = [1,2,1,1,2,1,2,2,2,1] as in an example in ITensor

state = TCI.evaluate(psi, indexspecs)

MethodError: no method matching evaluate(::MPS, ::Vector{Tuple{Index{Int64}, Int64}})

```

Is it correct to use MPS obtained by using ITensors in the TCI code?  
Also, I have tried to put `el = [1,2,1,1,2,1,2,2,2,1]` to `evaluate(psi, el)` but the situation has not changed.

Thank you so much for your time.

Faridun
