Skip to content

Commit c9a9e6e

Browse files
authored
Improvements to Q# library documentation (#3083)
- fixed typos and inconsistencies in documentation - in some cases the same typos were copied/propagated to many places: - `auxilliary` instead of `auxiliary` - `anthing` instead of `anything` - `lease` instead of `least` - `Identitfy` instead of `Identify` - in some cases the symbol names in the docs did not match the actual symbols in the code There are no logical code changes here, it's only docs, so it should be sage to merge.
1 parent 111e4bd commit c9a9e6e

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

library/chemistry/src/JordanWigner/OptimizedBlockEncoding.qs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function OptimizedBEGeneratorSystemCoeff(optimizedBEGeneratorSystem : OptimizedB
114114
/// `GeneratorIndex` representing a Z term.
115115
///
116116
/// # Output
117-
/// `GeneratorIndex[]` expressing Z term as Pauli terms.
117+
/// `OptimizedBETermIndex` expressing Z term as Pauli terms.
118118
function ZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
119119
let (_, coeff) = term.Term;
120120
let idxFermions = term.Subsystem;
@@ -143,7 +143,7 @@ function ZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
143143
/// `GeneratorIndex` representing a ZZ term.
144144
///
145145
/// # Output
146-
/// `GeneratorIndex[]` expressing ZZ term as Pauli terms.
146+
/// `OptimizedBETermIndex` expressing ZZ term as Pauli terms.
147147
function ZZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
148148
let (_, coeff) = term.Term;
149149
let idxFermions = term.Subsystem;
@@ -172,7 +172,7 @@ function ZZTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
172172
/// `GeneratorIndex` representing a PQ term.
173173
///
174174
/// # Output
175-
/// `GeneratorIndex[]` expressing PQ term as Pauli terms.
175+
/// `OptimizedBETermIndex` expressing PQ term as Pauli terms.
176176
function PQTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
177177
let (_, coeff) = term.Term;
178178
let idxFermions = term.Subsystem;
@@ -201,7 +201,7 @@ function PQTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
201201
/// `GeneratorIndex` representing a PQ or PQQR term.
202202
///
203203
/// # Output
204-
/// `GeneratorIndex[]` expressing PQ or PQQR term as Pauli terms.
204+
/// `OptimizedBETermIndex` expressing PQ or PQQR term as Pauli terms.
205205
function PQandPQQRTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex {
206206
let (_, coeff) = term.Term;
207207
let idxFermions = term.Subsystem;
@@ -238,7 +238,7 @@ function PQandPQQRTermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermInde
238238
/// `GeneratorIndex` representing a PQRS term.
239239
///
240240
/// # Output
241-
/// `GeneratorIndex[]` expressing PQRS term as Pauli terms.
241+
/// `OptimizedBETermIndex[]` expressing PQRS term as Pauli terms.
242242
function V0123TermToPauliMajIdx(term : GeneratorIndex) : OptimizedBETermIndex[] {
243243
let (_, v0123) = term.Term;
244244
let idxFermions = term.Subsystem;

library/chemistry/src/MixedStatePreparation.qs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Utils.RangeAsIntArray;
2828
/// state.
2929
/// ## Prepare
3030
/// An operation that, given an index register, a data register, and a
31-
/// garbage register initially in the $\ket{0}$, $\let{00\dots 0}$, and
31+
/// garbage register initially in the $\ket{0}$, $\ket{00\dots 0}$, and
3232
/// $\ket{00\dots 0}$ states (respectively),
3333
/// prepares the state represented by this UDT value on those registers.
3434
struct MixedStatePreparation {
@@ -42,13 +42,13 @@ struct MixedStatePreparation {
4242
/// mixed state.
4343
///
4444
/// # Input
45-
/// ## NTotalQubits
45+
/// ## NumTotalQubits
4646
/// The total number of qubits required by the represented state preparation
4747
/// operation.
48-
/// ## NIndexQubits
48+
/// ## NumIndexQubits
4949
/// The number of qubits required for the index register used by the
5050
/// represented state preparation operation.
51-
/// ## NGarbageQubits
51+
/// ## NumGarbageQubits
5252
/// The number of qubits required for the garbage register used by the
5353
/// represented state preparation operation.
5454
struct MixedStatePreparationRequirements {
@@ -58,7 +58,7 @@ struct MixedStatePreparationRequirements {
5858
}
5959

6060
/// # Summary
61-
/// Returns an operation that prepares a a purification of a given mixed state.
61+
/// Returns an operation that prepares a purification of a given mixed state.
6262
/// A "purified mixed state" refers to states of the form |ψ⟩ = Σᵢ √𝑝ᵢ |𝑖⟩ |garbageᵢ⟩ specified by a vector of
6363
/// coefficients {𝑝ᵢ}. States of this form can be reduced to mixed states ρ ≔ 𝑝ᵢ |𝑖⟩⟨𝑖| by tracing over the "garbage"
6464
/// register (that is, a mixed state that is diagonal in the computational basis).
@@ -128,8 +128,8 @@ struct MixedStatePreparationRequirements {
128128
/// let coefficients = [1.0, 2.0, 3.0, 4.0, 5.0];
129129
/// let targetError = 1e-3;
130130
/// let purifiedState = PurifiedMixedState(targetError, coefficients);
131-
/// using (indexRegister = Qubit[purifiedState.Requirements.NIndexQubits]) {
132-
/// using (garbageRegister = Qubit[purifiedState.Requirements.NGarbageQubits]) {
131+
/// using (indexRegister = Qubit[purifiedState.Requirements.NumIndexQubits]) {
132+
/// using (garbageRegister = Qubit[purifiedState.Requirements.NumGarbageQubits]) {
133133
/// purifiedState.Prepare(LittleEndian(indexRegister), [], garbageRegister);
134134
/// }
135135
/// }

library/chemistry/src/Tests.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ operation OptimizedBEOperatorZeroTestHelper(pauliBasis : Pauli, targetRegisterSi
8181
}
8282
} else {
8383

84-
// Test Identitfy Pauli
84+
// Test Identify Pauli
8585
// |0> -> |0>
8686
// |+> -> |+>
8787
Message($"Test ZI Pauli on qubit {idxTest}");
@@ -175,7 +175,7 @@ operation OptimizedBEOperatorPlusTestHelper(pauliBasis : Pauli, targetRegisterSi
175175
}
176176

177177
} else {
178-
// Test Identitfy Pauli
178+
// Test Identify Pauli
179179
// |0> -> |0>
180180
// |+> -> |+>
181181
Message($"Test I Pauli on qubit {idxTest}");

library/fixed_point/src/Operations.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ export
165165
InvertFxP,
166166
SubtractFxP,
167167
MultiplyFxP,
168-
SquareFxP;
168+
SquareFxP;

library/fixed_point/src/Tests.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ operation TestOperation(a : Double, b : Double, op : (FixedPoint, FixedPoint) =>
9191

9292
let expected = reference(a, b);
9393
let difference = expected - measured;
94-
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})");
94+
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}))");
9595
ResetAll(register1 + register2);
9696
}
9797

@@ -117,6 +117,6 @@ operation TestOperation3(a : Double, b : Double, op : (FixedPoint, FixedPoint, F
117117

118118
let expected = reference(a, b);
119119
let difference = expected - measured;
120-
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})");
120+
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}))");
121121
ResetAll(register1 + register2);
122122
}

library/qtest/src/Operations.qs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ operation CheckAllTestCases<'T : Eq + Show>(test_cases : (String, Int, Qubit[] =
3535
/// This is a good alternative to `CheckAllTestCases` when you want custom output based on the results of your tests,
3636
/// or more control over how test results are rendered.
3737
/// # Input
38-
/// Takes a list of test cases. A test case is a tuple of `(String, () => 'T, 'T)`, where
39-
/// the first String is the name of the test, the function is the test case itself, and the
40-
/// final element of the tuple is the expected return value from the test case.
38+
/// Takes a list of test cases. A test case is a tuple of `(String, Int, Qubit[] => Unit, Qubit[] => 'T, 'T)`, where
39+
/// the first String is the name of the test, the Int is the number of qubits, the first operation prepares the state,
40+
/// the second operation is the test case itself, and the final element is the expected return value.
4141
///
4242
/// # Example
4343
/// ```qsharp

library/signed/src/Measurement.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ operation MeasureSignedInteger(target : Qubit[], width : Int) : Int {
4747
number * coefficient
4848
}
4949

50-
export MeasureSignedInteger;
50+
export MeasureSignedInteger;

library/signed/src/Operations.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ operation Invert2sSI(xs : Qubit[]) : Unit is Adj + Ctl {
260260
///
261261
/// # Remarks
262262
/// Uses a standard shift-and-subtract approach to implement the division.
263-
/// The controlled version is specialized such the subtraction does not
263+
/// The controlled version is specialized such that the subtraction does not
264264
/// require additional controls.
265265
operation DivideI(xs : Qubit[], ys : Qubit[], result : Qubit[]) : Unit is Adj + Ctl {
266266
body (...) {

library/std/src/Std/ArithmeticUtils.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import
2929
/// Computation, Vol. 10, 2010.
3030
/// https://arxiv.org/abs/0910.2530
3131
operation ApplyOuterTTKAdder(xs : Qubit[], ys : Qubit[]) : Unit is Adj + Ctl {
32-
Fact(Length(xs) <= Length(ys), "Input register ys must be at lease as long as xs.");
32+
Fact(Length(xs) <= Length(ys), "Input register ys must be at least as long as xs.");
3333
for i in 1..Length(xs) - 1 {
3434
CNOT(xs[i], ys[i]);
3535
}
@@ -106,7 +106,7 @@ operation ApplyInnerTTKAdderWithCarry(xs : Qubit[], ys : Qubit[]) : Unit is Adj
106106
(Controlled ApplyInnerTTKAdderWithCarry)([], (xs, ys));
107107
}
108108
controlled (controls, ...) {
109-
Fact(Length(xs) + 1 == Length(ys), "ys must be one qubit longer then xs.");
109+
Fact(Length(xs) + 1 == Length(ys), "ys must be one qubit longer than xs.");
110110
Fact(Length(xs) > 0, "Array should not be empty.");
111111

112112

library/std/src/Std/TableLookup.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ operation PhaseLookup(qs : Qubit[], data : Bool[]) : Unit {
303303
let m2 = 1 <<< n2;
304304
Fact(m1 * m2 == m, "Length of halves must match total length.");
305305

306-
// Allocate auxilliary qubits
306+
// Allocate auxiliary qubits
307307
use aux_qubits1 = Qubit[2^n1 - n1 - 1];
308308
use aux_qubits2 = Qubit[2^n2 - n2 - 1];
309309

@@ -361,7 +361,7 @@ operation ConstructPowerProducts(qubits : Qubit[], aux_qubits : Qubit[]) : Qubit
361361
power_products += [next_power_product];
362362
}
363363
}
364-
Fact(next_available == Length(aux_qubits), "All auxilliary qubits should be used.");
364+
Fact(next_available == Length(aux_qubits), "All auxiliary qubits should be used.");
365365
return power_products;
366366
}
367367

0 commit comments

Comments
 (0)