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

[ITensorMPS] Fix some lingering namespace issues #1362

Merged
merged 6 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/comment_trigger_test_itensors_mps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.threads }} thread(s)
if: github.event.issue.pull_request && contains(github.event.comment.body, '[test ITensors mps]')
if: github.event.issue.pull_request && contains(github.event.comment.body, '[test ITensorMPS]')
emstoudenmire marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
env:
JULIA_NUM_THREADS: ${{ matrix.threads }}
Expand Down
5 changes: 3 additions & 2 deletions ITensorGaussianMPS/src/gmps.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Base: sortperm, size, length, eltype, conj, transpose, copy, *
using ITensors: alias
using ITensors.ITensorMPS: ITensorMPS
abstract type AbstractSymmetry end
struct ConservesNfParity{T} <: AbstractSymmetry
data::T
Expand Down Expand Up @@ -177,8 +178,8 @@ end

function quadratic_operator(os::OpSum)
os = deepcopy(os)
#os = ITensors.sorteachterm(os, sites)
os = ITensors.sortmergeterms(os)
#os = ITensorMPS.sorteachterm(os, sites)
os = ITensorMPS.sortmergeterms(os)

nterms = length(os)
coefs = Vector{Number}(undef, nterms)
Expand Down
1 change: 1 addition & 0 deletions src/ITensorMPS/abstractprojmpo/projmposum.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Compat: allequal

abstract type AbstractSum end

Expand Down
5 changes: 2 additions & 3 deletions src/ITensorMPS/dmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ function dmrg(
## into `DeviceMemory`. This conversion line is here temporarily to fix that problem when it arises
## Adapt is only called when using CUDA backend. CPU will work as implemented previously.
## TODO this might be the only place we really need iscu if its not fixed.
phi::ITensor = if NDTensors.iscu(phi) && NDTensors.iscu(vecs[1])
adapt(set_eltype(unwrap_array_type(phi), eltype(vecs[1])), vecs[1])
phi = if NDTensors.iscu(phi) && NDTensors.iscu(vecs[1])
adapt(ITensors.set_eltype(unwrap_array_type(phi), eltype(vecs[1])), vecs[1])
else
vecs[1]
end
#phi::ITensor = vecs[1]

ortho = ha == 1 ? "left" : "right"

Expand Down
3 changes: 2 additions & 1 deletion test/ITensorMPS/Ops/test_ops_mpo.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using ITensors
using ITensors.Ops
using ITensors.ITensorMPS: ITensorMPS
using LinearAlgebra

@testset "Ops to MPO" begin
Expand Down Expand Up @@ -42,7 +43,7 @@ using LinearAlgebra
ℋ_merged = OpSum()
ℋ_merged += (4, "Z", 1)
ℋ_merged += (3, "X", 2)
@test ITensors.sortmergeterms(ℋ) == ℋ_merged
@test ITensorMPS.sortmergeterms(ℋ) == ℋ_merged

# Test with repeated terms
s = siteinds("S=1/2", 1)
Expand Down
Loading