This commit is contained in:
Andres Paz 2018-10-31 13:52:36 -07:00
Родитель 4079de6bcc
Коммит a8e204a1d2
8 изменённых файлов: 59 добавлений и 59 удалений

Просмотреть файл

@ -10,8 +10,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents a reflection oracle.
///
/// A reflection oracle, $O$, has inputs:
///
/// A reflection oracle, $O$, has inputs:
/// - The phase $\phi$ by which to rotate the reflected subspace.
/// - The qubit register on which to perform the given reflection.
///
@ -25,8 +25,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents an oracle for oblivious amplitude amplification.
///
/// The inputs to the oracle $O$ are
///
/// The inputs to the oracle $O$ are:
/// - The ancilla register $a$ that $O$ acts on.
/// - The system register $s$ on which the desired unitary $U$ is applied, post-selected on register $a$ being in state $\ket{t}\_a$.
///
@ -41,8 +41,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents an oracle for state preparation.
///
/// The inputs to the opracle $O$ are:
///
/// The inputs to the opracle $O$ are:
/// - An integer indexing the flag qubit $f$.
/// - The system register $s$ that will store the desired quantum state $\ket{\psi}\_s$.
///
@ -57,8 +57,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents an oracle for deterministic state preparation.
///
/// The input to the oracle $O$ is:
///
/// The input to the oracle $O$ is:
/// - The register that will store the desired quantum state $\ket{\psi}\_s$.
///
/// # Remarks

Просмотреть файл

@ -19,8 +19,8 @@ namespace Microsoft.Quantum.Canon
}
/// # Summary
/// Applies `X` operations to qubits in a little-endian register based on 1 bits in an integer.
///
/// Applies `X` operations to qubits in a little-endian register based on 1 bits in an integer.
///
/// Let us denote `value` by a and let y be an unsigned integer encoded in `target`,
/// then `InPlaceXorLE` performs an operation given by the following map:
/// $\ket{y}\rightarrow \ket{y\oplus a}$ , where $\oplus$ is the bitwise exclusive OR operator.
@ -54,8 +54,8 @@ namespace Microsoft.Quantum.Canon
}
/// # Summary
/// Applies `X` operations to qubits in a little-endian register based on 1 bits in an integer.
///
/// Applies `X` operations to qubits in a big-endian register based on 1 bits in an integer.
///
/// Let us denote `value` by a and let y be an unsigned integer encoded in `target`,
/// then `InPlaceXorBE` performs an operation given by the following map:
/// $\ket{y}\rightarrow \ket{y\oplus a}$ , where $\oplus$ is the bitwise exclusive OR operator.
@ -78,7 +78,7 @@ namespace Microsoft.Quantum.Canon
}
/// # Summary
/// This computes the Majority function in-place on 3 bits.
/// This computes the Majority function in-place on 3 qubits.
///
/// # Input
/// ## output
@ -105,8 +105,8 @@ namespace Microsoft.Quantum.Canon
/// This unitary tests if two integers `x` and `y` stored in equal-size qubit registers
/// satisfy `x > y`. If true, 1 is XORed into an output
/// qubit. Otherwise, 0 is XORed into an output qubit.
///
/// In other words, this unitary $U$ satisfies:
///
/// In other words, this unitary $U$ satisfies:
/// $$
/// \begin{align}
/// U\ket{x}\ket{y}\ket{z}=\ket{x}\ket{y}\ket{z\oplus (x>y)}.
@ -196,8 +196,8 @@ namespace Microsoft.Quantum.Canon
/// This unitary tests if two integers `x` and `y` stored in equal-size qubit registers
/// satisfy `x > y`. If true, 1 is XORed into an output
/// qubit. Otherwise, 0 is XORed into an output qubit.
///
/// In other words, $U$ satisfies:
///
/// In other words, this unitary $U$ satisfies:
/// $$
/// \begin{align}
/// U\ket{x}\ket{y}\ket{z}=\ket{x}\ket{y}\ket{z\oplus (x>y)}.
@ -226,7 +226,7 @@ namespace Microsoft.Quantum.Canon
}
/// # Summary
/// Reads out the content of a quantum register and converts
/// Measures the content of a quantum register and converts
/// it to an integer. The measurement is performed with respect
/// to the standard computational basis, i.e., the eigenbasis of `PauliZ`.
///
@ -275,7 +275,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Unsigned integer increment by an integer constant, based on phase rotations.
///
///
/// Suppose `target` encodes unsigned integer x in little-endian encoding and
/// `increment` is equal to a.
/// The operation implements the unitary |x⟩ ↦ |x + a ⟩,
@ -393,7 +393,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Unsigned integer increment by an integer constant, based on phase rotations.
///
///
/// Suppose `target` encodes unsigned integer x in little-endian encoding and
/// `increment` is equal to a.
/// The operation implements the unitary |x⟩ ↦ |x + a ⟩,
@ -423,8 +423,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Performs a modular increment of a qubit register by an integer constant.
///
/// Performs a modular increment of a qubit register by an integer constant.
///
/// Let us denote `increment` by a, `modulus` by N and integer encoded in `target` by y
/// Then the operation performs the following transformation:
/// \begin{align}
@ -493,8 +493,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Performs a modular increment of a qubit register by an integer constant.
///
/// Performs a modular increment of a qubit register by an integer constant.
///
/// Let us denote `increment` by a, `modulus` by N and integer encoded in `target` by y
/// Then the operation performs the following transformation:
/// |y⟩ ↦ |y+a (mod N)⟩
@ -598,8 +598,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Performs a modular multipy-and-add by integer constants on a qubit register.
///
/// Performs a modular multipy-and-add by integer constants on a qubit register.
///
/// Implements the map
/// $$
/// \begin{align}
@ -684,8 +684,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Performs modular multiplication by an integer constant on a qubit register.
///
/// Performs modular multiplication by an integer constant on a qubit register.
///
/// Let us denote modulus by N and constMultiplier by a
/// then this operation implements a unitary defined by the following map on
/// computational basis:

Просмотреть файл

@ -25,7 +25,7 @@ namespace Microsoft.Quantum.Canon
function Reverse<'T> (array : 'T[]) : 'T[]
{
let nElements = Length(array);
return array[nElements-1..-1..0];
return array[nElements-1..-1..0];
}

Просмотреть файл

@ -10,7 +10,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Given operations implementing operators `U` and `V`, performs the
/// operation `UVU` on a target. That is, this operation
/// operation `U<EFBFBD>VU` on a target. That is, this operation
/// conjugates `V` with `U`.
///
/// # Input
@ -46,7 +46,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Given operations implementing operators `U` and `V`, performs the
/// operation `UVU` on a target. That is, this operation
/// operation `U<EFBFBD>VU` on a target. That is, this operation
/// conjugates `V` with `U`.
/// The modifier `A` indicates that the inner operation is adjointable.
///
@ -86,7 +86,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Given operations implementing operators `U` and `V`, performs the
/// operation `UVU` on a target. That is, this operation
/// operation `U<EFBFBD>VU` on a target. That is, this operation
/// conjugates `V` with `U`.
/// The modifier `C` dicates that the inner operation is controllable.
///
@ -131,7 +131,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Given operations implementing operators `U` and `V`, performs the
/// operation `UVU` on a target. That is, this operation
/// operation `U<EFBFBD>VU` on a target. That is, this operation
/// conjugates `V` with `U`.
/// The modifier `CA` indicates that the inner operation is controllable
/// and adjointable.

Просмотреть файл

@ -11,9 +11,9 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents a single primitive term in the set of all dynamical generators, e.g.
/// Hermitian operators, for which there exists a map from that generator
/// to time-evolution by that that generator, through "EvolutionSet".
///
/// The first element
/// to time-evolution by that that generator, through `EvolutionSet`.
///
/// The first element
/// (Int[], Double[]) is indexes that single term -- For instance, the Pauli string
/// XXY with coefficient 0.5 would be indexed by ([1,1,2], [0.5]). Alternatively,
/// Hamiltonians parameterized by a continuous variable, such as X cos φ + Y sin φ,
@ -37,10 +37,10 @@ namespace Microsoft.Quantum.Canon
/// - @"microsoft.quantum.canon.evolutionset"
newtype GeneratorIndex = ((Int[], Double[]), Int[]);
/// # Summary
/// # Summary
/// Represents a collection of `GeneratorIndex`es.
///
/// We iterate over this
///
/// We iterate over this
/// collection using a single-index integer, and the size of the
/// collection is assumed to be known.
///
@ -63,8 +63,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents a unitary time-evolution operator.
///
/// The first parameter is
///
/// The first parameter is
/// is duration of time-evolution, and the second parameter is the qubit
/// register acted upon by the unitary.
newtype EvolutionUnitary = ((Double, Qubit[]) => Unit : Adjoint, Controlled);
@ -72,8 +72,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents a set of gates that can be readily implemented and used
/// to implement simulation algorithms.
///
/// Elements in the set are indexed
///
/// Elements in the set are indexed
/// by a <xref:microsoft.quantum.canon.generatorindex>,
/// and each set is described by a function
/// from `GeneratorIndex` to <xref:microsoft.quantum.canon.evolutionunitary>,
@ -84,14 +84,14 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Represents a dynamical generator as a set of simulatable gates and
/// an expansion in terms of that basis.
///
///
/// Last parameter for number of terms.
newtype EvolutionGenerator = (EvolutionSet, GeneratorSystem);
/// # Summary
/// Represents a time-dependent dynamical generator.
///
/// The `Double`
///
/// The `Double`
/// parameter is a schedule in $[0, 1]$.
newtype EvolutionSchedule = (EvolutionSet, (Double -> GeneratorSystem));
@ -312,7 +312,7 @@ namespace Microsoft.Quantum.Canon
//
/// # Summary
/// Linearly interpolates between two `GeneratorSystems` according to a
/// schedule parameter `s` btween 0 and 1 (inclusive).
/// schedule parameter `s` between 0 and 1 (inclusive).
///
/// # Input
/// ## schedule

Просмотреть файл

@ -178,8 +178,8 @@ namespace Microsoft.Quantum.Canon
/// Integer r between 0 and `modulus - 1' such that `value - r' is divisible by modulus
///
/// # Remarks
/// This function behaves the way a mathematician would expect the Mod function to behave
/// for negative inputs, as opposed to how the operator `%` behaves in C# and Q#.
/// This function behaves different to how the operator `%` behaves in C# and Q# as in the result
/// is always a positive integer between between 0 and `modulus - 1', even if value is negative.
function Modulus (value : Int, modulus : Int) : Int
{
AssertBoolEqual(modulus > 0, true, $"`modulus` must be positive");
@ -199,7 +199,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Let us denote expBase by x, power by p and modulus by N.
/// The function returns xᵖ mod N.
///
///
/// We assume that N,x are positive and power is non-negative.
///
/// # Remarks
@ -392,8 +392,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// For a non-negative integer `a`, returns the number of bits required to represent `a`.
///
/// That is, returns the smallest $n$ such
///
/// That is, returns the smallest $n$ such
/// that $a < 2^n$.
///
/// # Input
@ -410,8 +410,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Returns the `L(p)` norm of a vector of `Double`s.
///
/// Returns the `L(p)` norm of a vector of `Double`s.
///
/// That is, given an array $x$ of type `Double[]`, this returns the $p$-norm
/// $\|x\|_p= (\sum_{j}|x_j|^{p})^{1/p}$.
///
@ -441,8 +441,8 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Normalizes a vector of `Double`s in the `L(p)` norm.
///
/// Normalizes a vector of `Double`s in the `L(p)` norm.
///
/// That is, given an array $x$ of type `Double[]`, this returns an array where
/// all elements are divided by the $p$-norm $\|x\|_p$.
///

Просмотреть файл

@ -10,7 +10,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Performs the quantum phase estimation algorithm for a given oracle `U` and targetState,
/// Performs the quantum phase estimation algorithm for a given oracle `U` and `targetState`,
/// reading the phase into a big-endian quantum register.
///
/// # Input

Просмотреть файл

@ -80,7 +80,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Makes repeated calls to `TrotterStep` to approximate the
/// time-evolution operator _exp(-iHt)_.
/// time-evolution operator exp(_-iHt_).
///
/// # Input
/// ## trotterStepSize
@ -135,7 +135,7 @@ namespace Microsoft.Quantum.Canon
/// # Summary
/// Implementation of multiple Trotter steps to approximate a unitary
/// operator that solves the time-dependent Schrodinger equation.
/// operator that solves the time-dependent Schr<EFBFBD>dinger equation.
///
/// # Input
/// ## trotterStepSize