Skip to content

Commit

Permalink
Merge pull request #15 from QuantumBFS/roger/patch-2
Browse files Browse the repository at this point in the history
fix #189
  • Loading branch information
GiggleLiu authored May 2, 2019
2 parents 45ca579 + c2e3574 commit 466f4fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/instruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ end

YaoBase.instruct!(state::AbstractVecOrMat, U::IMatrix, locs::NTuple{N, Int}) where N = state
YaoBase.instruct!(state::AbstractVecOrMat, U::IMatrix, locs::Int) = state
YaoBase.instruct!(state::AbstractVecOrMat, U::IMatrix, locs::Tuple{Int}) = state

# one-qubit instruction
YaoBase.instruct!(state::AbstractVecOrMat{T}, g::AbstractMatrix{T}, locs::Tuple{Int}) where T =
YaoBase.instruct!(state::AbstractVecOrMat, g::AbstractMatrix, locs::Tuple{Int}) =
instruct!(state, g, locs...)

function YaoBase.instruct!(state::AbstractVecOrMat{T}, U1::AbstractMatrix{T}, loc::Int) where T
Expand Down
5 changes: 5 additions & 0 deletions test/instruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ end
ST = randn(ComplexF64, 1 << 2)
@test instruct!(copy(ST), Val(:SWAP), (1, 2)) SWAP * ST
end

@testset "Yao.jl/#189" begin
st = rand(1<<4)
@test instruct!(st, IMatrix{2, Float64}(), 1) == st
end

0 comments on commit 466f4fb

Please sign in to comment.