Crate quest_sys

source
Expand description

§quest-sys

Rust bindings for the QuEST quantum computer simulator library.

Conforming with the sys crate naming convention this package only provides very thin bindings.

Structs§

  • Represents one complex number.
  • Represents an array of complex numbers grouped into an array of real components and an array of coressponding complex components.
  • Represents a 2x2 matrix of complex numbers.
  • Represents a 4x4 matrix of complex numbers
  • Represents a general 2^N by 2^N matrix of complex numbers.
  • Represents a diagonal complex operator on the full Hilbert state of a \p Qureg. The operator need not be unitary nor Hermitian (which would constrain it to real values)
  • A Pauli Hamiltonian, expressed as a real-weighted sum of pauli products, and which can hence represent any Hermitian operator.
  • A logger of QASM instructions
  • Information about the environment the program is running in. In practice, this holds info about MPI ranks and helps to hide MPI initialization code
  • Represents a system of qubits. Qubits are zero-based
  • Represents a diagonal complex operator of a smaller dimension than the full Hilbert state of a \p Qureg.
  • Represents a 3-vector of real numbers

Constants§

Functions§

  • Apply a diagonal operator, which is possibly non-unitary and non-Hermitian, to the entire \p qureg.
  • Applies the quantum Fourier transform (QFT) to the entirety of \p qureg. The effected unitary circuit (shown here for 4 qubits, bottom qubit is 0) resembles @htmlonly
  • Apply a gate specified by a general N-by-N matrix, which may be non-unitary, on any number of target qubits. This function applies the given matrix to both statevector and density matrices as if it were a valid unitary gate. Hence this function is equivalent to multiQubitUnitary(), albeit the unitarity of \p u is not checked nor enforced. This function differs from applyMatrixN() on density matrices.
  • Apply a many-qubit unitary specified as a diagonal matrix upon a specific set of qubits of a quantum register.
  • Apply a general 2-by-2 matrix, which may be non-unitary. The matrix is left-multiplied onto the state, for both state-vectors and density matrices.
  • Apply a general 4-by-4 matrix, which may be non-unitary. The matrix is left-multiplied onto the state, for both state-vectors and density matrices.
  • Apply a general N-by-N matrix, which may be non-unitary, on any number of target qubits. The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Note this differs from the action of multiQubitUnitary() on a density matrix.
  • Apply a general multi-controlled multi-qubit gate specified as an (possibly non-unitary) arbitrary complex matrix. This is equivalent to multiControlledMultiQubitUnitary() but does not check nor enforce unitary of the given matrix \p m. This differs from applyMultiControlledMatrixN(), because the latter only left-applies the matrix upon density matrices.
  • Apply a general N-by-N matrix, which may be non-unitary, with additional controlled qubits. The matrix is left-multiplied onto the state, for both state-vectors and density matrices. Hence, this function differs from multiControlledMultiQubitUnitary() by more than just permitting a non-unitary matrix.
  • Induces a phase change upon each amplitude of \p qureg, determined by a multi-variable exponential polynomial “phase function”.
  • Induces a phase change upon each amplitude of \p qureg, determined by a multi-variable exponential polynomial “phase function”, and an explicit set of ‘overriding’ values at specific state indices.
  • Induces a phase change upon each amplitude of \p qureg, determined by a named (and potentially multi-variable) phase function.
  • Induces a phase change upon each amplitude of \p qureg, determined by a named (and potentially multi-variable) phase function, and an explicit set of ‘overriding’ values at specific state indices.
  • Induces a phase change upon each amplitude of \p qureg, determined by a named, paramaterized (and potentially multi-variable) phase function.
  • Induces a phase change upon each amplitude of \p qureg, determined by a named, parameterised (and potentially multi-variable) phase function, and an explicit set of ‘overriding’ values at specific state indices.
  • Modifies \p outQureg to be the result of applying \p PauliHamil (a Hermitian but not necessarily unitary operator) to \p inQureg. Note that afterward, \p outQureg may no longer be normalised and ergo not a state-vector or density matrix. Users must therefore be careful passing \p outQureg to other QuEST functions which assume normalisation in order to function correctly.
  • Modifies \p outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but not necessarily unitary operator) to \p inQureg. Note that afterward, \p outQureg may no longer be normalised and ergo not a state-vector or density matrix. Users must therefore be careful passing \p outQureg to other QuEST functions which assume normalisation in order to function correctly.
  • Induces a phase change upon each amplitude of \p qureg, determined by the passed exponential polynomial “phase function”. This effects a diagonal unitary of unit complex scalars, targeting the nominated \p qubits.
  • Induces a phase change upon each amplitude of \p qureg, determined by the passed exponential polynomial “phase function”, and an explicit set of ‘overriding’ values at specific state indices.
  • Force the target \p qubit of \p qureg into the given classical \p outcome, via a non-renormalising projection.
  • Applies the quantum Fourier transform (QFT) to a specific subset of qubits of the register \p qureg.
  • Left-apply a many-qubit a diagonal matrix upon a specific set of qubits of a quantum register.
  • Applies a trotterisation of unitary evolution \f$ \exp(-i , \text{hamil} , \text{time}) \f$ to \p qureg. This is a sequence of unitary operators, effected by multiRotatePauli(), which together approximate the action of full unitary-time evolution under the given Hamiltonian.
  • Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of matrices) of two density matrices \p rho1 and \p rho2 of equivalent size. That is, we define the Hilbert-Schmidt scalar product \f[ ((\rho_1, \rho_2)){HS} := \text{Tr}[ \rho_1^\dagger \rho_2 ], \f] which is equivalent to the sum of products of matrix elemets, i.e., \f[ ((\rho_1, \rho_2)){HS} = \sum\limits_i \sum\limits_j (\rho_1){ij}^* (\rho_2){ij} \f] Assuming that both density matrices are Hermitian, the resulting scalar product is real and invariant under reordering its arguments as \f[ ((\rho_1, \rho_2)){HS} = ((\rho_2, \rho_1)){HS} = \text{Tr}[\rho_1 \rho_2] \f] If both \p rho1 and \p rho2 are density matrices of pure states \p bra and \p ket, then the equality holds \f[ ((\rho_1, \rho_2)){HS} = |\langle \text{bra} | \text{ket} \rangle|^2. \f] If either or both of \p rho1 and \p rho2 are non Hermitian (i.e. invalid density matrices), then this function returns the real component of the scalar product, and discards the imaginary component. That is, it returns \f[ \text{Re}{ \text{Tr}[ \rho_1^\dagger \rho_2 ] } = \text{Re}{ \text{Tr}[ \rho_2^\dagger \rho_1 ] }. \f] This is still sometimes useful, e.g. in calculating the inner product with an anti-commutator, e.g. (for Hermitian \f$ \sigma \f$, \f$ \rho \f$, \f$ H \f$) \f[ ((\sigma, H \rho + \rho H)){HS} = 2 ; \text{Re} { ((\sigma, H \rho))_{HS} } \f] where \f$ H \rho \f$ could be a weighted sum of Pauli products applied to \f$ \rho \f$ through applyPauliSum().
  • Computes the expected value of the diagonal operator \p op for state \p qureg. Since \p op is not necessarily Hermitian, the expected value may be a complex number.
  • Computes the expected value of \p qureg under Hermitian operator \p hamil. Represent \p hamil as \f$ H = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} \f$ (where \f$ c_i \in \f$ \p hamil.termCoeffs and \f$ N = \f$ \p hamil.numQubits). This function computes \f$ \langle \psi | H | \psi \rangle \f$ if \p qureg = \f$ \psi \f$ is a state-vector, and computes \f$ \text{Trace}(H \rho) =\text{Trace}(\rho H) \f$ if \p qureg = \f$ \rho \f$ is a density matrix.
  • Computes the expected value of a product of Pauli operators. Letting \f$ \sigma = \otimes_j \hat{\sigma}_j \f$ be the operators indicated by \p pauliCodes and acting on qubits \p targetQubits, this function computes \f$ \langle \psi | \sigma | \psi \rangle \f$ if \p qureg = \f$ \psi \f$ is a state-vector, and computes \f$ \text{Trace}(\sigma \rho) \f$ if \p qureg = \f$ \rho \f$ is a density matrix.
  • Computes the expected value of a sum of products of Pauli operators. Let \f$ H = \sum_i c_i \otimes_j^{N} \hat{\sigma}_{i,j} \f$ be the operators indicated by \p allPauliCodes (where \f$ c_i \in \f$ \p termCoeffs and \f$ N = \f$ \p qureg.numQubitsRepresented). This function computes \f$ \langle \psi | H | \psi \rangle \f$ if \p qureg = \f$ \psi \f$ is a state-vector, and computes \f$ \text{Trace}(H \rho) =\text{Trace}(\rho H) \f$ if \p qureg = \f$ \rho \f$ is a density matrix.
  • Calculates the fidelity of \p qureg (a state-vector or density matrix) against a reference pure state (necessarily a state-vector). If \p qureg is a state-vector, this function computes \f[ |\langle \text{qureg} | \text{pureState} \rangle|^2 \f] If \p qureg is a density matrix, this function computes \f[ \langle \text{pureState} | \text{qureg} | \text{pureState} \rangle \f] In either case, the returned fidelity lies in [0, 1] (assuming both input states have valid normalisation). If any of the input \p Quregs are not normalised, this function will return the real component of the correct linear algebra calculation.
  • Computes the Hilbert Schmidt distance between two density matrices \p a and \p b, defined as the Frobenius norm of the difference between them. That is, we define the Hilbert Schmidt distance \f[ D(a, b) = | a - b |F = \sqrt{ \text{Tr}[ (a-b)(a-b)^\dagger ] } \f] This is equivalent to the square-root of the sum of the absolute value squared of the element-differences of the matrices, i.e. \f[ D(a, b) = \sqrt{ \sum\limits_i \sum\limits_j | a{ij} - b_{ij} |^2 } \f] We caution this may differ by some definitions of the Hilbert Schmidt distance by a square-root.
  • Computes the inner product \f$ \langle \text{bra} | \text{ket} \rangle \f$ of two equal-size state vectors, given by \f[ \langle \text{bra} | \text{ket} \rangle = \sum_i {\text{bra}_i}^* ; \times ; \text{ket}_i \f] The same \p qureg may be passed as both \p bra and \p ket, though we recommend users check state-vector normalisation with \p calcTotalProb which employs Kahan summation for greater accuracy. Neither state-vector is modified.
  • Populates \p outcomeProbs with the probabilities of every outcome of the sub-register contained in \p qubits.
  • Gives the probability of a specified qubit being measured in the given outcome (0 or 1). This performs no actual measurement and does not change the state of the qubits.
  • Calculates the purity of a density matrix, by the trace of the density matrix squared. Returns \f$\text{Tr}(\rho^2)\f$. For a pure state, this =1. For a mixed state, the purity is less than 1 and is lower bounded by 1/2^n, where n is the number of qubits. The minimum purity is achieved for the maximally mixed state identity/2^n.
  • A debugging function which calculates the probability of the qubits in \p qureg being in any state, which should always be 1 for correctly normalised states (hence returning a real number). For state-vectors \f$ \psi \f$, this is the norm of the entire state-vector (the sum of the absolute-value-squared of every amplitude): \f[ \sum\limits_i |\psi_i|^2 \f] and for density matrices \f$ \rho \f$, it is the trace: \f[ \text{Trace}(\rho) = \sum\limits_i \rho_{i,i} ; \f]
  • Overwrite the amplitudes of \p targetQureg with those from \p copyQureg.
  • Apply a single-qubit unitary parameterised by two given complex scalars. Given valid complex numbers \f$\alpha\f$ and \f$\beta\f$, applies the unitary \f[ U = \begin{pmatrix} \alpha & -\beta^* \ \beta & \alpha^* \end{pmatrix} \f] which is general up to a global phase factor. Valid \f$\alpha\f$, \f$\beta\f$ satisfy \f$|\alpha|^2 + |\beta|^2 = 1\f$.
  • Apply a controlled unitary (single control, single target) parameterised by two given complex scalars. Given valid complex numbers \f$\alpha\f$ and \f$\beta\f$, applies the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \ & & \alpha & -\beta^* \ & & \beta & \alpha^* \end{pmatrix} \f] to the control and target qubits. Valid \f$\alpha\f$, \f$\beta\f$ satisfy \f$|\alpha|^2 + |\beta|^2 = 1\f$. The target unitary is general up to a global phase factor.
  • Apply a general controlled multi-qubit unitary (including a global phase factor). One control and any number of target qubits can be specified. This effects the many-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & 1 \ & & & 1 \ & & & & u_{00} & u_{01} & \dots \ & & & & u_{10} & u_{11} & \dots \ & & & & \vdots & \vdots & \ddots \end{pmatrix} \f] on the control and target qubits.
  • Apply the controlled not (single control, single target) gate, also known as the c-X, c-sigma-X, c-Pauli-X and c-bit-flip gate. This applies pauliX to the target qubit if the control qubit has value 1. This effects the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & & 1 \ & & 1 \end{pmatrix} \f] on the control and target qubits.
  • Apply the controlled pauliY (single control, single target) gate, also known as the c-Y and c-sigma-Y gate. This applies pauliY to the target qubit if the control qubit has value 1. This effects the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & & -i \ & & i \end{pmatrix} \f] on the control and target qubits.
  • Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate. For each state, if both input qubits have value one, multiply the amplitude of that state by -1. This applies the two-qubit unitary: \f[ \begin{pmatrix} 1 \ & 1 \
    & & 1 \ & & & -1 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Introduce a phase factor \f$ \exp(i \theta) \f$ on state \f$ |11\rangle \f$ of qubits \p idQubit1 and \p idQubit2. For angle \f$\theta\f$, this effects the unitary \f[ \begin{pmatrix} 1 & & & \ & 1 & & \ & & 1 & \ & & & \exp(i \theta) \end{pmatrix} \f] on \p idQubit1 and \p idQubit2.
  • Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere. The vector must not be zero (else an error is thrown), but needn’t be unit magnitude.
  • Applies a controlled rotation by a given angle around the X-axis of the Bloch-sphere. The target qubit is rotated in states where the control qubit has value 1.
  • Applies a controlled rotation by a given angle around the Y-axis of the Bloch-sphere. The target qubit is rotated in states where the control qubit has value 1.
  • Applies a controlled rotation by a given angle around the Z-axis of the Bloch-sphere. The target qubit is rotated in states where the control qubit has value 1.
  • Apply a general controlled two-qubit unitary (including a global phase factor). The given unitary is applied to the target amplitudes where the control qubit has value 1. This effects the many-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \ & & 1 \ & & & 1 \ & & & & u_{00} & u_{01} & u_{02} & u_{03} \ & & & & u_{10} & u_{11} & u_{12} & u_{13} \ & & & & u_{20} & u_{21} & u_{22} & u_{23} \ & & & & u_{30} & u_{31} & u_{32} & u_{33} \end{pmatrix} \f] on the control and target qubits.
  • Apply a general controlled unitary (single control, single target), which can include a global phase factor. The given unitary is applied to the target qubit if the control qubit has value 1, effecting the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \ & & u_{00} & u_{01}\ & & u_{10} & u_{11} \end{pmatrix} \f] on the control and target qubits.
  • In GPU mode, this copies the state-vector (or density matrix) from GPU memory (qureg.deviceStateVec) to RAM (qureg.stateVec), where it can be accessed/modified by the user. In CPU mode, this function has no effect. In conjunction with copyStateToGPU(), this allows a user to directly modify the state-vector in a harware agnostic way. Note though that users should instead use setAmps() if possible.
  • Create a new ::Qureg which is an exact clone of the passed qureg, which can be either a state-vector or a density matrix.
  • Allocate dynamic memory for a square complex matrix of any size, which can be passed to functions like multiQubitUnitary() and applyMatrixN().
  • Creates a density matrix Qureg object representing a set of qubits which can enter noisy and mixed states.
  • Creates a ::DiagonalOp representing a diagonal operator on the full Hilbert space of a ::Qureg.
  • Creates and initialiases a diagonal operator from the Z Pauli Hamiltonian encoded in file with filename \p fn.
  • Dynamically allocates a Hamiltonian expressed as a real-weighted sum of products of Pauli operators.
  • Creates a \p PauliHamil instance, a real-weighted sum of products of Pauli operators, populated with the data in filename \p fn.
  • Create the QuEST execution environment. This should be called only once, and the environment should be freed with destroyQuESTEnv at the end of the user’s code. If something needs to be done to set up the execution environment, such as initializing MPI when running in distributed mode, it is handled here.
  • Creates a state-vector Qureg object representing a set of qubits which will remain in a pure state.
  • Creates a ::SubDiagonalOp representing a diagonal operator which can act upon a subset of the qubits in a ::Qureg. This is similar to a ::DiagonalOp acting upon specific qubits.
  • Destroy a ComplexMatrixN instance created with createComplexMatrixN()
  • Destroys a ::DiagonalOp created with createDiagonalOp(), freeing its memory.
  • Destroy a ::PauliHamil instance, created with either createPauliHamil() or createPauliHamilFromFile().
  • Destroy the QuEST environment. If something needs to be done to clean up the execution environment, such as finalizing MPI when running in distributed mode, it is handled here
  • Deallocate a ::Qureg, freeing its memory.
  • Destroy a ::SubDiagonalOp instance created with createSubDiagonalOp().
  • Get the complex amplitude at a given index in the state vector.
  • Get an amplitude from a density matrix at a given row and column.
  • Sets \p str to a string containing information about the runtime environment, including whether simulation is using CUDA (for GPU), OpenMP (for multithreading) and/or MPI (for distribution). The number of CPU threads and distributed ranks is also reported. Note there is currently no reporting of the number of GPU cores used.
  • Get the imaginary component of the complex probability amplitude at an index in the state vector.
  • Returns the number of complex amplitudes in a state-vector \p qureg.
  • Returns the number of qubits represented by \p qureg.
  • Get the probability of a state-vector at an index in the full state vector.
  • Obtain the seeds presently used in random number generation.
  • Get the real component of the complex probability amplitude at an index in the state vector.
  • Apply the single-qubit Hadamard gate. This takes \f$|0\rangle\f$ to \f$|+\rangle\f$ and \f$|1\rangle\f$ to \f$|-\rangle\f$, and is equivalent to a rotation of \f$\pi\f$ around the x-axis then \f$\pi/2\f$ about the y-axis on the Bloch-sphere. I.e. \f[ \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \ 1 & -1 \end{pmatrix} \f]
  • Initialises a qureg to have all-zero-amplitudes. This is an unphysical state useful for iteratively building a state with functions like setWeightedQureg(), and should not be confused with initZeroState().
  • Initialise \p qureg into the classical state (also known as a “computational basis state”) with index \p stateInd.
  • Initialises a ComplexMatrixN instance to have the passed \p real and \p imag values. This allows succint population of any-sized ComplexMatrixN, e.g. through 2D arrays:
  • Initialises \p qureg to be in the un-normalised, non-physical state with with \f$n\f$-th complex amplitude given by \f$2n/10 + i(2n+1)/10\f$.
  • Overwrites the entire ::DiagonalOp \p op with the given \p real and \p imag complex elements.
  • Populates the diagonal operator \p op to be equivalent to the given Pauli Hamiltonian \p hamil, assuming \p hamil contains only PAULI_Z operators.
  • Initialise ::PauliHamil instance \p hamil with the given term coefficients and Pauli codes (one for every qubit in every term).
  • Initialise \p qureg into the plus state.
  • Initialise \p qureg into to a given pure state of an equivalent Hilbert dimension.
  • Initialise \p qureg by specifying all amplitudes. For density matrices, it is assumed the amplitudes have been flattened column-wise into the given arrays.
  • Initialise \p qureg into the zero state.
  • Measures a single qubit, collapsing it randomly to 0 or 1.
  • Mixes a density matrix \p qureg to induce single-qubit amplitude damping (decay to 0 state). With probability \p prob, applies damping (transition from 1 to 0 state).
  • Modifies combineQureg to become (1-\p prob)\p combineProb + \p prob \p otherQureg. Both registers must be equal-dimension density matrices, and prob must be in [0, 1].
  • Mixes a density matrix \p qureg to induce single-qubit dephasing noise. With probability \p prob, applies Pauli Z to \p targetQubit.
  • Mixes a density matrix \p qureg to induce single-qubit homogeneous depolarising noise. This is equivalent to, with probability \p prob, uniformly randomly applying either Pauli X, Y, or Z to \p targetQubit.
  • Apply a general single-qubit Kraus map to a density matrix, as specified by at most four Kraus operators, \f$K_i\f$ (\p ops). A Kraus map is also referred to as a “operator-sum representation” of a quantum channel, and enables the simulation of general single-qubit noise process, by effecting \f[ \rho \to \sum\limits_i^{\text{numOps}} K_i \rho K_i^\dagger \f]
  • Apply a general N-qubit Kraus map to a density matrix, as specified by at most (2N)^2 Kraus operators. This allows one to simulate a general noise process.
  • Apply a general non-trace-preserving single-qubit Kraus map to a density matrix, as specified by at most four operators, \f$K_i\f$ (\p ops). This effects \f[ \rho \to \sum\limits_i^{\text{numOps}} K_i \rho K_i^\dagger \f] where \f$K_i\f$ are permitted to be any matrix. This means the density matrix can enter a non-physical state.
  • Apply a general N-qubit non-trace-preserving Kraus map to a density matrix, as specified by at most (2N)^2 operators.
  • Apply a general non-trace-preserving two-qubit Kraus map to a density matrix, as specified by at most sixteen operators, \f$K_i\f$ (\p ops).
  • Mixes a density matrix \p qureg to induce general single-qubit Pauli noise. With probabilities \p probX, \p probY and \p probZ, applies Pauli X, Y, and Z respectively to \p targetQubit.
  • Mixes a density matrix \p qureg to induce two-qubit dephasing noise. With probability \p prob, applies Pauli Z to either or both qubits.
  • Mixes a density matrix \p qureg to induce two-qubit homogeneous depolarising noise. With probability \p prob, applies to \p qubit1 and \p qubit2 any operator of the set \f${ IX, IY, IZ, XI, YI, ZI, XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ }\f$. Note this is the set of all two-qubit Pauli gates excluding \f$II\f$.
  • Apply a general two-qubit Kraus map to a density matrix, as specified by at most sixteen Kraus operators. A Kraus map is also referred to as a “operator-sum representation” of a quantum channel. This allows one to simulate a general two-qubit noise process.
  • Apply a NOT (or Pauli X) gate with multiple control and target qubits. This applies pauliX to qubits \p targs on every basis state for which the control qubits \p ctrls are all in the \f$|1\rangle\f$ state. The ordering within each of \p ctrls and \p targs has no effect on the operation.
  • Apply a general multi-controlled multi-qubit unitary (including a global phase factor). Any number of control and target qubits can be specified. This effects the many-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & \ddots \ & & & u_{00} & u_{01} & \dots \ & & & u_{10} & u_{11} & \dots \ & & & \vdots & \vdots & \ddots \end{pmatrix} \f] on the control and target qubits.
  • Apply a multi-controlled multi-target multi-Pauli rotation, also known as a controlled Pauli gadget. This is the unitary \f[ |1\rangle\langle 1|^{\otimes, \text{numControls}} ; \otimes , \exp \left( - i , \frac{\theta}{2} ; \bigotimes_{j}^{\text{numTargets}} \hat{\sigma}j\right) ;;+;; \sum\limits{k=0}^{2^{,\text{numControls}} - 2} |k\rangle\langle k| \otimes \text{I} \f] where \f$\hat{\sigma}_j\f$ are the Pauli operators (::pauliOpType) in targetPaulis, which operate upon the corresponding qubits in targetQubits.
  • Apply a multi-controlled multi-target Z rotation, also known as a controlled phase gadget. This is the unitary \f[ |1\rangle\langle 1|^{\otimes, \text{numControls}} ; \otimes , \exp \left( - i , \frac{\theta}{2} ; \bigotimes_{j}^{\text{numTargets}} Z_j\right) ;;+;; \sum\limits_{k=0}^{2^{,\text{numControls}} - 2} |k\rangle\langle k| \otimes \text{I} \f] where the Pauli Z gates operate upon the qubits in targetQubits, and cause rotations of \f$\theta =\f$ \p angle.
  • Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled pauliZ gate. For each state, if all control qubits have value one, multiply the amplitude of that state by -1. This applies the many-qubit unitary: \f[ \begin{pmatrix} 1 \ & 1 \
    & & \ddots \ & & & 1 \ & & & & -1 \end{pmatrix} \f] on the control qubits.
  • Introduce a phase factor \f$ \exp(i \theta) \f$ on state \f$ |1 \dots 1 \rangle \f$ of the passed qubits.
  • Apply a general multi-controlled two-qubit unitary (including a global phase factor). Any number of control qubits can be specified, and if all have value 1, the given unitary is applied to the target qubit. This effects the many-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & \ddots \ & & & u_{00} & u_{01} & u_{02} & u_{03} \ & & & u_{10} & u_{11} & u_{12} & u_{13} \ & & & u_{20} & u_{21} & u_{22} & u_{23} \ & & & u_{30} & u_{31} & u_{32} & u_{33} \end{pmatrix} \f] on the control and target qubits.
  • Apply a general multiple-control single-target unitary, which can include a global phase factor. Any number of control qubits can be specified, and if all have value 1, the given unitary is applied to the target qubit. This effects the many-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
    & & \ddots \ & & & u_{00} & u_{01}\ & & & u_{10} & u_{11} \end{pmatrix} \f] on the control and target qubits. The given 2x2 ComplexMatrix must be unitary, otherwise an error is thrown.
  • Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubits.
  • Apply the single-qubit Pauli-X (also known as the X, sigma-X, NOT or bit-flip) gate. This is a rotation of \f$\pi\f$ around the x-axis on the Bloch sphere. I.e. \f[ \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Apply the single-qubit Pauli-Y (also known as the Y or sigma-Y) gate. This is a rotation of \f$\pi\f$ around the Y-axis on the Bloch sphere. I.e. \f[ \begin{pmatrix} 0 & -i \ i & 0 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Apply the single-qubit Pauli-Z (also known as the Z, sigma-Z or phase-flip) gate. This is a rotation of \f$\pi\f$ around the Z-axis (a phase shift) on the Bloch sphere. I.e. \f[ \begin{pmatrix} 1 & 0 \ 0 & -1 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Shift the phase between \f$ |0\rangle \f$ and \f$ |1\rangle \f$ of a single qubit by a given angle.
  • Print the \p PauliHamil to screen. The output features a new line for each term, each with format
  • Report information about the QuEST environment
  • Report metainformation about a set of qubits: number of qubits, number of probability amplitudes.
  • Print the current state vector of probability amplitudes for a set of qubits to file. File format: @verbatim real, imag realComponent1, imagComponent1 realComponent2, imagComponent2 … realComponentN, imagComponentN @endverbatim
  • Print the current state vector of probability amplitudes for a set of qubits to standard out. For debugging purposes. Each rank should print output serially. Only print output for systems <= 5 qubits
  • Rotate a single qubit by a given angle around a given \ref Vector on the Bloch-sphere. The vector must not be zero (else an error is thrown), but needn’t be unit magnitude, since it will be normalised by QuEST.
  • Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere. For angle \f$\theta\f$, applies \f[ \begin{pmatrix} \cos\theta/2 & -i \sin \theta/2\ -i \sin \theta/2 & \cos \theta/2 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere. For angle \f$\theta\f$, applies \f[ \begin{pmatrix} \cos\theta/2 & - \sin \theta/2\ \sin \theta/2 & \cos \theta/2 \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Rotate a single qubit by a given angle around the Z-axis of the Bloch-sphere (also known as a phase shift gate). For angle \f$\theta\f$, applies \f[ \begin{pmatrix} \exp(-i \theta/2) & 0 \ 0 & \exp(i \theta/2) \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Apply the single-qubit S gate. This is a rotation of \f$\pi/2\f$ around the Z-axis on the Bloch sphere, or the unitary: \f[ \begin{pmatrix} 1 & 0 \ 0 & i \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Seeds the random number generator with a custom array of key(s), overriding the default keys.
  • Overwrites a contiguous subset of the amplitudes in state-vector \p qureg, with those passed in \p reals and \p imags.
  • Overwrites a contiguous subset of the amplitudes in density-matrix \p qureg, with those passed in \p reals and \p imags, intrepreted column-wise.
  • Modifies a subset (starting at index \p startInd, and ending at index \p startInd + \p numElems) of the elements in ::DiagonalOp \p op with the given complex numbers (passed as \p real and \p imag components).
  • Overwrites the density-matrix \p qureg with the Z-basis matrix representation of the given real-weighted sum of Pauli tensors \p hamil.
  • Modifies qureg \p out to the result of (\p facOut \p out + \p fac1 \p qureg1 + \p fac2 \p qureg2), imposing no constraints on normalisation. Works for both state-vectors and density matrices. Note that afterward, \p out may not longer be normalised and ergo no longer a valid state-vector or density matrix. Users must therefore be careful passing \p out to other QuEST functions which assume normalisation in order to function correctly.
  • Performs a SWAP gate between \p qubit1 and \p qubit2. This effects \f[ \begin{pmatrix} 1 \ & & 1 \
    & 1 \ & & & 1 \end{pmatrix} \f] on the designated qubits, though is performed internally by three CNOT gates.
  • Apply the single-qubit T gate. This is a rotation of \f$\pi/4\f$ around the Z-axis on the Bloch sphere, or the unitary: \f[ \begin{pmatrix} 1 & 0 \ 0 & \exp\left(i \frac{\pi}{4}\right) \end{pmatrix} \f] with circuit diagram: @htmlonly
  • Apply a general two-qubit unitary (including a global phase factor).
  • Apply a general single-qubit unitary (including a global phase factor). The passed 2x2 ComplexMatrix must be unitary, otherwise an error is thrown.

Type Aliases§

  • Flags for specifying how the bits in sub-register computational basis states are mapped to indices in functions like applyPhaseFunc().
  • Codes for specifying Pauli operators
  • Flags for specifying named phase functions. These can be passed to functions applyNamedPhaseFunc(), applyNamedPhaseFuncOverrides(), applyParamNamedPhaseFunc(), and applyParamNamedPhaseFuncOverrides().