Releases: QTechTheory/QuESTlink
v0.19
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 inv0.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. -
GetRandomCircuitFromChannel[]
(ofv0.12
) randomly returns one of the channel's decomposed pure circuits (like above), weighted by its classical probability. -
SampleExpecPauliString[]
estimates a noisy expectation value through Monte Carlo sampling of statevector simulation, avoiding quadratically more expensive density-matrix simulation. -
GetCircuitConjugated[]
returns a circuit with a Z-basis matrix equal to the complex conjugate of that of the given circuit. -
GetPauliString[]
can now simultaneously accept specification of both the target qubits, and the number of final Paulis to keep in the string (padding withId
). This enables users to (e.g.) specify an8x8
matrix encoding the Paulis upon qubits{2,4,7}
, and further request that the output string acts upon5
qubits. -
Option
AssertValidChannels -> False
to functions likeCalcCircuitMatrix[]
now further relaxes the assumption that the operator parameters (like rotation strength) are real. This is necessary for obtaining the correct results from functions likeGetCircuitSuperoperator[]
andCalcPauliTransferMatrix[]
when you wish to permit all symbols to be completely general.
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. -
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). -
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:
Bug fixes
-
patched a catastrophic error in
SimplifyPaulis[]
whereby multiplication of same-target operatorsX*Z
andZ*X
produced an incorrect sign. A warning of this bug is temporarily reported when callingImport["...questlink.m"]
-
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 (likeCalcExpecPauliString[]
) 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 returnedNull
instead of$Failed
. -
fixed a typo in the real-time simulation demo. Thanks to the hawk-eyed @GibbsJR !
v0.18
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.
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). -
GetPauliStringReformatted[]
converts a Pauli string into other forms more convenient for interpreting or processing. -
GetPauliStringRetargeted[]
can change the targeted qubits of a Pauli string, analogous toGetCircuitRetargeted[]
. -
GetPauliStringOverlap[]
finds basis Pauli strings common to given weighted sums, returning their (conjugated) product in a manner analogous to an inner-product.
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. -
CalcPauliTransferMap[]
computes the operator'sPTMap
which describes how the operator would modify (when applied in conjugation upon) a Pauli string. -
DrawPauliTransferMap[]
visualises aPTMap
as a graph, showing how the equivalent operator would successively modify (when applied in conjugation) Pauli strings.This extends QuESTlink's family of methods to visually study quantum circuits.
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).CalcPauliTransferEval[]
returns the full evolution history of a Pauli string as it is modified by the successive PTMs of a circuit.DrawPauliTransferEval[]
visualises the evolution of the Pauli string.
Changes
- deprecated
GetPauliStringFromCoeffs[]
(behaviour now merged intoGetPauliString[]
) - deprecated
GetPauliStringFromMatrix[]
(behaviour now merged intoGetPauliString[]
) - renamed
RetargetCircuit[]
toGetCircuitRetargeted[]
- 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 byGetCircuitSuperoperator[]
(formerly throwing an error).
v0.17
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. -
CalcCircuitGenerator[]
which returns the Pauli string generator of the given circuit. -
RetargetCircuit[]
remaps the qubits in a circuit -
GetQuregState[]
which is equivalent to the oldGetQuregMatrix[]
, can return the state in alternate basis and representations. -
GetCircuitQubits[]
which returns a list of the qubit indices featured in a given circuit. -
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 byRetargetCircuit[]
Other changes
- added two new demo notebooks on variational minisation, and real-time simulation, to
/Demos
- removed old, defunct demo notebooks
v0.16
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"
. -
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 formcoeff/sqrt(fx (x1-x2-dx)^2 + fy (y1-y2-dy)^2 + ...)
Bug fixes
- patched
GetCircuitGeneralised[]
which previously incorrectly handled control qubits, producingU
gates of matrices with incorrect dimensions, raising an error in subsequent QuESTlink functions. - patched
SimplifyCircuit[]
which previously incorrectly merged adjacentU
gates on same-target general unitaries; the order of their matrices in the product was reversed.
v0.15
This minor release patches a bug introduced in v0.14
.
Bug fixes
-
restored passing of
Kraus
andKrausNonTP
operators toApplyCircuit
(and to related functions likeApplyCircuitDerivs
). Versionv0.14
changed how Mathematica matrices are encoded into C++ structures, so that gatesU
,UNonNorm
andMatr
can accept matrices specified diagonally. This inadvertently disabled passingKraus
operator matrices. -
temporarily disabled pretty frontend rendering of matrices (via
MatrixForm
) in the error messages of operatorsU
,UNonNorm
,Matr
,Kraus
andKrausNonTP
. 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:
will now be rendered as:
so as to avoid invoking the occassional Mathematica frontend bug and rendering as
v0.14
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
andMatr
, 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 likeApplyCircuit[]
), and bespoke/optimised Mathematica handling (invoked by functions likeCalcCircuitMatrix[]
andSimplifyCircuit[]
).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[]
andCalcExpecPauliStringDerivs[]
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 aMatr[]
operator upon a density matrix.
Precisely; the existingMatr
gate modifies density matricesrho
under
rho -> Matr rho
Previously,
ApplyCircuitDerivs[]
would compute the derivative ofMatr
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[]
andCalcMetricTensor[]
, which already forbid non-trace-preserving operators likeMatr
.
v0.13
This is a minor release with some quality-of-life improvements and patches.
Changes
InsertCircuitNoise[]
andGetCircuitSchedule[]
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 returnedthey now return{ {t0, {gates0}}, {t1, {gates1}} }
This final time is rendered by{ {t0, {gates0}}, {t1, {gates1}}, {t2, {}} }
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 usingQuiet[]
- Projector gate
P
now accepts a list of qubit outcomes, in addition to those outcomes being passed as arguments. Explicitly, equivalent gatesP[{1,1,0}]
,P[1,1,0]
andP[6]
are now accepted.
Bug fixes
- patched
GetUnsupportedGates[]
which was accidentally disabled by a previous improvement to input validation. - patched
ViewDeviceSpec[]
which was verbosely includingCircuit[]
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
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 (likeMin @ 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
andApplyCircuit
) 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 argumentAssertValidChannels
)CalcDensityInnerProduct
andCalcDensityInnerProducts
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 withChop
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
andMixTwoQubitDepolarising
have been deprecated, since they can each be performed withApplyCircuit
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 withPauliString
, though the change is backwards compatible.
Bug fixes
- patched
CreateLocalQuESTEnv
on Windows CalcCircuitMatrix
andApplyCircuit
now accept a Pauli gadget (R
) containingId
Pauli operatorsCreateDownloadedQuESTEnv
no longer hangs when download fails
v0.11
This major release significantly extends QuESTlink's analytic circuit processing capabilities.
New features
GetCircuitInverse[]
returns an inverse circuit in terms of canonical symbolic gatesSimplifyCircuit[]
returns an equivalent but simplified circuit in terms of fewer, simplified gatesGetKnownCircuit[]
dynmically generates canonical circuits, like QFT and Trotterisations.CalcCircuitMatrix[]
can now return an analytic superoperator matrix encoding a quantum channelMatr
is a general matrix gate symbol which does not enforce unitarityGetCircuitGeneralised[]
returns an equivalent circuit composed only of general matrix gatesGetCircuitSuperoperator[]
returns a symbolic circuit of canonical gates which encodes the Choi–Jamiołkowski superoperator equivalent to the input circuit
Changes
- Gate symbols (like
X
andC
) 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
This is a non-feature release, to:
- generate a Zenodo DOI
- updates the QuEST core to v3.5.0 for bug patches