Skip to content

Releases: QTechTheory/QuESTlink

v0.19

07 Apr 22:20
Compare
Choose a tag to compare

This release re-exposes some Monte Carlo sampling functions previously hidden (due to insufficient testing), extends the AssertValidChannels option to gates, and generally improves validation. It also patches a critical bug in SimplifyPaulis[], as elaborated upon below - please read on!

New features

  • GetCircuitsFromChannel[] (added privately in v0.12 2022) analytically decomposes a channel or noisy circuit into a list of pure circuits, each compatible with state-vector simulation, and which together constitute the circuit's possible errors.

    image
  • GetRandomCircuitFromChannel[] (of v0.12) randomly returns one of the channel's decomposed pure circuits (like above), weighted by its classical probability.

    image
  • SampleExpecPauliString[] estimates a noisy expectation value through Monte Carlo sampling of statevector simulation, avoiding quadratically more expensive density-matrix simulation.

    image
  • GetCircuitConjugated[] returns a circuit with a Z-basis matrix equal to the complex conjugate of that of the given circuit.

    image
  • GetPauliString[] can now simultaneously accept specification of both the target qubits, and the number of final Paulis to keep in the string (padding with Id). This enables users to (e.g.) specify an 8x8 matrix encoding the Paulis upon qubits {2,4,7}, and further request that the output string acts upon 5 qubits.

    image
  • Option AssertValidChannels -> False to functions like CalcCircuitMatrix[] now further relaxes the assumption that the operator parameters (like rotation strength) are real. This is necessary for obtaining the correct results from functions like GetCircuitSuperoperator[] and CalcPauliTransferMatrix[] when you wish to permit all symbols to be completely general.

    image

Changes

  • improved the validation of SimplifyPaulis[] so that it explicitly reports an error when encountering an non-simplifiable sub-expression, forbidding the expression to commute.

    image
  • improved the validation of DrawPauliTransferMap[] which now warns when the given map includes an un-rendered null transition (i.e. the map produces nothing from one or more Pauli states).

    image
  • improved the node-labelling of DrawPauliTransferMap[] when given option "PauliStringForm" -> "String" or "Kronecker". Previously, node labels were agnostic to the particular target qubits of the operator, indicating only the "internal, relative" states of the map; this was concise but confusing. Nodes are now labelled as explicit, full Pauli strings:

    image

Bug fixes

  • patched a catastrophic error in SimplifyPaulis[] whereby multiplication of same-target operators X*Z and Z*X produced an incorrect sign. A warning of this bug is temporarily reported when calling Import["...questlink.m"]

    image
  • patched a bug where passing symbolic constants (e.g. Pi, Sqrt[2], Rational[1,10]) as coefficients of Pauli operators to backend Pauli string functions (like CalcExpecPauliString[]) caused the QuESTlink process to crash. The following functions now permit symbolic constants, provided they are later evaluable as floating-point numbers:

    • CalcExpecPauliStringDerivs[]
    • SetQuregToPauliString[]
    • CalcExpecPauliString[]
    • ApplyPauliString[]
    • CalcPauliStringMatrix[]
    • SampleExpecPauliString[]
  • patched ApplyPauliTransferMap[] to support null-transition maps, as can result from maximally-mixing channels (e.g. Damp[prob=1])

  • patched ApplyPauliTransferMap[] when given numerical operator parameters, which was previously vulnerable to throwing an unexpected input-validation error.

  • patched SimplifyPaulis[] validation which previously correctly displayed an error message when given bad input, but returned Null instead of $Failed.

  • fixed a typo in the real-time simulation demo. Thanks to the hawk-eyed @GibbsJR !

v0.18

29 Feb 00:24
Compare
Choose a tag to compare

This release adds functionality for computing, visualising, and processing Pauli transfer matrices, as well as some convenience functions for obtaining and reformatting symbolically weighted sums of Pauli strings. Scroll down for some very pretty diagrams! 🎉

This release was supported by the Laboratory of Quantum Information and Computation at EPFL, lead by Zoë Holmes. ❤️

New features

Presented in order of increasing aesthetic value.

  • GetCircuitParameterised[] extracts the parameters of parameterised gates, replacing them with symbols. This is useful for things like finding repeated gate strengths, preparing ansatz circuits, or computing derivatives of circuit properties.
    image

Several new convenience functions make creating and modifying Pauli strings (and weighted sums thereof) less painful.

  • GetPauliString[] generates a Pauli string (or a weighted sum thereof) from basis indices, or digits, or arbitrary matrices, or a list of coefficients and states (in a file or at a URL).

    image
  • GetPauliStringReformatted[] converts a Pauli string into other forms more convenient for interpreting or processing.

    image
  • GetPauliStringRetargeted[] can change the targeted qubits of a Pauli string, analogous to GetCircuitRetargeted[].

    image
  • GetPauliStringOverlap[] finds basis Pauli strings common to given weighted sums, returning their (conjugated) product in a manner analogous to an inner-product.

    image

QuESTlink's recognised operator set now includes PTM and PTMap for representing Pauli transfer matrices, used extensively in tomography and recently in classical simulation of variational quantum algorithms.

  • CalcPauliTransferMatrix[] computes the PTM of an operator or circuit.

    image
  • CalcPauliTransferMap[] computes the operator's PTMap which describes how the operator would modify (when applied in conjugation upon) a Pauli string.

    image
  • DrawPauliTransferMap[] visualises a PTMap as a graph, showing how the equivalent operator would successively modify (when applied in conjugation) Pauli strings.

    image

    This extends QuESTlink's family of methods to visually study quantum circuits.

    image

We also add functions for evolving Pauli strings under the action of these maps.

  • ApplyPauliTransferMap[] modifies a Pauli string under the action of a PTM or circuit (by conjugation).
    image
  • CalcPauliTransferEval[] returns the full evolution history of a Pauli string as it is modified by the successive PTMs of a circuit.
    image
  • DrawPauliTransferEval[] visualises the evolution of the Pauli string.
    image
    This is handy for tracking how amplitudes in the circuit's maps contribute to the coefficients of Pauli strings.
    image

Changes

  • deprecated GetPauliStringFromCoeffs[] (behaviour now merged into GetPauliString[])
  • deprecated GetPauliStringFromMatrix[] (behaviour now merged into GetPauliString[])
  • renamed RetargetCircuit[] to GetCircuitRetargeted[]
  • the output qubits of GetCircuitQubits[] are no longer sorted, and instead match the order that the qubits appear within the circuit.
  • the qubits in (at least the first) gates output by GetCircuitCompacted[] are now strictly increasing (targets then controls).

Bug fixes

  • Pauli operator Id is now recognised by GetCircuitSuperoperator[] (formerly throwing an error).

v0.17

27 Jan 18:16
97db61d
Compare
Choose a tag to compare

This release adds several functions for manipulating circuits, casting them between the Z-basis and the Pauli-tensor basis, and computing their generators. We also add two new substantial demos.

New features

  • GetPauliStringFromMatrix[] returns a complex-weighted Pauli string equivalent to the given complex matrix.

    image
  • CalcCircuitGenerator[] which returns the Pauli string generator of the given circuit.

    image
  • RetargetCircuit[] remaps the qubits in a circuit

    image
  • GetQuregState[] which is equivalent to the old GetQuregMatrix[], can return the state in alternate basis and representations.

    image
  • GetCircuitQubits[] which returns a list of the qubit indices featured in a given circuit.

    image
  • GetCircuitCompacted[] which removes qubits which are untargeted by a given circuit, compressing the circuit to one upon fewer qubits. It also returns the map necessary to restore the original circuit, which can be used by RetargetCircuit[]

    image

Other changes

  • added two new demo notebooks on variational minisation, and real-time simulation, to /Demos
  • removed old, defunct demo notebooks

v0.16

08 Jan 12:39
d1438ef
Compare
Choose a tag to compare

This release adds a new function for exact recompilation and decomposition of circuits, as well as the ability to customise QuESTlink's internal numerical precision, and a new named phase function.

New features

  • RecompileCircut[] can transpile a given circuit, containing any unitary QuESTlink gates, into a restricted gate set, such as "SingleQubitAndCNOT" and "CliffordAndRz".

    image
  • Variable precision! When compiling QuESTlink, the PRECISION flag of the makefile can now be adjusted to change whether the entire simulator and API makes use of single, double or quad floating-points. This can be useful for checking the sensitivity of a result to numerical artefacts.

  • ApplyPhaseFunc[] now accepts new method "ScaledInverseShiftedWeightedDistance" which describes phase functions of the form coeff/sqrt(fx (x1-x2-dx)^2 + fy (y1-y2-dy)^2 + ...)

Bug fixes

  • patched GetCircuitGeneralised[] which previously incorrectly handled control qubits, producing U gates of matrices with incorrect dimensions, raising an error in subsequent QuESTlink functions.
  • patched SimplifyCircuit[] which previously incorrectly merged adjacent U gates on same-target general unitaries; the order of their matrices in the product was reversed.

v0.15

02 Jul 22:00
Compare
Choose a tag to compare

This minor release patches a bug introduced in v0.14.

Bug fixes

  • restored passing of Kraus and KrausNonTP operators to ApplyCircuit (and to related functions like ApplyCircuitDerivs). Version v0.14 changed how Mathematica matrices are encoded into C++ structures, so that gates U, UNonNorm and Matr can accept matrices specified diagonally. This inadvertently disabled passing Kraus operator matrices.

  • temporarily disabled pretty frontend rendering of matrices (via MatrixForm) in the error messages of operators U, UNonNorm, Matr, Kraus and KrausNonTP. While implemented correctly, these renderings sometimes invoked an outstanding Mathematica notebook bug, causing the entire error message to be hidden (and replaced with obscure text like <<<527>>>).

    As a result, a previous error message like:

    image

    will now be rendered as:

    image

    so as to avoid invoking the occassional Mathematica frontend bug and rendering as

    image

v0.14

21 Jun 21:52
Compare
Choose a tag to compare

This minor release adds support for diagonal matrices, a validation improvement, and a patch to an esoteric bug in ApplyCircuitDerivs[].

New features

  • Gates U, UNonNorm and Matr, which previously accepted dense matrices (specified element-wise), now addtionally accept diagonal matrices specified as flat lists. Such diagonal gates have bespoke backend QuEST simulation functions (invoked by functions like ApplyCircuit[]), and bespoke/optimised Mathematica handling (invoked by functions like CalcCircuitMatrix[] and SimplifyCircuit[]).

    For example, operators specified as

    U_0[ {{a,0}, {0, b}} ]
    

    and

    U_0[ {a,b} ]
    

    are equivalent, though the latter is (approximately) quadratically faster (in terms of its dimension) to simulate.

Changes

  • derivative functions ApplyCircuitDerivs[], CalcMetricTensor[] and CalcExpecPauliStringDerivs[] now explicitly check whether the given density matrix is Hermitian (otherwise throwing an error), since this is a pre-condition to their correct function.

Bug fixes

  • patched an esoteric ApplyCircuitDerivs bug when differentiating with respect to a parameter in a Matr[] operator upon a density matrix.
    Precisely; the existing Matr gate modifies density matrices rho under
    rho -> Matr rho

    Previously, ApplyCircuitDerivs[] would compute the derivative of Matr as
    D( Matr ||rho>> ) = conj(Matr) (x) D(Matr) ||rho>> + adj
    where ||rho>> notates the equivalent vector under the Choi isomorphism.

    This formulation is erroneous, and treats Matr like a unitary gate operated as
    rho -> U rho dagger(U)

    Instead, the true derivative of Matr is simply;
    D(Matr) ||rho>>

    This bug was extremely esoteric and was likely not encountered by users, since such state derivatives are typically used by variational algorithms leveraging unitary ansatzse. It also did not affect similar functions like CalcExpecPauliStringDerivs[] and CalcMetricTensor[], which already forbid non-trace-preserving operators like Matr.

v0.13

08 Jun 13:10
Compare
Choose a tag to compare

This is a minor release with some quality-of-life improvements and patches.

Changes

  • InsertCircuitNoise[] and GetCircuitSchedule[] now return an extra empty gate column, conveniently containing the final time (and ergo duration) of the circuit schedule.
    For example, where these functions previously returned
     { {t0, {gates0}}, {t1, {gates1}} }
    they now return
     { {t0, {gates0}}, {t1, {gates1}}, {t2, {}} }
    This final time is rendered by DrawCircuit[schedule]
  • InsertCircuitNoise[] now issues a warning when an explicitly given circuit schedule prescribes a duration to a set of simultaneous gates which is shorter than the duration of the slowest gate therein - such a scenario risks overlapping the gate with a subsequent gate on the same qubit(s). This warning is silencable using Quiet[]
  • Projector gate P now accepts a list of qubit outcomes, in addition to those outcomes being passed as arguments. Explicitly, equivalent gates P[{1,1,0}], P[1,1,0] and P[6] are now accepted.

Bug fixes

  • patched GetUnsupportedGates[] which was accidentally disabled by a previous improvement to input validation.
  • patched ViewDeviceSpec[] which was verbosely including Circuit[] in its displayed gate sequences.
  • patched InsertCircuitNoise[] which was erroneously wrapping substituted gate aliases with curly braces into circuits, when that alias mapped to mulitple gates.

v0.12

07 Nov 20:53
Compare
Choose a tag to compare

This major release significantly extends QuESTlink's capabilities for efficient and convenient simulation of quantum variational algorithms, as well as generally improving quality-of-life. It includes asymptotically improved functions for calculating variational quantities, in noisy settings and with previous ansatz constraints relaxed, new functions to generate Pauli strings and ansatz circuits, and improved error messages. This release involved a complete refactor of QuESTlink's C++ backend which is now more modular, defensively-designed, and enables backend circuit-level optimisations and functions. It also adds native MacoS ARM (M1) support through the efforts of @rrmeister.

New features

  • ApplyCircuitDerivs
  • CalcExpecPauliStringDerivs
  • CalcMetricTensor

The above functions perform automatic differentiation of quantum circuits and channels, enabling simulation of routines like noise-aware quantum natural gradient. They employ the author's novel algorithms (for gradients and metric tensors, and their noisy forms in Ch 5.7) to run asymptotically faster than the state-of-the-art. They furthermore totally relax ansatz constraints, permitting repetition of parameters, multi-parameter gates, and gates featuring any continuously differentiable functions of ansatz parameters.

  • CalcPauliStringMinEigVal computes the lowest eigenvalue of a Pauli string using a sparse iterative scheme, and is exponentially more efficient than numerical parallel methods (like Min @ Eigenvalues @ CalcPauliStringMatrix) for many-qubit strings with few terms.
  • GetKnownCircuit can now generate "TrotterAnsatz", "LowDepthAnsatz" and "HardwareEfficientAnsatz"
  • Error messages from functions which accept circuits (like CalcCircuitMatrix and ApplyCircuit) now include the specific erroneous gate.

Convenience functions

  • GetRandomPauliString
  • SetQuregToPauliString

do exactly what they say!

New gates

  • Fac
  • UNonNorm

are now accepted by all circuit-accepting functions, which respectively scale the full quantum state by an arbitrary complex scalar, and apply a unitary gate albeit with no enforced normalisation. UNonNorm replaces the previous use of gate Matr.

  • SampleClassicalShadow encodes a density matrix into a number of sampled Pauli product outcomes, producing a classical shadow.
  • DrawCircuit will now draw global phase gates (G) and identitys (Id) within Pauli gadgets (R)
  • CreateDownloadedQuESTEnv[] will now report its progress and throw errors upon timeout or connection issues

Changes

  • CalcCircuitMartrix will now simplify channels by (default) asserting them to be completely-positive and trace-preserving (togged with optional argument AssertValidChannels)
  • CalcDensityInnerProduct and CalcDensityInnerProducts now return complex scalars, and so will have non-real components for non-normalised inputs. Finite precision effects may mean these functions return negligible imaginary components for normalised density matrices which can be removed with Chop
  • CalcPauliExpressionMatrix now returns a sparse matrix for more efficient handling of large operators, especially symbolic ones with few terms.
  • Matr now describes a gate which is never asserted unitary, and hence is only left-multiplied onto density-matrices.
  • MixDamping, MixDephasing, MixDepolarising, MixTwoQubitDephasing and MixTwoQubitDepolarising have been deprecated, since they can each be performed with ApplyCircuit
  • CalcQuregDerivs has been replaced with the (significantly extended) ApplyCircuitDerivs, though the change is backwards compatible.
  • All mentions of PauliSum in the API have been replaced with PauliString, though the change is backwards compatible.

Bug fixes

  • patched CreateLocalQuESTEnv on Windows
  • CalcCircuitMatrix and ApplyCircuit now accept a Pauli gadget (R) containing Id Pauli operators
  • CreateDownloadedQuESTEnv no longer hangs when download fails

v0.11

04 Jul 14:11
Compare
Choose a tag to compare

This major release significantly extends QuESTlink's analytic circuit processing capabilities.

New features

  • GetCircuitInverse[] returns an inverse circuit in terms of canonical symbolic gates
  • SimplifyCircuit[] returns an equivalent but simplified circuit in terms of fewer, simplified gates
  • GetKnownCircuit[] dynmically generates canonical circuits, like QFT and Trotterisations.
  • CalcCircuitMatrix[] can now return an analytic superoperator matrix encoding a quantum channel
  • Matr is a general matrix gate symbol which does not enforce unitarity
  • GetCircuitGeneralised[] returns an equivalent circuit composed only of general matrix gates
  • GetCircuitSuperoperator[] returns a symbolic circuit of canonical gates which encodes the Choi–Jamiołkowski superoperator equivalent to the input circuit

Changes

  • Gate symbols (like X and C) are now protected and cannot be accidentally overriden
  • CalcCircuitMatrix will now halt and throw an informative error message when encountering an unrecognised gate
  • Functions accepting Pauli Hamiltonians (e.g. ApplyPauliSum, CalcExpecPauliSum, CalcPauliSumMatrix) will now gracefully ignore zero scalars.

v0.10

21 Apr 10:16
Compare
Choose a tag to compare

This is a non-feature release, to:

  • generate a Zenodo DOI
  • updates the QuEST core to v3.5.0 for bug patches