Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fix warnings QS3302-3303 (deprecated || and &&) (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcNickolas authored Apr 16, 2019
1 parent 9128297 commit 963ed6d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Measurements/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace Quantum.Kata.Measurements {

mutable firstDiff = -1;
for (i in 0 .. Length(bits1) - 1) {
if (bits1[i] != bits2[i] && firstDiff == -1) {
if (bits1[i] != bits2[i] and firstDiff == -1) {
set firstDiff = i;
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace Quantum.Kata.Measurements {
}
}

if (countOnes > 1 && countOnes < Length(qs)) {
if (countOnes > 1 and countOnes < Length(qs)) {
fail $"Impossible to get {countOnes} Ones when measuring W state or GHZ state on {N} qubits";
}
if (countOnes == 1) {
Expand Down
8 changes: 4 additions & 4 deletions Measurements/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ namespace Quantum.Kata.Measurements {
let ans = testImpl(qs[0]);

// check that the answer is actually in allowed range
if (ans < -1 || ans > 1) {
if (ans < -1 or ans > 1) {
fail $"state {state} led to invalid response {ans}.";
}

Expand All @@ -473,16 +473,16 @@ namespace Quantum.Kata.Measurements {
set nInconc = nInconc + 1;
}

if (ans == 0 && state == 0) {
if (ans == 0 and state == 0) {
set nConclOne = nConclOne + 1;
}

if (ans == 1 && state == 1) {
if (ans == 1 and state == 1) {
set nConclPlus = nConclPlus + 1;
}

// check if upon conclusive result the answer is actually correct
if (ans == 0 && state == 1 || ans == 1 && state == 0) {
if (ans == 0 and state == 1 or ans == 1 and state == 0) {
fail $"state {state} led to incorrect conclusive response {ans}.";
}

Expand Down
2 changes: 1 addition & 1 deletion PhaseEstimation/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace Quantum.Kata.PhaseEstimation {

// repeat the loop until we get both Zero and One measurement outcomes
// or until we're reasonably certain that we won't get a different outcome
} until (iter == 10 || nZero > 0 && nOne > 0)
} until (iter == 10 or nZero > 0 and nOne > 0)
fixup {}

Reset(eigenstate);
Expand Down
6 changes: 3 additions & 3 deletions QEC_BitFlipCode/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ namespace Quantum.Kata.QEC_BitFlipCode {
let m1 = Measure([PauliZ, PauliZ], register[0 .. 1]);
let m2 = Measure([PauliZ, PauliZ], register[1 .. 2]);

if (m1 == One && m2 == Zero) {
if (m1 == One and m2 == Zero) {
return 1;
}

if (m1 == One && m2 == One) {
if (m1 == One and m2 == One) {
return 2;
}

if (m1 == Zero && m2 == One) {
if (m1 == Zero and m2 == One) {
return 3;
}

Expand Down
2 changes: 1 addition & 1 deletion QEC_BitFlipCode/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace Quantum.Kata.QEC_BitFlipCode {
function FindFirstDiff_Reference (bits1 : Int[], bits2 : Int[]) : Int {
mutable firstDiff = -1;
for (i in 0 .. Length(bits1) - 1) {
if (bits1[i] != bits2[i] && firstDiff == -1) {
if (bits1[i] != bits2[i] and firstDiff == -1) {
set firstDiff = i;
}
}
Expand Down
4 changes: 2 additions & 2 deletions SolveSATWithGrover/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace Quantum.Kata.GroversAlgorithm {

// ------------------------------------------------------
function And (args : Bool[]) : Bool {
return args[0] && args[1];
return args[0] and args[1];
}

operation T11_Oracle_And_Test () : Unit {
Expand All @@ -83,7 +83,7 @@ namespace Quantum.Kata.GroversAlgorithm {

// ------------------------------------------------------
function Or (args : Bool[]) : Bool {
return args[0] || args[1];
return args[0] or args[1];
}

operation T12_Oracle_Or_Test () : Unit {
Expand Down
4 changes: 2 additions & 2 deletions Superposition/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ namespace Quantum.Kata.Superposition {
function FindFirstDiff_Reference (bits1 : Bool[], bits2 : Bool[]) : Int {
mutable firstDiff = -1;
for (i in 0 .. Length(bits1) - 1) {
if (bits1[i] != bits2[i] && firstDiff == -1) {
if (bits1[i] != bits2[i] and firstDiff == -1) {
set firstDiff = i;
}
}
Expand Down Expand Up @@ -482,7 +482,7 @@ namespace Quantum.Kata.Superposition {
// measure ancilla qubits; if all of the results are Zero, we get the right state on main qubits
mutable allZeros = true;
for (i in 0 .. (P - N) - 1) {
set allZeros = allZeros && IsResultZero(M(anc[i]));
set allZeros = allZeros and IsResultZero(M(anc[i]));
}
}
until (allZeros)
Expand Down
6 changes: 3 additions & 3 deletions UnitaryPatterns/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ namespace Quantum.Kata.UnitaryPatterns {

// ------------------------------------------------------
function XWing_Fighter_Pattern (size : Int, row : Int, col : Int) : Bool {
return row == col || row == (size - 1) - col;
return row == col or row == (size - 1) - col;
}


Expand All @@ -245,8 +245,8 @@ namespace Quantum.Kata.UnitaryPatterns {
// ------------------------------------------------------
function Rhombus_Pattern (size : Int, row : Int, col : Int) : Bool {
let s2 = size / 2;
return row / s2 == col / s2 && row % s2 + col % s2 == s2 - 1 ||
row / s2 != col / s2 && row % s2 == col % s2;
return row / s2 == col / s2 and row % s2 + col % s2 == s2 - 1 or
row / s2 != col / s2 and row % s2 == col % s2;
}


Expand Down

0 comments on commit 963ed6d

Please sign in to comment.