From 4b7235b36390f3b31499c55279a34ff3dfee5dfa Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 31 Mar 2026 20:42:18 +0200 Subject: [PATCH] fixed typos and incosistencies in documentation --- .../src/JordanWigner/OptimizedBlockEncoding.qs | 10 +++++----- library/chemistry/src/MixedStatePreparation.qs | 14 +++++++------- library/chemistry/src/Tests.qs | 4 ++-- library/fixed_point/src/Operations.qs | 2 +- library/fixed_point/src/Tests.qs | 4 ++-- library/qtest/src/Operations.qs | 6 +++--- library/signed/src/Measurement.qs | 2 +- library/signed/src/Operations.qs | 2 +- library/std/src/Std/ArithmeticUtils.qs | 4 ++-- library/std/src/Std/TableLookup.qs | 4 ++-- library/table_lookup/src/Lookup.qs | 8 ++++---- library/table_lookup/src/LookupViaPP.qs | 4 ++-- library/table_lookup/src/PhaseLookup.qs | 2 +- library/table_lookup/src/PowerProducts.qs | 4 ++-- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/library/chemistry/src/JordanWigner/OptimizedBlockEncoding.qs b/library/chemistry/src/JordanWigner/OptimizedBlockEncoding.qs index 9c2aa1c449..2e0580fc2c 100644 --- a/library/chemistry/src/JordanWigner/OptimizedBlockEncoding.qs +++ b/library/chemistry/src/JordanWigner/OptimizedBlockEncoding.qs @@ -114,7 +114,7 @@ function OptimizedBEGeneratorSystemCoeff(optimizedBEGeneratorSystem : OptimizedB /// `GeneratorIndex` representing a Z term. /// /// # Output -/// `GeneratorIndex[]` expressing Z term as Pauli terms. +/// `OptimizedBETermIndex` expressing Z term as Pauli terms. function ZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { let (_, coeff) = term.Term; let idxFermions = term.Subsystem; @@ -143,7 +143,7 @@ function ZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { /// `GeneratorIndex` representing a ZZ term. /// /// # Output -/// `GeneratorIndex[]` expressing ZZ term as Pauli terms. +/// `OptimizedBETermIndex` expressing ZZ term as Pauli terms. function ZZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { let (_, coeff) = term.Term; let idxFermions = term.Subsystem; @@ -172,7 +172,7 @@ function ZZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { /// `GeneratorIndex` representing a PQ term. /// /// # Output -/// `GeneratorIndex[]` expressing PQ term as Pauli terms. +/// `OptimizedBETermIndex` expressing PQ term as Pauli terms. function PQTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { let (_, coeff) = term.Term; let idxFermions = term.Subsystem; @@ -201,7 +201,7 @@ function PQTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { /// `GeneratorIndex` representing a PQ or PQQR term. /// /// # Output -/// `GeneratorIndex[]` expressing PQ or PQQR term as Pauli terms. +/// `OptimizedBETermIndex` expressing PQ or PQQR term as Pauli terms. function PQandPQQRTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex { let (_, coeff) = term.Term; let idxFermions = term.Subsystem; @@ -238,7 +238,7 @@ function PQandPQQRTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermInde /// `GeneratorIndex` representing a PQRS term. /// /// # Output -/// `GeneratorIndex[]` expressing PQRS term as Pauli terms. +/// `OptimizedBETermIndex[]` expressing PQRS term as Pauli terms. function V0123TermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex[] { let (_, v0123) = term.Term; let idxFermions = term.Subsystem; diff --git a/library/chemistry/src/MixedStatePreparation.qs b/library/chemistry/src/MixedStatePreparation.qs index 6e511c8637..0e23652f71 100644 --- a/library/chemistry/src/MixedStatePreparation.qs +++ b/library/chemistry/src/MixedStatePreparation.qs @@ -28,7 +28,7 @@ import Utils.RangeAsIntArray; /// state. /// ## Prepare /// An operation that, given an index register, a data register, and a -/// garbage register initially in the $\ket{0}$, $\let{00\dots 0}$, and +/// garbage register initially in the $\ket{0}$, $\ket{00\dots 0}$, and /// $\ket{00\dots 0}$ states (respectively), /// prepares the state represented by this UDT value on those registers. struct MixedStatePreparation { @@ -42,13 +42,13 @@ struct MixedStatePreparation { /// mixed state. /// /// # Input -/// ## NTotalQubits +/// ## NumTotalQubits /// The total number of qubits required by the represented state preparation /// operation. -/// ## NIndexQubits +/// ## NumIndexQubits /// The number of qubits required for the index register used by the /// represented state preparation operation. -/// ## NGarbageQubits +/// ## NumGarbageQubits /// The number of qubits required for the garbage register used by the /// represented state preparation operation. struct MixedStatePreparationRequirements { @@ -58,7 +58,7 @@ struct MixedStatePreparationRequirements { } /// # Summary -/// Returns an operation that prepares a a purification of a given mixed state. +/// Returns an operation that prepares a purification of a given mixed state. /// A "purified mixed state" refers to states of the form |ψ⟩ = Σᵢ √𝑝ᵢ |𝑖⟩ |garbageᵢ⟩ specified by a vector of /// coefficients {𝑝ᵢ}. States of this form can be reduced to mixed states ρ ≔ 𝑝ᵢ |𝑖⟩⟨𝑖| by tracing over the "garbage" /// register (that is, a mixed state that is diagonal in the computational basis). @@ -128,8 +128,8 @@ struct MixedStatePreparationRequirements { /// let coefficients = [1.0, 2.0, 3.0, 4.0, 5.0]; /// let targetError = 1e-3; /// let purifiedState = PurifiedMixedState(targetError, coefficients); -/// using (indexRegister = Qubit[purifiedState.Requirements.NIndexQubits]) { -/// using (garbageRegister = Qubit[purifiedState.Requirements.NGarbageQubits]) { +/// using (indexRegister = Qubit[purifiedState.Requirements.NumIndexQubits]) { +/// using (garbageRegister = Qubit[purifiedState.Requirements.NumGarbageQubits]) { /// purifiedState.Prepare(LittleEndian(indexRegister), [], garbageRegister); /// } /// } diff --git a/library/chemistry/src/Tests.qs b/library/chemistry/src/Tests.qs index ad388895e5..e558af15e3 100644 --- a/library/chemistry/src/Tests.qs +++ b/library/chemistry/src/Tests.qs @@ -81,7 +81,7 @@ operation OptimizedBEOperatorZeroTestHelper(pauliBasis : Pauli, targetRegisterSi } } else { - // Test Identitfy Pauli + // Test Identify Pauli // |0> -> |0> // |+> -> |+> Message($"Test ZI Pauli on qubit {idxTest}"); @@ -175,7 +175,7 @@ operation OptimizedBEOperatorPlusTestHelper(pauliBasis : Pauli, targetRegisterSi } } else { - // Test Identitfy Pauli + // Test Identify Pauli // |0> -> |0> // |+> -> |+> Message($"Test I Pauli on qubit {idxTest}"); diff --git a/library/fixed_point/src/Operations.qs b/library/fixed_point/src/Operations.qs index 2c24693d98..49f07c3f8a 100644 --- a/library/fixed_point/src/Operations.qs +++ b/library/fixed_point/src/Operations.qs @@ -165,4 +165,4 @@ export InvertFxP, SubtractFxP, MultiplyFxP, - SquareFxP; \ No newline at end of file + SquareFxP; diff --git a/library/fixed_point/src/Tests.qs b/library/fixed_point/src/Tests.qs index fa7e1466d2..53a9dc8d02 100644 --- a/library/fixed_point/src/Tests.qs +++ b/library/fixed_point/src/Tests.qs @@ -91,7 +91,7 @@ operation TestOperation(a : Double, b : Double, op : (FixedPoint, FixedPoint) => let expected = reference(a, b); let difference = expected - measured; - Fact(difference < 0.001, $"Difference of {difference} is outside of the expected range. Expected {expected} and measured result was {measured}. (Inputs were {name}({a}, {b})"); + Fact(difference < 0.001, $"Difference of {difference} is outside of the expected range. Expected {expected} and measured result was {measured}. (Inputs were {name}({a}, {b}))"); ResetAll(register1 + register2); } @@ -117,6 +117,6 @@ operation TestOperation3(a : Double, b : Double, op : (FixedPoint, FixedPoint, F let expected = reference(a, b); let difference = expected - measured; - Fact(difference < 0.001, $"Difference of {difference} is outside of the expected range. Expected {expected} and measured result was {measured}. (Inputs were {name}({a}, {b})"); + Fact(difference < 0.001, $"Difference of {difference} is outside of the expected range. Expected {expected} and measured result was {measured}. (Inputs were {name}({a}, {b}))"); ResetAll(register1 + register2); } \ No newline at end of file diff --git a/library/qtest/src/Operations.qs b/library/qtest/src/Operations.qs index 0408311b2c..4bdd8d86f9 100644 --- a/library/qtest/src/Operations.qs +++ b/library/qtest/src/Operations.qs @@ -35,9 +35,9 @@ operation CheckAllTestCases<'T : Eq + Show>(test_cases : (String, Int, Qubit[] = /// This is a good alternative to `CheckAllTestCases` when you want custom output based on the results of your tests, /// or more control over how test results are rendered. /// # Input -/// Takes a list of test cases. A test case is a tuple of `(String, () => 'T, 'T)`, where -/// the first String is the name of the test, the function is the test case itself, and the -/// final element of the tuple is the expected return value from the test case. +/// Takes a list of test cases. A test case is a tuple of `(String, Int, Qubit[] => Unit, Qubit[] => 'T, 'T)`, where +/// the first String is the name of the test, the Int is the number of qubits, the first operation prepares the state, +/// the second operation is the test case itself, and the final element is the expected return value. /// /// # Example /// ```qsharp diff --git a/library/signed/src/Measurement.qs b/library/signed/src/Measurement.qs index 95d0213c8b..55b3450444 100644 --- a/library/signed/src/Measurement.qs +++ b/library/signed/src/Measurement.qs @@ -47,4 +47,4 @@ operation MeasureSignedInteger(target : Qubit[], width : Int) : Int { number * coefficient } -export MeasureSignedInteger; \ No newline at end of file +export MeasureSignedInteger; diff --git a/library/signed/src/Operations.qs b/library/signed/src/Operations.qs index 929e4779eb..285f51a217 100644 --- a/library/signed/src/Operations.qs +++ b/library/signed/src/Operations.qs @@ -260,7 +260,7 @@ operation Invert2sSI(xs : Qubit[]) : Unit is Adj + Ctl { /// /// # Remarks /// Uses a standard shift-and-subtract approach to implement the division. -/// The controlled version is specialized such the subtraction does not +/// The controlled version is specialized such that the subtraction does not /// require additional controls. operation DivideI(xs : Qubit[], ys : Qubit[], result : Qubit[]) : Unit is Adj + Ctl { body (...) { diff --git a/library/std/src/Std/ArithmeticUtils.qs b/library/std/src/Std/ArithmeticUtils.qs index 6d70572375..4ea146c141 100644 --- a/library/std/src/Std/ArithmeticUtils.qs +++ b/library/std/src/Std/ArithmeticUtils.qs @@ -29,7 +29,7 @@ import /// Computation, Vol. 10, 2010. /// https://arxiv.org/abs/0910.2530 operation ApplyOuterTTKAdder(xs : Qubit[], ys : Qubit[]) : Unit is Adj + Ctl { - Fact(Length(xs) <= Length(ys), "Input register ys must be at lease as long as xs."); + Fact(Length(xs) <= Length(ys), "Input register ys must be at least as long as xs."); for i in 1..Length(xs) - 1 { CNOT(xs[i], ys[i]); } @@ -106,7 +106,7 @@ operation ApplyInnerTTKAdderWithCarry(xs : Qubit[], ys : Qubit[]) : Unit is Adj (Controlled ApplyInnerTTKAdderWithCarry)([], (xs, ys)); } controlled (controls, ...) { - Fact(Length(xs) + 1 == Length(ys), "ys must be one qubit longer then xs."); + Fact(Length(xs) + 1 == Length(ys), "ys must be one qubit longer than xs."); Fact(Length(xs) > 0, "Array should not be empty."); diff --git a/library/std/src/Std/TableLookup.qs b/library/std/src/Std/TableLookup.qs index d366f6fd12..ba7bb38162 100644 --- a/library/std/src/Std/TableLookup.qs +++ b/library/std/src/Std/TableLookup.qs @@ -303,7 +303,7 @@ operation PhaseLookup(qs : Qubit[], data : Bool[]) : Unit { let m2 = 1 <<< n2; Fact(m1 * m2 == m, "Length of halves must match total length."); - // Allocate auxilliary qubits + // Allocate auxiliary qubits use aux_qubits1 = Qubit[2^n1 - n1 - 1]; use aux_qubits2 = Qubit[2^n2 - n2 - 1]; @@ -361,7 +361,7 @@ operation ConstructPowerProducts(qubits : Qubit[], aux_qubits : Qubit[]) : Qubit power_products += [next_power_product]; } } - Fact(next_available == Length(aux_qubits), "All auxilliary qubits should be used."); + Fact(next_available == Length(aux_qubits), "All auxiliary qubits should be used."); return power_products; } diff --git a/library/table_lookup/src/Lookup.qs b/library/table_lookup/src/Lookup.qs index 2b8cfad06c..297405a5de 100644 --- a/library/table_lookup/src/Lookup.qs +++ b/library/table_lookup/src/Lookup.qs @@ -136,7 +136,7 @@ operation Lookup( ) : Unit is Adj + Ctl { body (...) { if (options.lookupAlgorithm == DoStdLookup()) { - // Don't do anthing beyond standard library select. + // Don't do anything beyond standard library select. Std.TableLookup.Select(data, address, target); return (); } @@ -181,7 +181,7 @@ operation Lookup( } if options.lookupAlgorithm == DoStdLookup() { - // Don't do anthing beyond standard library select. + // Don't do anything beyond standard library select. Controlled Std.TableLookup.Select(controls, (data, address, target)); return (); } @@ -242,7 +242,7 @@ operation Lookup( adjoint (...) { if (options.unlookupAlgorithm == DoStdUnlookup()) { - // Don't do anthing beyond standard library select. + // Don't do anything beyond standard library select. Adjoint Std.TableLookup.Select(data, address, target); return (); } @@ -280,7 +280,7 @@ operation Lookup( controlled adjoint (controls, ...) { if options.unlookupAlgorithm == DoStdUnlookup() { - // Don't do anthing beyond standard library select. + // Don't do anything beyond standard library select. Controlled Adjoint Std.TableLookup.Select(controls, (data, address, target)); return (); } diff --git a/library/table_lookup/src/LookupViaPP.qs b/library/table_lookup/src/LookupViaPP.qs index f1321ef8a5..3a6ef963de 100644 --- a/library/table_lookup/src/LookupViaPP.qs +++ b/library/table_lookup/src/LookupViaPP.qs @@ -37,7 +37,7 @@ operation LookupViaPP( data }; - // Allocate auxilliary qubits. + // Allocate auxiliary qubits. use aux_qubits = Qubit[GetAuxCountForPP(address_size)]; // Construct power products. @@ -91,7 +91,7 @@ operation LookupViaSplitPP( let m2 = 1 <<< n2; Fact(m1 * m2 == m, "Length of halves must match total length."); - // Allocate auxilliary qubits. + // Allocate auxiliary qubits. use aux_qubits1 = Qubit[2^n1 - n1 - 1]; use aux_qubits2 = Qubit[2^n2 - n2 - 1]; diff --git a/library/table_lookup/src/PhaseLookup.qs b/library/table_lookup/src/PhaseLookup.qs index 723fdca058..c12c160731 100644 --- a/library/table_lookup/src/PhaseLookup.qs +++ b/library/table_lookup/src/PhaseLookup.qs @@ -82,7 +82,7 @@ operation PhaseLookupViaSplitPP(address : Qubit[], data : Bool[]) : Unit { let m2 = 1 <<< n2; Fact(m1 * m2 == addressable_space, "Length of halves must match total length."); - // Allocate auxilliary qubits. + // Allocate auxiliary qubits. use aux_qubits1 = Qubit[GetAuxCountForPP(n1)]; use aux_qubits2 = Qubit[GetAuxCountForPP(n2)]; diff --git a/library/table_lookup/src/PowerProducts.qs b/library/table_lookup/src/PowerProducts.qs index fcb632faf9..24899b5709 100644 --- a/library/table_lookup/src/PowerProducts.qs +++ b/library/table_lookup/src/PowerProducts.qs @@ -42,7 +42,7 @@ operation ConstructPowerProducts(qubits : Qubit[], aux_qubits : Qubit[]) : Qubit power_products += [next_power_product]; } } - Fact(next_available == Length(aux_qubits), "ConstructPowerProducts: All auxilliary qubits should be used."); + Fact(next_available == Length(aux_qubits), "ConstructPowerProducts: All auxiliary qubits should be used."); return power_products; } @@ -102,7 +102,7 @@ function GetAuxCountForPP(nQubits : Int) : Int { // Tests internal operation ConstructDestructPowerProducts(qs : Qubit[]) : Unit { - // For monomials with more than one variable we need auxilliary qubits. + // For monomials with more than one variable we need auxiliary qubits. use aux_qubits = Qubit[GetAuxCountForPP(Length(qs))]; // Construct/destruct should leave qs unchanged.