Paddle-quantum

Latest version: v2.4.0

Safety actively analyzes 622940 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

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 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 **Q**uantum **A**pplication **M**odel **L**ibrary (QAML) as follows.

1. [Credit Risk Analysis](./applications/credit_risk_analysis/introduction_en.ipynb)
2. [Deuteron Binding Energy](./applications/deuteron_binding_energy/introduction_en.ipynb)
3. [Handwritten Digits Generation](./applications/handwritten_digits_generation/introduction_en.ipynb)
4. [Intent Classification](./applications/intent_classification/introduction_en.ipynb)
5. [Power Flow Optimization](./applications/power_flow/introduction_en.ipynb)
6. [Random Number Generation](./applications/random_number/introduction_en.ipynb)

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](./introduction/PaddleQuantum_Ansatz_EN.ipynb)
2. [Customized Gate and Channel](./introduction/PaddleQuantum_Custom_EN.ipynb)
3. [Generation of Hamiltonian](./introduction/PaddleQuantum_Hamiltonian_EN.ipynb)
4. [Common Algebraic Functions](./introduction/PaddleQuantum_Linalg_and_Qinfo_EN.ipynb)
5. [Usage of State](./introduction/PaddleQuantum_State_EN.ipynb)
6. [Construction and Training of QNNs](./introduction/PaddleQuantum_Training_EN.ipynb)

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.

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 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 **Q**uantum **A**pplication **M**odel **L**ibrary (QAML) is newly added in Paddle Quantum in this release. The applications currently included in QAML are as follows.

1. [Handwritten digits classification](./applications/handwritten_digits_classification/introduction_en.ipynb)
2. [Molecular ground state energy & dipole moment calculation](./applications/lithium_ion_battery/introduction_en.ipynb)
3. [Text classification](./applications/text_classification/introduction_en.ipynb)
4. [Protein folding](./applications/protein_folding/introduction_en.ipynb)
5. [Medical image classification](./applications/medical_image_classification/introduction_en.ipynb)
6. [Quality detection](./applications/quality_detection/introduction_en.ipynb)
7. [Option pricing](./applications/option_pricing/introduction_en.ipynb)
8. [Quantum portfolio optimization](./applications/portfolio_optimization/introduction_en.ipynb)
9. [Regression](./applications/regression/introduction_en.ipynb)
10. [Quantum linear equation solver](./applications/linear_solver/introduction_en.ipynb)

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.

2.2.2

Release Note

New Features

- `paddle_quantum.ansatz.Circuit`:
- New member function `plot`: now we can plot the circuit using [matplotlib](https://matplotlib.org/).
- `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](https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information).
- 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](https://arxiv.org/abs/2209.14278). 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)](https://ojs.aaai.org/index.php/AAAI/article/view/17016) model and related functionals.

Improvements

- `paddle_quantum.linalg`: inputs of functions are now compatible with `paddle_quantum.state.State`, `paddle.Tensor`and `numpy.ndarray`.
- `paddle_quantum.qinfo`:
- Inputs of functions are now compatible with `paddle_quantum.state.State`, `paddle.Tensor`and `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.

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`: 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`.

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](https://qml.baidu.com/tutorials/overview.html), [API documentation](https://qml.baidu.com/api/introduction.html), and [the source code](https://github.com/PaddlePaddle/Quantum).

New Features

- We now support connecting to a real quantum computer via [QuLeaf](https://github.com/baidu/QCompute), 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.

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 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.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.