Skip to content

Releases: PaddlePaddle/Quantum

Paddle Quantum 2.4.0

24 Apr 14:00
Compare
Choose a tag to compare

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 of paddle_quantum.channel.Channel, and hence inherits most functionalities from the channel module, such as its Choi representation Gate.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.
  • paddle_quantum.loss.ExpecVal:
    • Now ExpecVal.forward() can return the decomposed expectation value by setting decompose=True.
  • paddle_quantum.state.State:
    • Now State.measure() can record the result in each shot by setting record=True.

New Applications

New applications have been added in the Quantum Application Model Library (QAML) as follows.

  1. Credit Risk Analysis
  2. Deuteron Binding Energy
  3. Handwritten Digits Generation
  4. Intent Classification
  5. Power Flow Optimization
  6. 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:

  1. Construction and Manipulation of Circuit
  2. Customized Gate and Channel
  3. Generation of Hamiltonian
  4. Common Algebraic Functions
  5. Usage of State
  6. 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

18 Jan 11:19
Compare
Choose a tag to compare

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 in paddle_quantum.ansatz.Circuit: A generalized depolarizing channel.
    • New member properties choi_oper, kraus_oper, stinespring_oper of Channel: Provide user accesses to the Choi, Kraus and Stinespring representations of class Channel and its subclasses.
  • 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 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 function channel_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.

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.

  1. Handwritten digits classification
  2. Molecular ground state energy & dipole moment calculation
  3. Text classification
  4. Protein folding
  5. Medical image classification
  6. Quality detection
  7. Option pricing
  8. Quantum portfolio optimization
  9. Regression
  10. 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

07 Dec 08:29
Compare
Choose a tag to compare

Release Note

New Features

  • paddle_quantum.ansatz.Circuit:
    • New member function plot: now we can plot the circuit using matplotlib.
  • paddle_quantum.gate:
    • New Gate Sdg: dagger of the S gate
    • New Gate Tdg: dagger of the T gate
  • New Gate member gate_info: contains the necessary information for the Gate class. You can revise this member to adjust the appearance of a particular gate class in Circuit.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 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 for State class.
    • 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 for State class (under density_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 with paddle_quantum.state.State, paddle.Tensorand numpy.ndarray.
  • paddle_quantum.qinfo:
    • Inputs of functions are now compatible with paddle_quantum.state.State, paddle.Tensorand numpy.ndarray.
  • Rewrite the logic of partial_trace, partial_trace_discontiguous and partial_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

06 Sep 09:30
Compare
Choose a tag to compare

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: add Collapse operator into the circuit.
  • 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 function gate_history_generation: by simply defining gate_name or overloading gate_history_generation, now Circuit.gate_history can read the gate history of your self-designed Gates.
    • New Gate QAOALayerWeighted: QAOA driving layers with weights.
  • paddle_quantum.operator:
    • New operator Collapse: support (partially) collapse for quantum states.
  • 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.
  • paddle_quantum.state:
    • In state_vector backend, class State now can call its member properties State.ket and State.bra corresponding to ket and bra representations of the state.
  • paddle_quantum.qinfo:
    • Now support inputs for both paddle.Tensor and State.
    • New function tensor_product: State version of Nkron.
    • partial_trace now support the state_vector backend.

New Convention for Parameterized Gates

If the dtype of input param of ParamGate is

  • None, then ParamGate will create its own (random) parameter.
  • ParamBase (generated by paddle.create_parameter), then ParamGate will treat param as its own parameter.
  • paddle.Tensor but not ParamBase, then ParamGate will treat param as a fixed input, even when param is trainable (i.e. when param.stop_gradient is False).
  • float or Iterable[float], then ParamGate will treat param 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 the Toffoli class.

Dependencies

  • paddlepaddle: 2.2.0 to 2.3.0.
  • scipy: no less than 1.8.1.
  • protobuf: no greater than 3.20.1.

Paddle Quantum 2.2.0

19 May 14:36
Compare
Choose a tag to compare

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

10 Dec 16:31
Compare
Choose a tag to compare

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 the ClassicalFisher classes, which compute the quantum Fisher information and the classical Fisher information.
  • Add the expand() method in the UAnsatz class, which dynamically expands the number of qubits in a quantum circuit.
  • Add the plot_density_matrix_graph() function in paddle_quantum.utils, which visualizes a density matrix.
  • Add the plot_multi_qubits_state_in_bloch_sphere() function in paddle_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 in paddle_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 the Hamiltonian 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 and cz 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

27 Aug 07:28
Compare
Choose a tag to compare

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

17 Aug 10:40
71f4582
Compare
Choose a tag to compare

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.

Paddle Quantum 2.1.0

18 May 13:14
Compare
Choose a tag to compare

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 and thermal_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

09 Apr 14:58
Compare
Choose a tag to compare

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.