Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Error in the numpy backend svd_decomposition when max_singular_vals is larger than actual bond dimension #419

@orialb

Description

@orialb

Hi,
Currently the following code will throw an error:

from tensornetwork.backends.numpy.decompositions import svd_decomposition
import numpy as np

foo = np.random.rand(2,2,2,1)
svd_decomposition(np,foo,2,max_singular_values=30)

The reason is that np.linalg.svd returns the full U, V^\dagger matrices by default (unlike pytorch and TF which return the reduced SVD by default). Hence when only max_singular_values is specified and it is larger than min(rank(U),rank(V^\dagger)), svd_decompostion will try to reshape one of the matrices to the wrong shape (U in this case).

I will create a PR to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions