-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into lift-dev-hecke
- Loading branch information
Showing
10 changed files
with
175 additions
and
100 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 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 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 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,26 +1,29 @@ | ||
@testitem "JET checks" tags=[:jet] begin | ||
using JET | ||
using ArrayInterface | ||
using Static | ||
using Graphs | ||
using StridedViews | ||
using LinearAlgebra | ||
using AbstractAlgebra, Hecke | ||
using JET | ||
using Test | ||
using ArrayInterface | ||
using Static | ||
using Graphs | ||
using StridedViews | ||
using LinearAlgebra | ||
using Nemo | ||
using AbstractAlgebra | ||
using Hecke | ||
|
||
rep = report_package("QuantumClifford"; | ||
ignored_modules=( | ||
AnyFrameModule(Graphs.LinAlg), | ||
AnyFrameModule(Graphs.SimpleGraphs), | ||
AnyFrameModule(ArrayInterface), | ||
AnyFrameModule(Static), | ||
AnyFrameModule(StridedViews), | ||
AnyFrameModule(LinearAlgebra), | ||
AnyFrameModule(Nemo), | ||
AnyFrameModule(AbstractAlgebra), | ||
AnyFrameModule(Hecke), | ||
)) | ||
|
||
rep = report_package("QuantumClifford"; | ||
ignored_modules=( | ||
AnyFrameModule(Graphs.LinAlg), | ||
AnyFrameModule(Graphs.SimpleGraphs), | ||
AnyFrameModule(ArrayInterface), | ||
AnyFrameModule(Static), | ||
AnyFrameModule(StridedViews), | ||
AnyFrameModule(LinearAlgebra), | ||
AnyFrameModule(Hecke), | ||
AnyFrameModule(AbstractAlgebra), | ||
) | ||
) | ||
@show rep | ||
@test_broken length(JET.get_reports(rep)) == 0 | ||
@test length(JET.get_reports(rep)) <= 23 | ||
@show rep | ||
@test_broken length(JET.get_reports(rep)) == 0 | ||
@test length(JET.get_reports(rep)) <= 11 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,73 @@ | ||
@testitem "throws" begin | ||
using QuantumClifford: rank, mul_left!, mul_right! | ||
using InteractiveUtils: subtypes | ||
using QuantumClifford: rank, mul_left!, mul_right! | ||
using InteractiveUtils: subtypes | ||
|
||
@test_throws DimensionMismatch CliffordOperator(T"XXX ZZ_") | ||
@test_throws DimensionMismatch CliffordOperator(T"XXX ZZ_") | ||
|
||
@test_throws DimensionMismatch tCNOT*S"X" | ||
@test_throws DimensionMismatch tCNOT*S"X" | ||
|
||
#@test_throws DomainError bigram(random_stabilizer(50), clip=false) | ||
#@test_throws DomainError bigram(random_stabilizer(50), clip=false) | ||
|
||
@test_throws DomainError logdot(S"XX", S"XX ZZ") | ||
@test_throws DimensionMismatch logdot(S"X", S"XX ZZ") | ||
@test_throws DomainError logdot(S"XX", S"XX ZZ") | ||
@test_throws DimensionMismatch logdot(S"X", S"XX ZZ") | ||
|
||
@test_throws BadDataStructure rank(S"X") | ||
@test_throws BadDataStructure rank(Destabilizer(S"X")) | ||
@test_throws BadDataStructure rank(S"X") | ||
@test_throws BadDataStructure rank(Destabilizer(S"X")) | ||
|
||
@test_throws DimensionMismatch mul_left!(P"X", P"XX") | ||
@test_throws DimensionMismatch mul_right!(P"X", P"XX") | ||
@test_throws DimensionMismatch mul_left!(P"X", P"XX") | ||
@test_throws DimensionMismatch mul_right!(P"X", P"XX") | ||
|
||
@test_throws ArgumentError StabMixture(S"XX") | ||
@test_throws ArgumentError StabMixture(S"XX") | ||
|
||
@test_throws ArgumentError UnitaryPauliChannel([P"X"], [1,2]) | ||
@test_throws ArgumentError UnitaryPauliChannel([P"X",P"XX"], [1,2]) | ||
@test_throws ArgumentError UnitaryPauliChannel([P"X"], [1,2]) | ||
@test_throws ArgumentError UnitaryPauliChannel([P"X",P"XX"], [1,2]) | ||
|
||
@test_throws ArgumentError embed(10,2,P"XX") | ||
@test_throws ArgumentError embed(10,[2,3],P"X") | ||
@test_throws ArgumentError embed(10,2,P"XX") | ||
@test_throws ArgumentError embed(10,[2,3],P"X") | ||
|
||
struct A <: QuantumClifford.AbstractOperation end | ||
@test_throws ArgumentError applybranches(S"X",A()) | ||
struct A <: QuantumClifford.AbstractOperation end | ||
@test_throws ArgumentError applybranches(S"X",A()) | ||
|
||
@test_throws BadDataStructure project!(Destabilizer(S"XX"), P"ZZ") | ||
@test_throws BadDataStructure project!(Destabilizer(S"XX"), P"ZZ") | ||
|
||
@test_throws DimensionMismatch reset_qubits!(ghz(4), ghz(3), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(ghz(3), ghz(4), [1,2,3,4]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedStabilizer(ghz(4)), MixedStabilizer(ghz(3)), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedStabilizer(ghz(3)), MixedStabilizer(ghz(4)), [1,2,3,4]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedDestabilizer(ghz(4)), MixedDestabilizer(ghz(3)), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedDestabilizer(ghz(3)), MixedDestabilizer(ghz(4)), [1,2,3,4]) | ||
@test_throws DimensionMismatch reset_qubits!(ghz(4), ghz(3), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(ghz(3), ghz(4), [1,2,3,4]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedStabilizer(ghz(4)), MixedStabilizer(ghz(3)), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedStabilizer(ghz(3)), MixedStabilizer(ghz(4)), [1,2,3,4]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedDestabilizer(ghz(4)), MixedDestabilizer(ghz(3)), [1,2]) | ||
@test_throws DimensionMismatch reset_qubits!(MixedDestabilizer(ghz(3)), MixedDestabilizer(ghz(4)), [1,2,3,4]) | ||
|
||
#TODO broken in other ways @test_throws DomainError MixedDestabilizer(Destabilizer(S"XX")) | ||
#TODO broken in other ways @test_throws DomainError MixedDestabilizer(Destabilizer(S"XX")) | ||
|
||
@test_throws DomainError 2*P"X" | ||
@test_throws DomainError 2*P"X" | ||
|
||
@test_throws DimensionMismatch P"X" * S"XX" | ||
@test_throws DimensionMismatch P"X" * S"XX" | ||
|
||
@test_throws ArgumentError one(typeof(T"X"), 1, basis=:U) | ||
@test_throws ArgumentError one(typeof(T"X"), 1, basis=:U) | ||
|
||
for gt in subtypes(QuantumClifford.AbstractSingleQubitOperator) | ||
gt == SingleQubitOperator && continue | ||
@test_throws ArgumentError gt(0) | ||
@test_throws ArgumentError gt(-1) | ||
end | ||
@test_throws ArgumentError SparseGate(random_clifford(2), [1, 2, 3]) | ||
@test_throws ArgumentError apply!(random_stabilizer(2), SparseGate(random_clifford(3), [1, 2, 3])) | ||
|
||
for gt in subtypes(QuantumClifford.AbstractTwoQubitOperator) | ||
@test_throws ArgumentError gt(0,1) | ||
@test_throws ArgumentError gt(-1,1) | ||
@test_throws ArgumentError gt(2,2) | ||
end | ||
for gt in subtypes(QuantumClifford.AbstractSingleQubitOperator) | ||
gt == SingleQubitOperator && continue | ||
@test_throws ArgumentError gt(0) | ||
@test_throws ArgumentError gt(-1) | ||
end | ||
|
||
for gt in subtypes(QuantumClifford.AbstractTwoQubitOperator) | ||
@test_throws ArgumentError gt(0,1) | ||
@test_throws ArgumentError gt(-1,1) | ||
@test_throws ArgumentError gt(2,2) | ||
end | ||
|
||
for m in [sMX,sMZ,sMY,sMRX,sMRZ,sMRY] | ||
@test_throws ArgumentError m(0) | ||
@test_throws ArgumentError m(-1) | ||
@test_throws ArgumentError m(0,1) | ||
@test_throws ArgumentError m(-1,0) | ||
end | ||
|
||
@test_throws DimensionMismatch Stabilizer(fill(0x0, 2), Matrix{Bool}([1 0 1;1 1 1; 1 0 1]), Matrix{Bool}([1 0 0;1 1 1;1 0 1])) | ||
@test_throws DimensionMismatch Stabilizer(fill(0x0, 2), Matrix{Bool}([1 0 1 1 0 0; 1 1 1 1 1 1; 1 0 1 1 0 1])) | ||
|
||
for m in [sMX,sMZ,sMY,sMRX,sMRZ,sMRY] | ||
@test_throws ArgumentError m(0) | ||
@test_throws ArgumentError m(-1) | ||
@test_throws ArgumentError m(0,1) | ||
@test_throws ArgumentError m(-1,0) | ||
end | ||
end |