Skip to content

KSL not running properly on docker #95

@emulvi

Description

@emulvi

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]

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions