QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.

Home Page:https://yaoquantum.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

switch to YaoLocations

Roger-luo opened this issue · comments

currently, we are using NTuple{N, Int} to represent locations, this is becoming more and more inconvenient when developing YaoLang and the new emulation backend BQCESubroutines:

  1. the compiler needs a special type that will be treated as a primitive type during inference, so that we can apply special rules on Locations, e.g always constant prop and unroll Locations, unlike Tuple
  2. on the emulation side, because now we can create arbitrary kernel for matrix function, NTuple can cause ambiguity when there is a matrix function like following
@broutine a_bit_general_matrix(U::NTuple{4}) = [U[1] U[2];U[3] U[4]]

so now the package YaoLocations has been widely used inside YaoLang and BQCESubroutines at low level, I'm now thinking for the sake of consistency, we should start using it from YaoBlocks, YaoArrayRegisters - this won't change the user interface, but the only low-level interface, but I think will make things much easier for future work.

Another issue currently we have is the ambiguity caused by instruct! (over 100 ambiguities)

I think we will not update YaoArrayRegister to YaoLocations but will just switch to a new backend later to fully use YaoLocations since this is more compatible and easier to work on