Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Define convert_itensor_eltype for MPS/MPO #804

Closed
mtfishman opened this issue Jan 20, 2022 · 0 comments
Closed

[ENHANCEMENT] Define convert_itensor_eltype for MPS/MPO #804

mtfishman opened this issue Jan 20, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mtfishman
Copy link
Member

using ITensors

convert_eltype(T, A::ITensor) = itensor(T.(NDTensors.tensor(A)))
convert_itensor_eltype(T, A::ITensors.AbstractMPS) = convert_eltype.(T, A)

s = siteinds("S=1/2", 4)
ψ = randomMPS(s)
ψ32 = convert_itensor_eltype(Float32, ψ)

Also not that in principle T.(A) should work to convert the ITensor element type, but there is a bug in broadcasting right now.

@mtfishman mtfishman added the enhancement New feature or request label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant