-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Wietek
committed
Feb 10, 2025
1 parent
275e7c1
commit 1031955
Showing
9 changed files
with
21 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/Manifest.toml | ||
*.cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,16 @@ | ||
@testset "Op" begin | ||
op = Op("HOP", "T", [1, 2]) | ||
@test type(op) == "HOP" | ||
@test convert(String, coupling(op)) == "T" | ||
op = Op("Hop", [1, 2]) | ||
@test type(op) == "Hop" | ||
@test size(op) == 2 | ||
@test op[1] == 1 | ||
@test op[2] == 2 | ||
@test sites(op) == [1, 2] | ||
@test isexplicit(op) == false | ||
|
||
c = 1.23 | ||
op = Op("HOP", c, [1, 2]) | ||
@test type(op) == "HOP" | ||
@test convert(Float64, coupling(op)) == c | ||
op = Op("Hop", [1, 2]) | ||
@test type(op) == "Hop" | ||
@test size(op) == 2 | ||
@test op[1] == 1 | ||
@test op[2] == 2 | ||
@test sites(op) == [1, 2] | ||
@test isreal(op) == true | ||
@test ismatrix(op) == false | ||
@test isexplicit(op) == true | ||
|
||
c = 3.21 + 1.23im | ||
op = Op("HOP", c, [1, 2]) | ||
@test type(op) == "HOP" | ||
@test convert(ComplexF64, coupling(op)) == c | ||
@test size(op) == 2 | ||
@test op[1] == 1 | ||
@test op[2] == 2 | ||
@test sites(op) == [1, 2] | ||
@test isreal(op) == false | ||
@test ismatrix(op) == false | ||
@test isexplicit(op) == true | ||
|
||
c = [0 1; 1 0] | ||
op = Op("HOP", c, [1, 2]) | ||
@test type(op) == "HOP" | ||
@test convert(Matrix{Float64}, coupling(op)) == convert(Matrix{Float64}, c) | ||
@test size(op) == 2 | ||
@test op[1] == 1 | ||
@test op[2] == 2 | ||
@test sites(op) == [1, 2] | ||
@test isreal(op) == true | ||
@test ismatrix(op) == true | ||
@test isexplicit(op) == true | ||
|
||
c = [0 -im; im 0] | ||
op = Op("HOP", c, [1, 2]) | ||
@test type(op) == "HOP" | ||
@test convert(Matrix{ComplexF64}, coupling(op)) == convert(Matrix{ComplexF64}, c) | ||
@test size(op) == 2 | ||
@test op[1] == 1 | ||
@test op[2] == 2 | ||
@test sites(op) == [1, 2] | ||
@test isreal(op) == false | ||
@test ismatrix(op) == true | ||
@test isexplicit(op) == true | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
@testset "OpSum" begin | ||
op1 = Op("HOP", "T", [1, 2]) | ||
op2 = Op("HOP", "T", [2, 3]) | ||
ops = OpSum([op1, op2]) | ||
@test size(ops) == 2 | ||
ops += Op("HOP", "T", [3, 4]) | ||
@test size(ops) == 3 | ||
# @test isexplicit(ops) == false | ||
|
||
ops2 = OpSum() | ||
ops2 += Op("HB", "J", [1, 2]) | ||
ops2 += Op("HB", "J", [2, 3]) | ||
ops2 += Op("HB", "J", [4, 5]) | ||
J = 1.23 | ||
ops2["J"] = J | ||
@test convert(Float64, ops2["J"]) == J | ||
@test size(ops2) == 3 | ||
@test isexplicit(ops2) == false | ||
|
||
ops3 = OpSum() | ||
ops3 += Op("HB", 1.23, [0, 1]) | ||
ops3 += Op("HB", 1.23, [1, 2]) | ||
@test isexplicit(ops3) | ||
ops = OpSum() | ||
ops += "T" * Op("Hop", [1, 2]) | ||
ops += "T" * Op("Hop", [2, 3]) | ||
ops += "T" * Op("Hop", [3, 4]) | ||
ops["T"] = 1.0 | ||
@test isapprox(ops, hc(ops)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters