Skip to content

Commit

Permalink
Fix expand on GPU (#85)
Browse files Browse the repository at this point in the history
* Fix expand on GPU

* Bump to v0.4.7
  • Loading branch information
mtfishman authored Jun 20, 2024
1 parent 6a404da commit 4e7e55e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name = "ITensorTDVP"
uuid = "25707e16-a4db-4a07-99d9-4d67b7af0342"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org> and contributors"]
version = "0.4.6"
version = "0.4.7"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
Expand All @@ -19,9 +21,11 @@ Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
ITensorTDVPObserversExt = "Observers"

[compat]
Adapt = "3, 4"
Compat = "4"
ITensors = "0.6.10"
KrylovKit = "0.6, 0.7, 0.8"
NDTensors = "0.3.31"
Observers = "0.2"
PackageExtensionCompat = "1"
TimerOutputs = "0.5"
Expand Down
6 changes: 5 additions & 1 deletion src/expand.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Adapt: adapt
using ITensors:
ITensors,
Algorithm,
Expand All @@ -15,6 +16,7 @@ using ITensors:
uniqueinds
using ITensors.ITensorMPS: MPO, MPS, apply, dim, linkind, maxlinkdim, orthogonalize
using LinearAlgebra: normalize, svd, tr
using NDTensors: unwrap_array_type

# Possible improvements:
# - Allow a maxdim argument to be passed to `expand`.
Expand Down Expand Up @@ -86,7 +88,9 @@ function expand(
_, λⱼ, basisⱼ = svd(state[j], linds; righttags="bψ_$j,Link")
rinds = uniqueinds(basisⱼ, λⱼ)
# Make projectorⱼ
idⱼ = prod(r -> denseblocks(δ(scalartype(state), r', dag(r))), rinds)
idⱼ = prod(rinds) do r
return adapt(unwrap_array_type(basisⱼ), denseblocks(δ(scalartype(state), r', dag(r))))
end
projectorⱼ = idⱼ - prime(basisⱼ, rinds) * dag(basisⱼ)
# Sum reference density matrices
ρⱼ = sum(reference -> prime(reference[j], rinds) * dag(reference[j]), references)
Expand Down

2 comments on commit 4e7e55e

@mtfishman
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109440

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.7 -m "<description of version>" 4e7e55e54e9519183b3eda28ac9e26fc7e587b8a
git push origin v0.4.7

Please sign in to comment.