oseledets / oseledets/ttpy

KSL not running properly on docker

Open
#95 8 comments 0 reactions 1 assignee View on GitHub

@daskol is already working on this.

Since Dec 14, 2022.

bug
Dominant language
Python
Stars
264
Forks
73
PR merge metrics
No merged PRs in 30d

Description

After adding a random tt of rank 5+ as noise to a tt with rank 1 to reach a rank of 6+, when ksl propagates it on docker, the rank is 1 instead of maintaining the rank of the tt inputed to ksl.

For example, with the code:

    # initial tensor of up and down spins, will have rank 1
    spins = [np.array([0, 1]), np.array([1, 0])]
    initState = [1, 1, 0, 0, 1, 1, 0, 0]
    y0 = tt.tensor(spins[initState[0]])
    for i in range(1, 8):
        y0 = tt.kron(y0, tt.tensor(spins[initState[i]]))

    # hamiltonian, created in a separate function
    A = ham() 
        
    # loop to see behavior when the rank of the noise is increased
    for i in range(1, 7):
        print("i = ", i)

        # generate a random tensor with rank i
        tt_rand = tt.rand(y0.n, y0.d, i)
        tt_rand = tt_rand * tt_rand.norm()**(-1)

        # make the tt_rand a very small noise
        tt_rand = tt_rand * 10**(-1. * (10 + i))

        # add the random tensor to artificially increase the rank of y to 1 + i
        y = y0 + tt_rand
        y = y.round(10**(-1. * (30 + i)))

        print("rank before propagation = ", y.r)
        y = tt.ksl.ksl(A, y, 0.1)
        print("rank after propagation = ", y.r)`

The output with docker is:

i =  1
rank before propagation =  [1 2 2 2 2 2 2 2 1]
rank after propagation =  [1 2 2 2 2 2 2 2 1]
i =  2
rank before propagation =  [1 2 3 3 3 3 3 2 1]
rank after propagation =  [1 2 3 3 3 3 3 2 1]
i =  3
rank before propagation =  [1 2 4 4 4 4 4 2 1]
rank after propagation =  [1 2 3 4 4 4 4 2 1]
i =  4
rank before propagation =  [1 2 4 5 5 5 4 2 1]
rank after propagation =  [1 2 2 3 3 3 3 2 1]
i =  5
rank before propagation =  [1 2 4 6 6 6 4 2 1]
rank after propagation =  [1 1 1 1 1 1 1 1 1]
i =  6
rank before propagation =  [1 2 4 7 7 7 4 2 1]
rank after propagation =  [1 1 1 1 1 1 1 1 1]

Whereas the output with ttpy from github is:

i =  1
rank before propagation =  [1 2 2 2 2 2 2 2 1]
rank after propagation =  [1 2 2 2 2 2 2 2 1]
i =  2
rank before propagation =  [1 2 3 3 3 3 3 2 1]
rank after propagation =  [1 2 3 3 3 3 3 2 1]
i =  3
rank before propagation =  [1 2 4 4 4 4 4 2 1]
rank after propagation =  [1 2 4 4 4 4 4 2 1]
i =  4
rank before propagation =  [1 2 4 5 5 5 4 2 1]
rank after propagation =  [1 2 4 5 5 5 4 2 1]
i =  5
rank before propagation =  [1 2 4 6 6 6 4 2 1]
rank after propagation =  [1 2 4 6 6 6 4 2 1]
i =  6
rank before propagation =  [1 2 4 7 7 7 4 2 1]
rank after propagation =  [1 2 4 7 7 7 4 2 1]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.