Skip to content

Commit

Permalink
block IR should have nqubits, since it is supposed to be a pure quant…
Browse files Browse the repository at this point in the history
…um circuit
  • Loading branch information
Roger-luo committed May 10, 2021
1 parent f8956a5 commit 1687c22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,26 @@ struct Chain <: Routine
Chain(args...) = new(collect(Any, args))
end

# prop adjoint to leaves
Base.adjoint(c::Chain) = Chain(map(adjoint, c.args))

struct Gate <: Routine
operation # SSAValue/Routine
locations # SSAValue/Locations
end

Base.adjoint(x::Gate) = Gate(adjoint(x.operation), x.locations)

struct Ctrl <: Routine
gate::Gate
ctrl # SSAValue/CtrlLocation
end

Base.adjoint(x::Ctrl) = Ctrl(adjoint(x.gate), x.ctrl)

struct BlockIR
parent::CodeInfo
nqubits::Int
circuit::Chain
end

Expand Down

0 comments on commit 1687c22

Please sign in to comment.