Paddle Quantum 2.1.1
Release Note
New Features
More quantum gates
- Add controlled gates
cswap()
,cy()
,cz()
,crx()
,cyy()
,crz()
, andccx()
in theUAnsatz
class. - Add the S dagger gate
sdg()
and the T dagger gatetdg()
in theUAnsatz
class
Gradient calculation
- Add the
ExpecVal
class inpaddle_quantum.expecval
, which is a PaddlePaddle Python operator for calculating the expectation value of an observable w.r.t the quantum state output by a quantum circuit. It supports the computation of the gradient w.r.t. the circuit's parameters either through the finite difference method or the parameter-shift method. - Add the
paddle_quantum.optimizer
module for using SciPy optimizers to train a circuit, includingConjugateGradient
,NewtonCG
,Powell
,SLSQP
, andCustomOptimizer
. TheCustomOptimizer
class is a base class for all the other optimizers. - Add
finite_difference_gradient()
,param_shift_gradient()
, andlinear_combinations_gradient()
in theUAnsatz
class for computing the gradient of the expectation of an observable w.r.t. the parameters in a circuit.
Hamiltonian
Add the Hamiltonian
class in paddle_quantum.utils
for processing Hamiltonian. The main functions of this class are:
- Construct a Hamiltonian from a Pauli string;
- Get the matrix corresponding to the Hamiltonian;
- Get the Pauli string corresponding to the Hamiltonian;
- Addition, subtraction and scalar multiplication.
Classical shadow
- Add
shadow_sample()
inpaddle_quantum.shadow
for sampling local Pauli measurement. - Add
shadow_trace()
in theUAnsatz
class for estimating the expectation value of an observable through classical shadows.
Quantum finance
- Add the
paddle_quantum.finance
module for handling some finance optimization problems.
Other features
- Add
swap_test()
inpaddle_quantum.circuit
for constructing a swap test circuit. - Add
reset_state()
in theUAnsatz
class for resetting a partial state. - Update
basis_encoding()
,amplitude_encoding()
, andangle_encoding()
to support encoding classical data to partial quantum state. - Update
vec()
inpaddle_quantum.state
to support generating arbitrary computational basis state. - Add
plot_state_in_bloch_sphere()
andplot_rotation_in_bloch_sphere()
inpaddle_quantum.utils
for drawing a Bloch sphere.
New Tutorials
Gradient calculation
- Add the tutorial Calculating Gradient Using Quantum Circuit under the
qnn_research
folder, which explains how to calculate gradient with quantum circuits and then use PaddlePaddle's or SciPy's optimizers to train an ansatz.
Quantum finance
- Add three tutorials on Arbitrage Opportunity Optimization, Portfolio Optimization, and Portfolio Diversification under the
combinatorial_optimization
folder, which use the newpaddle_quantum.finance
module to solve these problems with quantum optimization algorithms.
Bug Fix
- Fix the bug of
t()
gate inpaddle_quantum.locc
.