Created
December 22, 2019 17:55
-
-
Save corba777/5d22cc85f644f59e72092fe5f59705d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| namespace Quantum.VariationalQuantumCircuits | |
| { | |
| open Microsoft.Quantum.Characterization; | |
| open Microsoft.Quantum.Intrinsic; | |
| open Microsoft.Quantum.Canon; | |
| operation Expval(cirq:((Double[],Qubit[])=>Unit is Adj),args:Double[],measurement:Pauli[], nQubits:Int) : Double { | |
| let rs= EstimateFrequencyA(cirq(args,_),Measure(measurement,_),nQubits,1000); | |
| return 2.*rs-1.; | |
| } | |
| operation Circuit(args:Double[],q:Qubit[]): Unit is Adj{ | |
| Rz(args[0],q[0]); | |
| CNOT(q[0],q[1]); | |
| Ry(args[1],q[1]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment