diff --git a/compiler/qsc_doc_gen/src/generate_docs/tests.rs b/compiler/qsc_doc_gen/src/generate_docs/tests.rs index 9308e0a678..b24f920e27 100644 --- a/compiler/qsc_doc_gen/src/generate_docs/tests.rs +++ b/compiler/qsc_doc_gen/src/generate_docs/tests.rs @@ -24,7 +24,7 @@ fn docs_generation() { qsharp.kind: function qsharp.namespace: Microsoft.Quantum.Core qsharp.name: Length - qsharp.summary: "Returns the number of elements in an array." + qsharp.summary: "Returns the number of elements in the input array `a`." --- # Length function @@ -36,14 +36,19 @@ fn docs_generation() { ``` ## Summary - Returns the number of elements in an array. + Returns the number of elements in the input array `a`. ## Input ### a Input array. ## Output - The total count of elements in an array. + The total number of elements in the input array `a`. + + ## Example + ```qsharp + Message($"{ Length([0, 0, 0]) }"); // Prints 3 + ``` "#]] .assert_eq(full_contents.as_str()); } diff --git a/compiler/qsc_eval/src/tests.rs b/compiler/qsc_eval/src/tests.rs index 479ccbddef..1d74c7ba37 100644 --- a/compiler/qsc_eval/src/tests.rs +++ b/compiler/qsc_eval/src/tests.rs @@ -439,16 +439,16 @@ fn block_qubit_use_array_invalid_count_expr() { 0, ), span: Span { - lo: 1566, - hi: 1623, + lo: 2034, + hi: 2091, }, }, ), [ Frame { span: Span { - lo: 1566, - hi: 1623, + lo: 2034, + hi: 2091, }, id: StoreItemId { package: PackageId( diff --git a/library/README.md b/library/README.md index de906317db..23dce7d6ed 100644 --- a/library/README.md +++ b/library/README.md @@ -19,3 +19,30 @@ One notable exception to this is the `Microsoft.Quantum.Core.Length` function, w The library includes a set of one- and two-qubit gates represented as `__quantum__qis__*__body` or `__quantum__qis__*__adj` QIR declarations. The expectation is that these gates form a common QIR API surface that Q# is compiled into. Any target would either need to support these quantum gate instructions natively or provide a QIR definition of that gate instruction in terms of supported native gates. These definitions can then be linked with the QIR program via LLVM tools and resolve to the target specific gate set. This approach provides broader compatibility at the QIR level and avoids the need for front end language targetting; as a result, this Q# library design is not expected to require any target packages or operation substitution. To avoid using any opaque array types in the quantum gate instruction set, the library utilizes decomposition strategies to express the Q# controlled specialization (which allows an arbitrary number of controls) in terms of singly- and doubly-controlled gates. While this makes simulation somewhat more expensive in terms of allocating extra controls and performing more operations, it more closely matches the patterns used by hardware and provides better API surface for QIR programs to have hardware compatibility. + +### Doc comments + +Use the following guidance when providing doc comments for functions and operations in the standard library. These doc comments are used to generate standard library documentation automatically. + +| Section | LaTeX allowed? | Mandatory? | What is it for +|---------------:|:--------------:|:----------:|---------------- +| Summary | No | Yes | Short summary of the functionality provided. +| Description | Yes | No | Detailed explanation of the functionality provided. +| Remarks | Yes | No | General knowledge that may be useful for understanding of the functionality provided. +| Type Parameters| No | No | Description of type parameters (for each type parameter). +| Input | No | No | Description of input parameters (for each input parameter) +| Output | No | No | Description of the output. +| Example | No | No | Example(s) of use. Should be a code fragment that compiles. +| References | No | No | References to papers and other information published on the web or elsewhere. +| See Also | No | No | References to other functions of the standard library that are similar or relevant. + +* Only `Summary` section is mandatory. There's no need to include other + sections just to repeat the information that is already stated in the summary. +* For sections where LaTeX is not allowed, Unicode characters may be used + to represent mathematical formulas even though it is not recommended in + general. These sections are used in places where LaTeX rendering is + not supported. +* For sections where LaTeX is supported, unicode characters may be used to + represent mathematical formulas only if the rendering fidelity is + not compromised. +* Use playground to check documentation rendering. diff --git a/library/core/core.qs b/library/core/core.qs index b8abde5509..c3dec923e8 100644 --- a/library/core/core.qs +++ b/library/core/core.qs @@ -3,20 +3,32 @@ namespace Microsoft.Quantum.Core { /// # Summary - /// Returns the number of elements in an array. + /// Returns the number of elements in the input array `a`. /// /// # Input /// ## a /// Input array. /// /// # Output - /// The total count of elements in an array. + /// The total number of elements in the input array `a`. + /// + /// # Example + /// ```qsharp + /// Message($"{ Length([0, 0, 0]) }"); // Prints 3 + /// ``` function Length<'T>(a : 'T[]) : Int { body intrinsic; } /// # Summary - /// Creates an array of given length with all elements equal to given value. + /// Creates an array of given `length` with all elements equal to given + /// `value`. `length` must be a non-negative integer. + /// + /// # Description + /// Use this function to create an array of length `length` where each + /// element is equal to `value`. This way of creating an array is preferred + /// over other methods if all elements of the array must be the same and + /// the length is known upfront. /// /// # Input /// ## value @@ -28,8 +40,8 @@ namespace Microsoft.Quantum.Core { /// A new array of length `length`, such that every element is `value`. /// /// # Example - /// The following code creates an array of 3 Boolean values, each equal to `true`: /// ```qsharp + /// // Create an array of 3 Boolean values, each equal to `true` /// let array = Repeated(true, 3); /// ``` function Repeated<'T>(value : 'T, length : Int) : 'T[] { diff --git a/library/std/arrays.qs b/library/std/arrays.qs index beffbc38cc..f5fe24496f 100644 --- a/library/std/arrays.qs +++ b/library/std/arrays.qs @@ -203,7 +203,7 @@ namespace Microsoft.Quantum.Arrays { /// /// # Example /// ```qsharp - /// let evensCount = Count(x -> x % 2 == 0, [1, 3, 6, 7, 9]); + /// let evensCount = Count(x -> x % 2 == 0, [1, 3, 6, 7, 9]); /// // evensCount is 1. /// ``` function Count<'T>(predicate : ('T -> Bool), array : 'T[]) : Int { diff --git a/library/std/canon.qs b/library/std/canon.qs index 8b1d62a345..7116b8c10a 100644 --- a/library/std/canon.qs +++ b/library/std/canon.qs @@ -173,10 +173,12 @@ namespace Microsoft.Quantum.Canon { /// This operation can be simulated by the unitary matrix /// $$ /// \begin{align} - /// 1 & 0 & 0 & 0 \\\\ - /// 0 & 1 & 0 & 0 \\\\ - /// 0 & 0 & 0 & -i \\\\ - /// 0 & 0 & i & 0 + /// \left(\begin{matrix} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 0 & -i \\\\ + /// 0 & 0 & i & 0 + /// \end{matrix}\right) /// \end{align}, /// $$ /// where rows and columns are organized as in the quantum concepts guide. @@ -208,10 +210,12 @@ namespace Microsoft.Quantum.Canon { /// This operation can be simulated by the unitary matrix /// $$ /// \begin{align} - /// 1 & 0 & 0 & 0 \\\\ - /// 0 & 1 & 0 & 0 \\\\ - /// 0 & 0 & 1 & 0 \\\\ - /// 0 & 0 & 0 & -1 + /// \left(\begin{matrix} + /// 1 & 0 & 0 & 0 \\\\ + /// 0 & 1 & 0 & 0 \\\\ + /// 0 & 0 & 1 & 0 \\\\ + /// 0 & 0 & 0 & -1 + /// \end{matrix}\right) /// \end{align}, /// $$ /// where rows and columns are organized as in the quantum concepts guide. @@ -432,8 +436,17 @@ namespace Microsoft.Quantum.Canon { } /// # Summary - /// Applies a unitary operation on the target, - /// controlled on a state specified by a given bit mask. + /// Applies `oracle` on `target` when `controlRegister` + /// is in the state specified by `bits`. + /// + /// # Description + /// Applies a unitary operation `oracle` on the `target`, controlled + /// on a state specified by a given bit mask `bits`. + /// The bit at `bits[i]` corresponds to qubit at `controlRegister[i]`. + /// The pattern given by `bits` may be shorter than `controlRegister`, + /// in which case additional control qubits are ignored (that is, neither + /// controlled on |0āŸ© nor |1āŸ©). + /// If `bits` is longer than `controlRegister`, an error is raised. /// /// # Input /// ## bits @@ -445,14 +458,16 @@ namespace Microsoft.Quantum.Canon { /// ## controlRegister /// A quantum register that controls application of `oracle`. /// - /// # Remarks - /// The pattern given by `bits` may be shorter than `controlRegister`, - /// in which case additional control qubits are ignored (that is, neither - /// controlled on $\ket{0}$ nor $\ket{1}$). - /// If `bits` is longer than `controlRegister`, an error is raised. - /// - /// For example, `bits = [0,1,0,0,1]` means that `oracle` is applied if and only if `controlRegister` - /// is in the state $\ket{0}\ket{1}\ket{0}\ket{0}\ket{1}$. + /// # Example + /// ```qsharp + /// // When bits = [1,0,0] oracle is applied if and only if controlRegister + /// // is in the state |100āŸ©. + /// use t = Qubit(); + /// use c = Qubit[3]; + /// X(c[0]); + /// ApplyControlledOnBitString([true, false, false], X, c, t); + /// Message($"{M(t)}"); // Prints `One` since oracle `X` was applied. + /// ``` operation ApplyControlledOnBitString<'T>( bits : Bool[], oracle : ('T => Unit is Adj + Ctl), diff --git a/library/std/convert.qs b/library/std/convert.qs index a2b3659bcc..db5c86278b 100644 --- a/library/std/convert.qs +++ b/library/std/convert.qs @@ -6,13 +6,27 @@ namespace Microsoft.Quantum.Convert { open Microsoft.Quantum.Math; /// # Summary - /// Converts a given integer to an equivalent double-precision floating-point number. + /// Converts a given integer `number` to an equivalent + /// double-precision floating-point number. + /// + /// # Description + /// Converts a given integer to a double-precision floating point number. + /// Please note that the double-precision representation may have fewer + /// bits allocated to represent [significant digits](https://en.wikipedia.org/wiki/Significand) + /// so the conversion may be approximate for large numbers. For example, + /// the current simulator converts 4,611,686,018,427,387,919 = 2^64+15 + /// to 4,611,686,018,427,387,904.0 = 2^64. + /// + /// # Example + /// ```qsharp + /// Message($"{IntAsDouble(1)}"); // Prints 1.0 rather than 1 + /// ``` function IntAsDouble(number : Int) : Double { body intrinsic; } /// # Summary - /// Converts a given integer to an equivalent big integer. + /// Converts a given integer `number` to an equivalent big integer. function IntAsBigInt(number : Int) : BigInt { body intrinsic; } @@ -48,7 +62,8 @@ namespace Microsoft.Quantum.Convert { } /// # Summary - /// Produces a non-negative integer from a string of bits in little endian format. + /// Produces a non-negative integer from a string of bits in little-endian format. + /// `bits[0]` represents the least significant bit. /// /// # Input /// ## bits diff --git a/library/std/core.qs b/library/std/core.qs index 8442c91202..93c477db35 100644 --- a/library/std/core.qs +++ b/library/std/core.qs @@ -19,11 +19,15 @@ namespace Microsoft.Quantum.Core { /// /// Note that the defined start value of a range is the same as the first element of the sequence, /// unless the range specifies an empty sequence (for example, 2 .. 1). + /// + /// # Example + /// ```qsharp + /// Message($"{ RangeStart(7..-1..3) }"); // Prints 7 + /// ``` function RangeStart(r : Range) : Int { r::Start } - /// # Summary /// Returns the defined end value of the given range, /// which is not necessarily the last element in the sequence. diff --git a/library/std/logical.qs b/library/std/logical.qs index 5008a37add..8ff39f9315 100644 --- a/library/std/logical.qs +++ b/library/std/logical.qs @@ -4,7 +4,8 @@ namespace Microsoft.Quantum.Logical { /// # Summary - /// Returns the boolean exclusive disjunction (XOR) of two input boolean values. + /// Returns the boolean exclusive disjunction (eXclusive OR, XOR) + /// of two input boolean values. /// /// # Input /// ## first @@ -16,9 +17,11 @@ namespace Microsoft.Quantum.Logical { /// # Output /// A `Bool` which is `true` if and only if exactly one of `first` and `second` is `true`. /// + /// # Remarks + /// In Q#, `Xor(a, b)` is equivalent to `a != b`. + /// /// # Example /// ```qsharp - /// /// let result = Xor(true, false); /// // result is true /// ``` diff --git a/library/std/math.qs b/library/std/math.qs index fd59370132..0dc774d4b7 100644 --- a/library/std/math.qs +++ b/library/std/math.qs @@ -10,11 +10,16 @@ namespace Microsoft.Quantum.Math { // /// # Summary - /// Represents the ratio of the circumference of a circle to its diameter. + /// Returns a double-precision approximation of the + /// matematical constant š… ā‰ˆ 3.14159265358979323846 /// - /// # Output - /// A double-precision approximation of the circumference of a circle - /// to its diameter, Ļ€ ā‰ˆ 3.14159265358979323846. + /// # Remarks + /// Mathematical constant š… represents the ratio of the circumference + /// of a circle to its diameter. It is useful in many applications + /// such as rotations and complex arithmetic. + /// + /// # References + /// [Wikipedia article - Pi](https://en.wikipedia.org/wiki/Pi) /// /// # See Also /// - Microsoft.Quantum.Math.E @@ -23,11 +28,15 @@ namespace Microsoft.Quantum.Math { } /// # Summary - /// Returns the natural logarithmic base to double-precision. + /// Returns a double-precision approximation of the + /// mathematical constant š’† ā‰ˆ 2.7182818284590452354 /// - /// # Output - /// A double-precision approximation of the natural logarithmic base, - /// e ā‰ˆ 2.7182818284590452354. + /// # Remarks + /// Mathematical constant š’† is the base of the natural logarithm + /// also known as the Euler's number + /// + /// # References + /// [Wikipedia article - e](https://en.wikipedia.org/wiki/E_(mathematical_constant)) /// /// # See Also /// - Microsoft.Quantum.Math.PI @@ -36,10 +45,14 @@ namespace Microsoft.Quantum.Math { } /// # Summary - /// Returns the natural logarithm of 2. + /// Returns a double-precision approximation of the constant + /// 揑2 ā‰ˆ 0.6931471805599453 /// - /// # Output - /// Returns a `Double` equal to 0.6931471805599453. + /// # Remarks + /// 揑2 is the natural logarithm of 2, or the logarithm of 2 base š’†. + /// + /// # References + /// [Wikipedia article - Natural logarithm](https://en.wikipedia.org/wiki/Natural_logarithm) function LogOf2() : Double { 0.6931471805599453 } @@ -383,7 +396,7 @@ namespace Microsoft.Quantum.Math { /// # Summary /// Returns the nearest integer to the specified number. - /// For example: Floor(3.7) = 4; Floor(-3.7) = -4 + /// For example: Round(3.7) = 4; Round(-3.7) = -4 function Round(value : Double) : Int { let (truncated, remainder, isPositive) = ExtendedTruncation(value); if AbsD(remainder) <= 1e-15 { diff --git a/library/std/measurement.qs b/library/std/measurement.qs index 70c7faccaa..8b9f6ec172 100644 --- a/library/std/measurement.qs +++ b/library/std/measurement.qs @@ -13,23 +13,31 @@ namespace Microsoft.Quantum.Measurement { /// # Description /// Measures a register of qubits in the `Z āŠ— Z āŠ— ā€¢ā€¢ā€¢ āŠ— Z` /// basis, representing the parity of the entire register. + /// This operation does not reset the measured qubits to the |0āŸ© state, + /// leaving them in the state that corresponds to the measurement result. /// /// # Input /// ## register - /// The register to be measured. + /// The register to be jointly measured. /// /// # Output - /// The result of measuring `Z āŠ— Z āŠ— ā€¢ā€¢ā€¢ āŠ— Z`. + /// The result of measuring in the `Z āŠ— Z āŠ— ā€¢ā€¢ā€¢ āŠ— Z` basis. /// - /// # Remarks - /// This operation does not reset the measured qubits to the |0āŸ© state, - /// leaving them in the state that corresponds to the measurement result. + /// # See also + /// - Microsoft.Quantum.Measurement.MeasureEachZ operation MeasureAllZ(register : Qubit[]) : Result { Measure(Repeated(PauliZ, Length(register)), register) } /// # Summary /// Measures each qubit in a given array in the standard basis. + /// + /// # Description + /// Measures each qubit in a register in the `Z` basis + /// and retuns the result of each measurement. + /// This operation does not reset the measured qubits to the |0āŸ© state, + /// leaving them in the state that corresponds to the measurement results. + /// /// # Input /// ## targets /// An array of qubits to be measured. @@ -37,8 +45,17 @@ namespace Microsoft.Quantum.Measurement { /// An array of measurement results. /// /// # Remarks - /// This operation does not reset the measured qubits to the |0āŸ© state, - /// leaving them in the state that corresponds to the measurement results. + /// Please note the following differences: + /// - Operation `MeasureEachZ` performs one measurement for each qubit and retuns + /// an array of results. The operation does not reset the qubits. + /// - Operation `MResetEachZ` performs one measurement for each qubit and retuns + /// an array of results. The operation resets all qubits to |0āŸ© state. + /// - Operation `MeasureAllZ` performs a joint measurement on all qubits + /// and returns one result. The operation does not reset the qubits. + /// + /// # See also + /// - Microsoft.Quantum.Measurement.MeasureAllZ + /// - Microsoft.Quantum.Measurement.MResetEachZ operation MeasureEachZ(register : Qubit[]) : Result[] { mutable results = []; for qubit in register { @@ -50,11 +67,16 @@ namespace Microsoft.Quantum.Measurement { /// # Summary /// Measures each qubit in a given array in the Z basis /// and resets them to a fixed initial state. + /// /// # Input /// ## targets /// An array of qubits to be measured. + /// /// # Output /// An array of measurement results. + /// + /// # See also + /// - Microsoft.Quantum.Measurement.MeasureEachZ operation MResetEachZ(register : Qubit[]) : Result[] { mutable results = []; for qubit in register { diff --git a/library/std/random.qs b/library/std/random.qs index f28f9e13d9..c568ccbcb2 100644 --- a/library/std/random.qs +++ b/library/std/random.qs @@ -4,7 +4,8 @@ namespace Microsoft.Quantum.Random { /// # Summary - /// Draws a random integer in a given inclusive range. + /// Draws a random integer from a uniform distribution + /// in a given inclusive range. Fails if `max < min`. /// /// # Input /// ## min @@ -16,9 +17,6 @@ namespace Microsoft.Quantum.Random { /// An integer in the inclusive range from `min` to `max` with uniform /// probability. /// - /// # Remarks - /// Fails if `max < min`. - /// /// # Example /// The following Q# snippet randomly rolls a six-sided die: /// ```qsharp @@ -30,7 +28,8 @@ namespace Microsoft.Quantum.Random { } /// # Summary - /// Draws a random real number in a given inclusive interval. + /// Draws a random real number from a uniform distribution + /// in a given inclusive interval. Fails if `max < min`. /// /// # Input /// ## min @@ -42,9 +41,6 @@ namespace Microsoft.Quantum.Random { /// A random real number in the inclusive interval from `min` to `max` with /// uniform probability. /// - /// # Remarks - /// Fails if `max < min`. - /// /// # Example /// The following Q# snippet randomly draws an angle between 0 and 2Ļ€: /// ```qsharp diff --git a/library/std/re.qs b/library/std/re.qs index af29c0c098..433b5aea62 100644 --- a/library/std/re.qs +++ b/library/std/re.qs @@ -127,7 +127,6 @@ namespace Microsoft.Quantum.ResourceEstimation { } /// # Summary - /// /// Instructs the resource estimator to assume that the resources from the /// call of this operation until a call to `EndRepeatEstimates` are /// accounted for `count` times, without the need to execute the code that many @@ -150,7 +149,6 @@ namespace Microsoft.Quantum.ResourceEstimation { } /// # Summary - /// /// Companion operation to `BeginRepeatEstimates`. operation EndRepeatEstimates() : Unit { body ... { @@ -164,7 +162,6 @@ namespace Microsoft.Quantum.ResourceEstimation { } /// # Summary - /// /// Instructs the resource estimator to assume that the resources from the /// call of this operation until a call to `Adjoint RepeatEstimates` are /// accounted for `count` times, without the need to execute the code that many diff --git a/library/std/unstable_arithmetic.qs b/library/std/unstable_arithmetic.qs index 4841801318..4269e934ac 100644 --- a/library/std/unstable_arithmetic.qs +++ b/library/std/unstable_arithmetic.qs @@ -36,16 +36,14 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// where each |iāŸ© is a basis state representing an integer i, /// reflects the state of the register about the basis state |jāŸ© /// for a given integer j: āˆ‘įµ¢(-1)^(Ī“įµ¢ā±¼)(Ī±įµ¢|iāŸ©) + /// This operation is implemented in-place, without explicit allocation of + /// additional auxiliary qubits. /// /// # Input /// ## index /// The classical integer j indexing the basis state about which to reflect. /// ## reg /// Little-endian quantum register to reflect. - /// - /// # Remarks - /// This operation is implemented in-place, without explicit allocation of - /// additional auxiliary qubits. operation ReflectAboutInteger(index : Int, reg : Qubit[]) : Unit is Adj + Ctl { within { // Evaluation optimization for case index == 0 @@ -147,10 +145,9 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// qubits otherwise. /// /// # References - /// - [arXiv:0910.2530](https://arxiv.org/abs/0910.2530) - /// "Quantum Addition Circuits and Unbounded Fan-Out" - /// by Yasuhiro Takahashi, Seiichiro Tani, Noboru Kunihiro - /// + /// - [arXiv:0910.2530](https://arxiv.org/abs/0910.2530) + /// "Quantum Addition Circuits and Unbounded Fan-Out", + /// Yasuhiro Takahashi, Seiichiro Tani, Noboru Kunihiro operation RippleCarryTTKIncByLE(xs : Qubit[], ys : Qubit[]) : Unit is Adj + Ctl { let xsLen = Length(xs); let ysLen = Length(ys); @@ -198,8 +195,8 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// This operation uses the ripple-carry algorithm. /// /// # Reference - /// - [arXiv:1709.06648](https://arxiv.org/pdf/1709.06648.pdf) - /// "Halving the cost of quantum addition" by Craig Gidney. + /// - [arXiv:1709.06648](https://arxiv.org/pdf/1709.06648.pdf) + /// "Halving the cost of quantum addition", Craig Gidney. operation RippleCarryCGIncByLE(xs : Qubit[], ys : Qubit[]) : Unit is Adj + Ctl { let xsLen = Length(xs); let ysLen = Length(ys); @@ -255,8 +252,8 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// NOTE: `zs[Length(xs)]` can be used as carry-out, if `zs` is longer than `xs`. /// /// # Reference - /// - [arXiv:1709.06648](https://arxiv.org/pdf/1709.06648.pdf) - /// "Halving the cost of quantum addition" by Craig Gidney. + /// - [arXiv:1709.06648](https://arxiv.org/pdf/1709.06648.pdf) + /// "Halving the cost of quantum addition", Craig Gidney. operation RippleCarryCGAddLE(xs : Qubit[], ys : Qubit[], zs : Qubit[]) : Unit is Adj { let xsLen = Length(xs); let zsLen = Length(zs); @@ -289,9 +286,9 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// This operation uses the carry-lookahead algorithm. /// /// # Reference - /// - [arXiv:quant-ph/0406142](https://arxiv.org/abs/quant-ph/0406142) - /// "A logarithmic-depth quantum carry-lookahead adder" by - /// Thomas G. Draper, Samuel A. Kutin, Eric M. Rains, Krysta M. Svore + /// - [arXiv:quant-ph/0406142](https://arxiv.org/abs/quant-ph/0406142) + /// "A logarithmic-depth quantum carry-lookahead adder", + /// Thomas G. Draper, Samuel A. Kutin, Eric M. Rains, Krysta M. Svore operation LookAheadDKRSAddLE(xs : Qubit[], ys : Qubit[], zs : Qubit[]) : Unit is Adj { let xsLen = Length(xs); let zsLen = Length(zs); @@ -338,8 +335,8 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// This operation uses Quantum Fourier Transform. /// /// # Reference - /// - [arXiv:quant-ph/0008033](https://arxiv.org/abs/quant-ph/0008033) - /// "Addition on a Quantum Computer" by Thomas G. Draper + /// - [arXiv:quant-ph/0008033](https://arxiv.org/abs/quant-ph/0008033) + /// "Addition on a Quantum Computer", Thomas G. Draper operation FourierTDIncByLE(xs : Qubit[], ys : Qubit[]) : Unit is Adj + Ctl { within { ApplyQFT(ys); @@ -430,9 +427,9 @@ namespace Microsoft.Quantum.Unstable.Arithmetic { /// the adders is controlled, /// /// # Reference - /// - [arXiv:2012.01624](https://arxiv.org/abs/2012.01624) - /// "Quantum block lookahead adders and the wait for magic states" - /// by Craig Gidney. + /// - [arXiv:2012.01624](https://arxiv.org/abs/2012.01624) + /// "Quantum block lookahead adders and the wait for magic states", + /// Craig Gidney. operation IncByLEUsingAddLE( forwardAdder : (Qubit[], Qubit[], Qubit[]) => Unit is Adj, backwardAdder : (Qubit[], Qubit[], Qubit[]) => Unit is Adj, diff --git a/library/std/unstable_state_preparation.qs b/library/std/unstable_state_preparation.qs index cefe72bd78..57376878a0 100644 --- a/library/std/unstable_state_preparation.qs +++ b/library/std/unstable_state_preparation.qs @@ -46,9 +46,9 @@ namespace Microsoft.Quantum.Unstable.StatePreparation { /// ``` /// /// # References - /// - Synthesis of Quantum Logic Circuits + /// - [arXiv:quant-ph/0406176](https://arxiv.org/abs/quant-ph/0406176) + /// "Synthesis of Quantum Logic Circuits", /// Vivek V. Shende, Stephen S. Bullock, Igor L. Markov - /// https://arxiv.org/abs/quant-ph/0406176 /// /// # See Also /// - Microsoft.Quantum.Unstable.StatePreparation.ApproximatelyPreparePureStateCP @@ -101,9 +101,9 @@ namespace Microsoft.Quantum.Unstable.StatePreparation { /// specified. /// /// # References - /// - Synthesis of Quantum Logic Circuits + /// - [arXiv:quant-ph/0406176](https://arxiv.org/abs/quant-ph/0406176) + /// "Synthesis of Quantum Logic Circuits", /// Vivek V. Shende, Stephen S. Bullock, Igor L. Markov - /// https://arxiv.org/abs/quant-ph/0406176 operation ApproximatelyPreparePureStateCP( tolerance : Double, coefficients : ComplexPolar[], @@ -314,9 +314,9 @@ namespace Microsoft.Quantum.Unstable.StatePreparation { /// fewer than $2^n$ are specified. /// /// # References - /// - Synthesis of Quantum Logic Circuits + /// - [arXiv:quant-ph/0406176](https://arxiv.org/abs/quant-ph/0406176) + /// "Synthesis of Quantum Logic Circuits", /// Vivek V. Shende, Stephen S. Bullock, Igor L. Markov - /// https://arxiv.org/abs/quant-ph/0406176 internal operation ApproximatelyMultiplexZ( tolerance : Double, coefficients : Double[], @@ -385,4 +385,3 @@ namespace Microsoft.Quantum.Unstable.StatePreparation { } } - diff --git a/library/std/unstable_table_lookup.qs b/library/std/unstable_table_lookup.qs index 7c3b9dd9a7..b748aa07ff 100644 --- a/library/std/unstable_table_lookup.qs +++ b/library/std/unstable_table_lookup.qs @@ -36,13 +36,13 @@ namespace Microsoft.Quantum.Unstable.TableLookup { /// is not optimized using this technique. /// /// # References - /// [1] [arXiv:1805.03662](https://arxiv.org/abs/1805.03662) - /// "Encoding Electronic Spectra in Quantum Circuits with Linear T - /// Complexity" - /// [2] [arXiv:1905.07682](https://arxiv.org/abs/1905.07682) - /// "Windowed arithmetic" - /// [3] [arXiv:2211.01133](https://arxiv.org/abs/2211.01133) - /// "Space-time optimized table lookup" + /// 1. [arXiv:1805.03662](https://arxiv.org/abs/1805.03662) + /// "Encoding Electronic Spectra in Quantum Circuits with Linear T + /// Complexity" + /// 2. [arXiv:1905.07682](https://arxiv.org/abs/1905.07682) + /// "Windowed arithmetic" + /// 3. [arXiv:2211.01133](https://arxiv.org/abs/2211.01133) + /// "Space-time optimized table lookup" @Config(Adaptive) operation Select( data : Bool[][],