Release Note
New Features
More quantum gates
- Add controlled gates `cswap()`, `cy()`, `cz()`, `crx()`, `cyy()`, `crz()`, and `ccx()` in the `UAnsatz` class.
- Add the S dagger gate `sdg()` and the T dagger gate `tdg()` in the `UAnsatz` class
Gradient calculation
- Add the `ExpecVal` class in `paddle_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, including `ConjugateGradient`, `NewtonCG`, `Powell`, `SLSQP`, and `CustomOptimizer`. The `CustomOptimizer` class is a base class for all the other optimizers.
- Add `finite_difference_gradient()`, `param_shift_gradient()`, and `linear_combinations_gradient()` in the `UAnsatz` 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()` in `paddle_quantum.shadow` for sampling local Pauli measurement.
- Add `shadow_trace()` in the `UAnsatz` 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()` in `paddle_quantum.circuit` for constructing a swap test circuit.
- Add `reset_state()` in the `UAnsatz` class for resetting a partial state.
- Update `basis_encoding()`, `amplitude_encoding()`, and `angle_encoding()` to support encoding classical data to partial quantum state.
- Update `vec()` in `paddle_quantum.state` to support generating arbitrary computational basis state.
- Add `plot_state_in_bloch_sphere()` and `plot_rotation_in_bloch_sphere()` in `paddle_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 new `paddle_quantum.finance` module to solve these problems with quantum optimization algorithms.
Bug Fix
- Fix the bug of ``t()`` gate in `paddle_quantum.locc`.