There are a few places with sub-optimal type definitions, like e.g.:
struct Shadow
n_qubits::Int
gate::Array{Yao.AbstractBlock}
measure::Array{Int8} # is this always a vector or can this be any dimensionality?
end
should really be
struct Shadow{G<:AbstractBlock}
n_qubits::Int
gate::G
measure::Vector{Int8}
end
in order to make Shadow a proper concrete type that the julia compiler can work with optimally. without the parametric type G julia will always have to do dynamic dispatch (during runtime = slow) because the concrete type of the Shadow is not inferable (the gate can be any type of AbstractBlock)
There are a few places with sub-optimal type definitions, like e.g.:
should really be
in order to make Shadow a proper concrete type that the julia compiler can work with optimally. without the parametric type
Gjulia will always have to do dynamic dispatch (during runtime = slow) because the concrete type of the Shadow is not inferable (the gate can be any type of AbstractBlock)