Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Simulation/TargetDefinitions/Decompositions/ExpFrac.qs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ namespace Microsoft.Quantum.Intrinsic {
/// Register to apply the given rotation to.
@EnableTestingViaName("Test.TargetDefinitions.ExpFrac")
operation ExpFrac (paulis : Pauli[], numerator : Int, power : Int, qubits : Qubit[]) : Unit is Adj + Ctl {
let angle = (PI() * IntAsDouble(numerator)) / IntAsDouble(2 ^ power);
// Note that power must be converted to a double and used with 2.0 instead of 2 to allow for
// negative exponents that result in a fractional denominator.
let angle = (PI() * IntAsDouble(numerator)) / (2.0 ^ IntAsDouble(power));
Exp(paulis, angle, qubits);
}
}
2 changes: 2 additions & 0 deletions src/Simulation/TargetDefinitions/Decompositions/RFrac.qs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace Microsoft.Quantum.Intrinsic {
/// ```
@EnableTestingViaName("Test.TargetDefinitions.RFrac")
operation RFrac (pauli : Pauli, numerator : Int, power : Int, qubit : Qubit) : Unit is Adj + Ctl {
// Note that power must be converted to a double and used with 2.0 instead of 2 to allow for
// negative exponents that result in a fractional denominator.
let angle = ((-2.0 * PI()) * IntAsDouble(numerator)) / (2.0 ^ IntAsDouble(power));
R(pauli, angle, qubit);
}
Expand Down