forked from qutip/QuantumToolbox.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Divide some tests into sub-testsets (qutip#186)
- Loading branch information
Showing
10 changed files
with
884 additions
and
810 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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Aqua, JET | ||
|
||
@testset "Code quality" verbose = true begin | ||
@testset "Aqua.jl" begin | ||
Aqua.test_all(QuantumToolbox; ambiguities = false) | ||
end | ||
|
||
@testset "JET.jl" begin | ||
JET.test_package(QuantumToolbox; target_defined_modules = true, ignore_missing_comparison = true) | ||
end | ||
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 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,32 +1,34 @@ | ||
@testset "Negativity and Partial Transpose" begin | ||
# tests for negativity | ||
rho = (1 / 40) * Qobj( | ||
[ | ||
15 1 1 15 | ||
1 5 -3 1 | ||
1 -3 5 1 | ||
15 1 1 15 | ||
]; | ||
dims = [2, 2], | ||
) | ||
Neg = negativity(rho, 1) | ||
@test Neg ≈ 0.25 | ||
@test negativity(rho, 2) ≈ Neg | ||
@test negativity(rho, 1; logarithmic = true) ≈ log2(2 * Neg + 1) | ||
@test_throws ArgumentError negativity(rho, 3) | ||
@testset "Negativity and Partial Transpose" verbose = true begin | ||
@testset "negativity" begin | ||
rho = (1 / 40) * Qobj( | ||
[ | ||
15 1 1 15 | ||
1 5 -3 1 | ||
1 -3 5 1 | ||
15 1 1 15 | ||
]; | ||
dims = [2, 2], | ||
) | ||
Neg = negativity(rho, 1) | ||
@test Neg ≈ 0.25 | ||
@test negativity(rho, 2) ≈ Neg | ||
@test negativity(rho, 1; logarithmic = true) ≈ log2(2 * Neg + 1) | ||
@test_throws ArgumentError negativity(rho, 3) | ||
end | ||
|
||
# tests for partial transpose (PT) | ||
# A (24 * 24)-matrix which contains number 1 ~ 576 | ||
A_dense = Qobj(reshape(1:(24^2), (24, 24)), dims = [2, 3, 4]) | ||
A_sparse = dense_to_sparse(A_dense) | ||
PT = (true, false) | ||
for s1 in PT | ||
for s2 in PT | ||
for s3 in PT | ||
mask = [s1, s2, s3] | ||
@test partial_transpose(A_dense, mask) == partial_transpose(A_sparse, mask) | ||
@testset "partial_transpose" begin | ||
# A (24 * 24)-matrix which contains number 1 ~ 576 | ||
A_dense = Qobj(reshape(1:(24^2), (24, 24)), dims = [2, 3, 4]) | ||
A_sparse = dense_to_sparse(A_dense) | ||
PT = (true, false) | ||
for s1 in PT | ||
for s2 in PT | ||
for s3 in PT | ||
mask = [s1, s2, s3] | ||
@test partial_transpose(A_dense, mask) == partial_transpose(A_sparse, mask) | ||
end | ||
end | ||
end | ||
@test_throws ArgumentError partial_transpose(A_dense, [true]) | ||
end | ||
@test_throws ArgumentError partial_transpose(rho, [true]) | ||
end |
Oops, something went wrong.