Skip to content

Commit

Permalink
Bump version. Add tests for contraction bug. Add tests for extended S…
Browse files Browse the repository at this point in the history
…pectrum definition (#432)
  • Loading branch information
mtfishman authored Jun 18, 2020
1 parent 7bbd001 commit 28a7fa3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensors"
uuid = "9136182c-28ba-11e9-034c-db9fb085ebd5"
authors = ["mfishman <[email protected]>"]
version = "0.1.10"
version = "0.1.11"

[deps]
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Expand All @@ -17,7 +17,7 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
julia = "1.4"
HDF5 = "0.13.1"
KrylovKit = "0.4.2"
NDTensors = "0.1.9"
NDTensors = "0.1.10"
StaticArrays = "0.12.3"
TimerOutputs = "0.5.5"

Expand Down
4 changes: 4 additions & 0 deletions test/decomp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ using ITensors,
@test entropy(Spectrum([0.5; 0.5], 0.0)) == log(2)
@test entropy(Spectrum([1.0], 0.0)) == 0.0
@test entropy(Spectrum([0.0], 0.0)) == 0.0

@test isnothing(eigs(Spectrum(nothing, 1.0)))
@test_throws ErrorException entropy(Spectrum(nothing, 1.0))
@test truncerror(Spectrum(nothing, 1.0)) == 1.0
end
end

Expand Down
51 changes: 42 additions & 9 deletions test/itensor.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ITensors,
Test
import Random
using Combinatorics: permutations

Random.seed!(12345)

Expand Down Expand Up @@ -260,19 +261,51 @@ end
R = mul!(copy(C), A, B, α, β)
@test α*A*B+β*C R

@testset "In-place bug" begin
l1 = Index(3, "l=1")
l2 = Index(3, "l=2")
s = Index(2, "s")
@testset "In-place bugs" begin

A = randomITensor(s', s)
B = randomITensor(l1, s, l2)
@testset "Bug 1" begin
l1 = Index(3, "l=1")
l2 = Index(3, "l=2")
s = Index(2, "s")

C = randomITensor(l1, s', l2)
A = randomITensor(s', s)
B = randomITensor(l1, s, l2)

C .= A .* B
C = randomITensor(l1, s', l2)

C .= A .* B

@test C A * B
end

@testset "Bug 2" begin
is = [Index(n+1, "i$n") for n in 1:6]

for ais in permutations((1, 2, 3)),
bis in permutations((2, 3, 4)),
cis in permutations((1, 4))
A = randomITensor(ntuple(i->is[ais[i]], Val(length(ais))))
B = randomITensor(ntuple(i->is[bis[i]], Val(length(bis))))
C = randomITensor(ntuple(i->is[cis[i]], Val(length(cis))))

C .= A .* B

@test C A * B
end

for ais in permutations((1, 2, 3)),
bis in permutations((2, 3, 4, 5)),
cis in permutations((1, 4, 5))
A = randomITensor(ntuple(i->is[ais[i]], Val(length(ais))))
B = randomITensor(ntuple(i->is[bis[i]], Val(length(bis))))
C = randomITensor(ntuple(i->is[cis[i]], Val(length(cis))))

C .= A .* B

@test C A * B
end
end

@test C A * B
end

@testset "In-place outer bug" begin
Expand Down

2 comments on commit 28a7fa3

@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/16598

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.1.11 -m "<description of version>" 28a7fa38025e95e9e38496e2023f443d9ba37a25
git push origin v0.1.11

Please sign in to comment.