QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.
https://yaoquantum.org
Other
918 stars 119 forks source link

new reflection gate #421

Closed GiggleLiu closed 2 years ago

GiggleLiu commented 2 years ago

In this PR, I define the Projector as $$|s\rangle \rightarrow |s\rangle \langle s|$$, ReflectGate as the time evolution over Projector: $$|v⟩ → 1 - (1-\exp(-iθ)) |v⟩⟨v|$$, where θ is the evolution time.

codecov[bot] commented 2 years ago

Codecov Report

Merging #421 (342422a) into master (2b76d47) will decrease coverage by 0.81%. The diff coverage is 92.00%.

@@            Coverage Diff             @@
##           master     #421      +/-   ##
==========================================
- Coverage   89.41%   88.60%   -0.82%     
==========================================
  Files          73       76       +3     
  Lines        4480     4555      +75     
==========================================
+ Hits         4006     4036      +30     
- Misses        474      519      +45     
Impacted Files Coverage Δ
lib/YaoBlocks/src/YaoBlocks.jl 100.00% <ø> (ø)
lib/YaoBlocks/src/primitive/const_gate_tools.jl 91.54% <ø> (ø)
lib/YaoBlocks/src/primitive/primitive.jl 100.00% <ø> (ø)
lib/YaoBlocks/src/primitive/projector.jl 89.47% <89.47%> (ø)
lib/YaoBlocks/src/outerproduct_and_projection.jl 91.11% <91.11%> (ø)
lib/YaoBlocks/src/primitive/general_matrix_gate.jl 100.00% <100.00%> (ø)
lib/YaoBlocks/src/primitive/reflect.jl 100.00% <100.00%> (ø)
...Blocks/src/autodiff/outerproduct_and_projection.jl 0.00% <0.00%> (-91.12%) :arrow_down:
lib/YaoBlocks/src/autodiff/chainrules_patch.jl 85.48% <0.00%> (+1.61%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

GiggleLiu commented 2 years ago

The new one is an alias of the time evolution over the reflection gate, while the old one in YaoExtensions is implemented as a new type. The new one is also more general, the evolution time $\theta$ can be not $\pi$.