Releases: PaddlePaddle/Quantum
Paddle Quantum 2.4.0
Release Note
Improvements
- Accelerated circuit executions, providing 2-4 times speed-up compared to the previous version. Specifically, over 10 times speed-up for specific quantum neural network models.
New Features
paddle_quantum.gate
:Gate
is now a child class ofpaddle_quantum.channel.Channel
, and hence inherits most functionalities from thechannel
module, such as its Choi representationGate.choi_repr
.- New module
matrix
: provides user access to the matrices of gates in Paddle Quantum. - New gate
ParamOracle
: provides user access to customized parameterized gates.
paddle_quantum.qinfo
:- New function
pauli_str_convertor
: Concatenate the input observable with coefficient 1.
- New function
paddle_quantum.loss.ExpecVal
:- Now
ExpecVal.forward()
can return the decomposed expectation value by settingdecompose=True
.
- Now
paddle_quantum.state.State
:- Now
State.measure()
can record the result in each shot by settingrecord=True
.
- Now
New Applications
New applications have been added in the Quantum Application Model Library (QAML) as follows.
- Credit Risk Analysis
- Deuteron Binding Energy
- Handwritten Digits Generation
- Intent Classification
- Power Flow Optimization
- Random Number Generation
New Tutorials
More tutorials are introduced in Paddle Quantum 2.4.0, to offer suggested usages in common scenarios of quantum research. These tutorials are listed as follows:
- Construction and Manipulation of Circuit
- Customized Gate and Channel
- Generation of Hamiltonian
- Common Algebraic Functions
- Usage of State
- Construction and Training of QNNs
Bug Fixes
- Fix some typos and mistakes in the tutorials and the API docs.
- Strengthen the overall stability of Paddle Quantum.
Dependencies
paddlenlp
: newly added.
Paddle Quantum 2.3.0
Release Note
New Features
paddle_quantum.channel
:- New module
paddle_quantum.channel.representation
: A library of representations of quantum channels in Paddle Quantum. - New channel
GeneralizedDepolarizing
and its interface inpaddle_quantum.ansatz.Circuit
: A generalized depolarizing channel. - New member properties
choi_oper, kraus_oper, stinespring_oper
ofChannel
: Provide user accesses to the Choi, Kraus and Stinespring representations of classChannel
and its subclasses.
- New module
paddle_quantum.linalg
:- New function
is_positive
: Check whether the input matrix is a positive semi-definite matrix. - New function
pauli_basis_generation
: Generate a Pauli basis. - New function
pauli_decomposition
: Decompose the input matrix by the Pauli basis. - New function
subsystem_decomposition
: Decompose the input matrix by two given bases in two subsystems.
- New function
- New module
paddle_quantum.model
: Provides integrated features such as training of quantum neural networks (QNN), prediction using the trained models, and convenient accesses to the optimizers and the schedulers of Paddle Paddle.OptModel
: The class for the optimization-based QNN model.LearningModel
: The class for the learning-based QNN model.EncodingModel
: The class for the encoding-based QNN model.
paddle_quantum.qinfo
:- New function
is_choi
: Check whether a quantum operator is a Choi operator. - New function
permute_systems
: Permute the quantum systems based on a permute list. - New function
channel_repr_convert
: Provide transformations among Choi, Kraus and Stinespring representations of a channel. PS: substitute the original functionchannel_convert
. - New function
random_channel
: Generate a random channel. - New function
grover_generation
: Generate a Grover operator based on the oracle given. - New function
qft_generation
: Generate a unitary matrix for the circuit of quantum Fourier transform.
- New function
Built-in model library
Paddle Quantum now provides the built-in QNN model and the other quantum algorithms. The users can use these models and algorithms to implement the quantum applications quickly. The built-in models and algorithms are as follows.
biocomputing
: Provides the protein folding algorithms based on protein lattice model and CVaR loss function.data_analysis
: Provides the variational quantum regression (VQR) and the variational quantum linear solver (VQLS) model.finance
: Provides the quantum option pricing algorithm and the quantum portfolio optimization algorithm.qchem
: Provides native support for molecular construction and interfaces to external quantum chemistry packages (Molecule, PySCFDriver), add more powerful quantum chemistry ansatz (UCC, HartreeFock), provides support for defining fermionic quantum state (WaveFunction), and add more tools for estimating molecular properties (symmetric_rdm1e, dipole_moment).qml
: Provides the quantum neural network for medical image classification (QNNMIC), the quantum neural network for quality detection (QNNQD), the quantum self-attention neural network (QSANN), and the variational shadow quantum learning (VSQL) model.
New applications
The Quantum Application Model Library (QAML) is newly added in Paddle Quantum in this release. The applications currently included in QAML are as follows.
- Handwritten digits classification
- Molecular ground state energy & dipole moment calculation
- Text classification
- Protein folding
- Medical image classification
- Quality detection
- Option pricing
- Quantum portfolio optimization
- Regression
- Quantum linear equation solver
Bug Fixes
- Fix some typo and mistakes in the tutorials and the API docs.
Improvements
- The qchem tutorials has been updated to fit new APIs.
Dependencies
imbalanced-learn
: newly added.
Paddle Quantum 2.2.2
Release Note
New Features
paddle_quantum.ansatz.Circuit
:- New member function
plot
: now we can plot the circuit using matplotlib.
- New member function
paddle_quantum.gate
:- New Gate
Sdg
: dagger of the S gate - New Gate
Tdg
: dagger of the T gate
- New Gate
- New Gate member
gate_info
: contains the necessary information for theGate
class. You can revise this member to adjust the appearance of a particular gate class inCircuit.plot
. paddle_quantum.channel
:- New Channel
MixedUnitaryChannel
: a random mixed unitary channel. - Kraus operator of the
Depolarizing
channel is revised for consistency with the representation in QCQI. - New Channel
ChoiRepr
: a general quantum channel under the Choi representation.
- New Channel
- New Channel
StringspringRepr
: a general quantum channel under the Choi representation. paddle_quantum.state
:paddle_quantum.state.State
:- New member function
normalize
: provide the ability to be self-normalized. - New member function
evolve
: provide the ability of self-evolution for a given Hamiltonian and time. - New member function
kron
: Kronecker product forState
class.
- New member function
- New function
is_state_vector
: verify whether the input data is a legal state vector. - New function
is_density_matrix
: verify whether the input data is a legal density matrix.
- New operation
@
: matrix multiplication forState
class (underdensity_matrix
backend). paddle_quantum.qpp
: new module, providing a systematic set of tools for quantum phase processing. See the corresponding tutorial for more details.paddle_quantum.qml
: new module that includes models in the domain of QML. Currently it contains the VSQL (Variational Shadow Quantum Learning) model and related functionals.
Improvements
paddle_quantum.linalg
: inputs of functions are now compatible withpaddle_quantum.state.State
,paddle.Tensor
andnumpy.ndarray
.paddle_quantum.qinfo
:- Inputs of functions are now compatible with
paddle_quantum.state.State
,paddle.Tensor
andnumpy.ndarray
.
- Inputs of functions are now compatible with
- Rewrite the logic of
partial_trace
,partial_trace_discontiguous
andpartial_transpose
using tensor contraction, significantly improving the performance of these three functions.
New Tutorials
Introduction
- Add the introduction part for the resolution of version conflict happened when using QuLeaf to connect the quantum computer.
Machine Learning
- Add the tutorial Variational quantum amplitude estimation which implements single-qubit variational quantum amplitude estimation (VQAE).
Quantum Simulation
- Add the tutorial Hamiltonian Simulation with qDRIFT which introduces a random method named quantum stochastic drift protocol (qDRIFT) which is based on product formula.
- Add the tutorial Quantum Phase Processing which provides access to the eigenphases of the target unitary, allowing phase transformation or extraction to be done in an efficient and precise manner.
- Add the tutorial Variational Quantum Metrology which introduces a variational method to search an optimal Ramsey interferometer for estimating the unknown parameters.
Bug Fixes
- Fix the bug in the
paddle_quantum.ansatz.vans
module caused by the implementation of the parameter gate. - Fix some typo and mistakes in the tutorials and the API docs.
Dependencies
cvxpy
: newly added.rich
: newly added.scipy
: remove the version restrictions.
Paddle Quantum 2.2.1
Release Note
New Features
paddle_quantum.ansatz
:- New member
depth
: return the depth of the circuit. - New member function
transfer_static
: make the circuit not trainable. - New member function
collapse
: addCollapse
operator into the circuit.
- New member
paddle_quantum.gate
:- New base gate
ParamGate
: base class for all parameterized gates, responsible for functions designed for parameterized gates. - New member
gate_name
and member functiongate_history_generation
: by simply defininggate_name
or overloadinggate_history_generation
, nowCircuit.gate_history
can read the gate history of your self-designed Gates. - New Gate
QAOALayerWeighted
: QAOA driving layers with weights.
- New base gate
paddle_quantum.operator
:- New operator
Collapse
: support (partially) collapse for quantum states.
- New operator
paddle_quantum.qsvt
: new module, providing tools for Chebyshev-based QSP & QSVT.- New class
ScalarQSP
: class for circuit and matrix generation in single-qubit QSP. - New class
QSVT
: class for circuit and matrix generation in QSVT.
- New class
paddle_quantum.state
:- In
state_vector
backend, classState
now can call its member propertiesState.ket
andState.bra
corresponding to ket and bra representations of the state.
- In
paddle_quantum.qinfo
:- Now support inputs for both
paddle.Tensor
andState
. - New function
tensor_product
:State
version ofNkron
. partial_trace
now support thestate_vector
backend.
- Now support inputs for both
New Convention for Parameterized Gates
If the dtype of input param
of ParamGate
is
None
, thenParamGate
will create its own (random) parameter.ParamBase
(generated bypaddle.create_parameter
), thenParamGate
will treatparam
as its own parameter.paddle.Tensor
but notParamBase
, thenParamGate
will treatparam
as a fixed input, even whenparam
is trainable (i.e. whenparam.stop_gradient
isFalse
).float
orIterable[float]
, thenParamGate
will treatparam
as a fixed input.
New Tutorial
Quantum Simulation
- Add the tutorial Quantum Signal Processing and Quantum Singular Value Transformation, which presents a brief but systematic illustration of QSP and QSVT.
Machine Learning
- Add the tutorial Data Encoding Analysis, which analyzes the effect of the width and depth of data encoding circuits on quantum states from the view of quantum information.
- Add the tutorial Quantum Neural Network Approximating Functions, which demonstrates how to use single-qubit QNNs to approximate any (scalable) square-integrable functions.
Bug Fixes
- Fix bug in the
vans
module. - Fix some typo and mistakes in the tutorials and api docs.
- Fix bug which cannot set the quleaf token rightly.
- Fix bug when the circuit has no trainable parameters in the
quleaf
backend. - Fix bug in the
CSWAP
class and theToffoli
class.
Dependencies
paddlepaddle
:2.2.0
to2.3.0
.scipy
: no less than1.8.1
.protobuf
: no greater than3.20.1
.
Paddle Quantum 2.2.0
Release Note
Breaking Change
We have made an incompatible upgrade to the code architecture, and the new version's structure and usage can be found in our tutorials, API documentation, and the source code.
New Features
- We now support connecting to a real quantum computer via QuLeaf, using
paddle_quantum.set_backend('quleaf')
to select QuLeaf as the backend. - We now support using
set_backend()
to switch to different backends. - We now support using the state fidelity and trace distance as the loss function to optimize.
- We now support using an oracle gate in a quantum circuit.
- Add the
VAns
feature, which can build shallower ansatzes by automatically inserting and removing gates during the optimization. - Add the UCCSD ansatz, which is frequently used in quantum chemistry.
- Add the
OneBodyDensityMatrix
class for measureing the one-body density matrix from a quantum state.
New Tutorials
QNN Research
- Add the tutorial VAns - Variable Ansatz, which presents a variable structure algorithm to build shallower ansatzes by automatically inserting and removing gates during the optimization.
- Temporarily remove the tutorial Calculating Gradient Using Quantum Circuit. It will be reworked and released after the relevant features have been refactored.
Introduction
- Improve the tutorial Quantum Chemistry in Paddle Quantum's qchem by adding the introduction to the new features.
- Temporarily remove the tutorial Frequently Used Functions in Paddle Quantum, which will be reworked and released soon.
Dependencies
qcompute
: newly added.interval
: removed.scikit-learn
: newly added.opencv-python
: newly added.
Paddle Quantum 2.1.3
Release Note
New Features
- Add the
schmidt_decompose()
function, which computes the Schmidt decomposition of a quantum state. - Add the
paddle_quantum.dataset
module, which provides the quantum version of common datasets, such as the MNIST dataset, the Iris dataset, etc. - Add the
QuantumFisher
and theClassicalFisher
classes, which compute the quantum Fisher information and the classical Fisher information. - Add the
expand()
method in theUAnsatz
class, which dynamically expands the number of qubits in a quantum circuit. - Add the
plot_density_matrix_graph()
function inpaddle_quantum.utils
, which visualizes a density matrix. - Add the
plot_multi_qubits_state_in_bloch_sphere()
function inpaddle_quantum.utils
, which plots independent systems with multiple qubit states on the Bloch sphere. - Add the
image_to_density_matrix()
function to encode an image as a quantum state.
Quantum Chemistry
- Add the
run_chem()
function inpaddle_quantum.qchem
which could use"hardware efficient"
ansatz and"hartree fock"
ansatz to calculate ground state energy for a given molecule. For details, please refer to our updated introduction to the quantum chemistry module. - Add the
QModel
class which could be used to define a customized variational ansatz for quantum chemistry calculation. For details, please refer to our updated introduction to the quantum chemistry module.
New Tutorials
Introduction
- Add the tutorial Quantum Chemistry in Paddle Quantum's qchem, which explains how to use our upgraded quantum chemistry module to do ground state energy calculation.
- Add the tutorial Frequently Used Functions in Paddle Quantum, which lists some frequently used functions in Paddle Quantum.
QNN Research
- Add the tutorial Quantum Fisher Information, which briefly introduces the concepts of the classical and quantum Fisher information, along with their applications in quantum machine learning, and shows how to compute them with Paddle Quantum.
Quantum Simulation
- Add the tutorial Distributed Variational Quantum Eigensolver Based on Schmidt Decomposition, which demonstrates how to implement a distributed quantum algorithm using Paddle Quantum.
Improvements
- Improve the simulator performance in state_vector mode.
- Update the introduction tutorial, including some typo fixes.
- The
partial_trace_discontiguous()
function is now available. - The
construct_h_matrix()
method in theHamiltonian
class now supports specifying the number of qubits. - Enhance the performance of the Hamiltonian simulation experimentally, referring to the paper Optimal quantum circuits for general two-qubit gates.
- Upgrade some tutorials with the latest code features.
Bug Fixes
- Fix the bug in the
von_neumann_entropy()
function. Now it skips eigenvalue zero in the calculation process. - Fix the bug in the
update_param()
method which is caused by the incompatible update of the PaddlePaddle. - Fix the plot error in MAXCUT and DC-QAOA tutorials.
- Fix the bug in the
get_1d_heisenberg_hamiltonian()
function. - Fix typos in the docs of
cy
andcz
gates. - Fix some typos in tutorials.
Dependencies
paddlepaddle
: updated from>=2.1.2
to>=2.2.0
.openfermion
: newly added.pyscf
: newly added for Linux and macOS platforms.
Paddle Quantum 2.1.2
Release Note
New Modules
Quantum chemistry module
Add the quantum chemistry module paddle_quantum.qchem
. This module, depending on Psi4
and OpenFermion
, can construct Hamiltonian applicable to quantum computers from chemical molecular structure and supports most platforms. To use the qchem
module, please refer to the README file.
Time evolution simulation module
Add the module paddle_quantum.trotter
for constructing circuits that simulate the time evolution of quantum systems. Arbitrarily high order Trotter-Suzuki circuits are provided as a built-in function construct_trotter_circuit()
. Additionally, users can design custom time evolution circuits with user-specified permutation and coefficients. For more detailed usage, please refer to our tutorials on Hamiltonian simulation.
Measurement-based quantum computation module
Add the measurement-based quantum computation (MBQC) module paddle_quantum.mbqc
. It supports the simulation of universal quantum computing with the MBQC model. Unlike the conventional quantum circuit model, MBQC has its unique way of computing and thus common circuit simulation tools cannot be directly used for the simulation of this model.
Along with this new module, we also provide some examples and tutorials. The provided examples are QAOA (Quantum Approximate Optimization Algorithm), VQSVD (Variational Quantum Singular Value Decomposition), and QKernel.
New Tutorials
Quantum chemistry
- Add the tutorial Building Molecular Hamiltonian under the
quantum_simulation
folder, which explains how to obtain a Hamiltonian from a molecular structure.
Classical shadow
- Add the tutorial The Classical Shadow of Unknown Quantum States under the
quantum_simulation
folder, which introduces the concept of classical shadow and its application. - Add the tutorial Estimation of Quantum State Properties Based on the Classical Shadow under the
quantum_simulation
folder, which shows how to estimate the expectation value of an observable using classical shadow.
Hamiltonian simulation
- Add the tutorial Hamiltonian Simulation with Product Formula under the
quantum_simulation
folder, which shows how to perform digital quantum simulations based on Suzuki product formula. - Add the tutorial Simulate the Spin Dynamics on a Heisenberg Chain under the
quantum_simulation
folder, which demonstrates how to simulate the time evolution of a one-dimensional Heisenberg chain using both the built-in Trotter-Suzuki circuit and the custom time evolution circuits in Paddle Quantum.
QNN expressibility
- Add the tutorial Expressibility of Quantum Neural Network under the
qun_research
folder, which introduces a method for quantitatively analyzing the expressibility of quantum neural networks and evaluates the expressibility of quantum neural network templates provided by Paddle Quantum at different depths.
Quantum compiling
- Add the tutorial Variational Quantum Circuit Compiling under the
qnn_research
folder, which shows a process of simulating an unknown unitary operator by optimizing a parameterized quantum circuit.
Measurement-based quantum computation
- Add the tutorial MBQC Quick Start Guide under the
mbqc
folder, which explains the basic concepts of MBQC. - Add the tutorial Measurement-based Quantum Approximate Optimization Algorithm under the
mbqc
folder, which shows how to implement the QAOA algorithm in the MBQC mode. - Add the tutorial Polynomial Unconstrained Boolean Optimization Problem in MBQC under the
mbqc
folder, which shows how to solve the max-cut problem and a specific PUBO problem using the QAOA algorithm in the MBQC mode.
In addition to these new tutorials, we update the Quick Start manual to include how to draw and display a Bloch sphere using functions plot_state_in_bloch_sphere()
and plot_rotation_in_bloch_sphere()
from the module paddle_quantum.utils
. The tutorial Variational Quantum Eigensolver is also updated to making use of the new paddle_quantum.qchem
module.
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
.
Paddle Quantum 2.1.0
Release Note
Tutorials
-
Reorganize tutorials according to applications and research areas:
- Combinatorial Optimization
- LOCCNet
- Machine Learning
- QNN Research
- Quantum Simulation
-
Add five new tutorials:
- Large-scale QAOA via Divide-and-Conquer
- Encoding Classical Data into Quantum States
- Travelling Salesman Problem
- Quantum Kernel Methods
- Variational Shadow Quantum Learning
New Features
- Add two new types of noise models:
reset
andthermal_relaxation
. - Add four kinds of encoding methods, such that classical data can be encoded into quantum data via encoding functions:
basis_encoding
,amplitude_encoding
,angle_encoding
,iqp_encoding
. For more information about encoding, please refer to our encoding tutorial. - Add three two-qubit parameterized gates:
rxx
,ryy
,rzz
and two-qubit Mølmer–Sørensen gate (the native gate on ion-trap systems). - Add circuit drawer. The quantum circuit could be printed directly via
print(cir)
.
Paddle Quantum 2.0.1
Release Note
Noise model
Paddle Quantum now supports noise model, including amplitude_damping
, generalized_amplitude_damping
, phase_damping
, bit_flip
, phase_flip
, bit_phase_flip
, depolarizing
, pauli_channel
, customized_channel
. The noise model could efficiently simulate quantum channels by Paddle Quantum.
You can refer to this tutorial to learn how to use this module.
New features
GHZ_state
: Now you can generate the GHZ-state directly with Paddle Quantum.linear_entangled_layer
: The entangled layer consisting of Ry gates, Rz gates, and CNOT gates, which only connect to its neighbors.