QuantumBFS / YaoLang.jl

YaoLang: The next DSL for Yao and quantum programs.
https://yaoquantum.org/YaoLang.jl/dev/
Apache License 2.0
31 stars 6 forks source link

inconsistent design of measure instruction #12

Closed GiggleLiu closed 4 years ago

GiggleLiu commented 4 years ago
            ck = @measure (i, j, k) repeat(3, H)

Maybe

            ck = @measure (i, j, k) => repeat(3, H)

is better?

Roger-luo commented 4 years ago

Measurement operator is separated from normal circuits in semantic (thus it can be other things than a Circuit object, e.g an AbstractBlock), since measurement operator is not the same as a quantum circuit in practice, where the gate location semantic (aka <location> => <circuit>) enforce it has to be a Circuit so things like location mapping etc. would happen

GiggleLiu commented 4 years ago

ok. Not fully convinced, but sounds like not a big issue. Close?

Roger-luo commented 4 years ago

note repeat(3, H) is currently not a legal quantum circuit statement in YaoIR, If we want @measure (i, j, k) => repeat(3, H) this means the compiler will infer whatever inside @measure statement to be a pure circuit to make sure it is unitary, and we will lose all the support for Hamiltonians from YaoBlocks, to summarize:

  1. @measure statement requires an operator, which should be strictly a unitary, which will be guaranteed and supported by runtime check and YaoBlocks
  2. gate location statement requires a strict quantum program constraint (which can be a hybrid program) that the compiler will guarantee.

I'm closing this since it's a feature.