-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take real, imag of Pow function. (#12)
* new subs * fix taking real for Pow function
- Loading branch information
Showing
6 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Yao, YaoExtensions, Test | ||
|
||
@vars α β γ | ||
c = chain(put(3, 2=>Rx(α)), control(3, 2, 1=>Ry(β)), put(3, (1,2)=>rot(kron(X, X), γ))) | ||
h = heisenberg(3); | ||
es = expect(h, zero_state(Basic, 3)=>c) | ||
gs = expect'(h, zero_state(Basic, 3)=>c).second | ||
assign = Dict(α=>0.5, β=>0.7, γ=>0.8) | ||
|
||
cn = subs(Float64, c, assign...) | ||
en = expect(h, zero_state(3)=>cn) | ||
gn = expect'(h, zero_state(3)=>cn).second | ||
es_ = subs(es, assign...) | ||
gs_ = map(x->subs(x, assign...), gs) | ||
@test ComplexF64.(gs_) ≈ gn | ||
@test ComplexF64(es_) ≈ en |
Submodule simplify
added at
841a84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters