Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DoubleAsStringWithPrecision function - Single Qubit Gate #1884

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ namespace Kata.Verification {
let reference = register => AmplitudeChange(alpha, register[0]);
let isCorrect = CheckOperationsAreEqualStrict(1, solution, reference);
if not isCorrect {
let precision = 3;
Message("Incorrect.");
Message($"The solution was incorrect for the test case alpha = {alpha}.");
Message($"The solution was incorrect for the test case alpha = {DoubleAsStringWithPrecision(alpha, precision)}.");
Message("Hint: examine the effect your solution has on the state 0.6|0〉 + 0.8|1〉 and compare it with the effect it " +
"is expected to have.");
ShowQuantumStateComparison(1, qs => Ry(ArcTan2(0.8, 0.6) * 2.0, qs[0]), solution, reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ namespace Kata.Verification {
let reference = register => PhaseChange(alpha, register[0]);
let isCorrect = CheckOperationsAreEqualStrict(1, solution, reference);
if not isCorrect {
let precision = 3;
Message("Incorrect.");
Message($"The solution was incorrect for the test case alpha = {alpha}.");
Message($"The solution was incorrect for the test case alpha = {DoubleAsStringWithPrecision(alpha, precision)}.");
Message("Hint: examine the effect your solution has on the state 0.6|0〉 + 0.8|1〉 and compare it with the effect it " +
"is expected to have.");
ShowQuantumStateComparison(1, qs => Ry(ArcTan2(0.8, 0.6) * 2.0, qs[0]), solution, reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ namespace Kata.Verification {
let reference = register => PrepareArbitraryState(alpha, beta, theta, register[0]);
let isCorrect = CheckOperationsEquivalenceOnZeroStateStrict(solution, reference, 1);
if not isCorrect {
let precision = 3;
Message("Incorrect.");
Message($"The solution was incorrect for the test case alpha = {alpha}, beta = {beta}, theta = {theta}.");
Message($"The solution was incorrect for the test case alpha = {DoubleAsStringWithPrecision(alpha, precision)}, beta = {DoubleAsStringWithPrecision(beta, precision)}, theta = {DoubleAsStringWithPrecision(theta, precision)}.");
Message("Hint: examine the state prepared by your solution and compare it with the state it " +
"is expected to prepare.");
ShowQuantumStateComparison(1, qs => (), solution, reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ namespace Kata.Verification {
let reference = register => PrepareRotatedState(alpha, beta, register[0]);
let isCorrect = CheckOperationsEquivalenceOnZeroStateStrict(solution, reference, 1);
if not isCorrect {
let precision = 3;
Message("Incorrect.");
Message($"The solution was incorrect for the test case alpha = {alpha}, beta = {beta}.");
Message($"The solution was incorrect for the test case alpha = {DoubleAsStringWithPrecision(alpha, precision)}, beta = {DoubleAsStringWithPrecision(beta, precision)}.");
Message("Hint: examine the state prepared by your solution and compare it with the state it " +
"is expected to prepare.");
ShowQuantumStateComparison(1, qs => (), solution, reference);
Expand Down
Loading