qilimanjaro-tech/qilisdk: 0.1.8
Authors/Creators
- 1. @qilimanjaro-tech
- 2. Qilimanjaro Quantum Tech
- 3. GIQ, Universitat Autonoma de Barcelona
Description
Features
Users can now set the environment variable
QILISDK_COMPLEX_PRECISIONto eitherCOMPLEX_64orCOMPLEX_128, making it easy to globally select the complex dtype used across dense and sparse matrices; if the variable is unset we continue to default to the project-wide precision defined insettings.py. (PR #98)Hamiltonian class now has a get_commuting_partitions() method, which generates partitions each containing only commuting Pauli strings. This is useful for time evolution, since each partition can then be trivially exponentiated without Trotterization. (PR #113)
All parameterizable gates (i.e. RX, RY, RZ, U1, U2, U3) now accept Terms rather than only Parameters, allowing for more general expressions. This is useful if one wants two gates in the same circuit parameterized by the same variable, but with different scaling, e.g. Rz(2theta) and RZ(3theta). (PR #113)
Added a QAOA ansatz, as well as corresponding documentation. This ansatz combines a problem Hamiltonian and a mixer Hamiltonian, performing the alternating time evolution of both, scaled by some parameters. By adjusting the values of said parameters using a Variational functional, the energy of the problem Hamiltonian is minimized thus a solution to the original problem is found. (PR #113)
HardwareEfficientAnsatz now supports explicit specification of connectivity via a list of tuples. (PR #116)
Added support for gates with multiple controls in QuTiP and CUDA backends. (PR #117)
Added method to generate a randomized circuit from a set of single- and two-qubit gates, providing a useful tool for benchmarking. Usage is as follows:
from qilisdk.digital import Circuit, X, H, CNOT c = Circuit.random( nqubits=3, single_qubit_gates=[X, H], two_qubit_gates=[CNOT], ngates=10, )(PR #126)
Added a new simulation backend: QiliSim. This is an internal simulator written in C++. It offers improved performance compared to the QuTiP CPU simulator and can even be faster than the CUDA backend for some small test cases. Both circuit simulation and time evolution are supported. There are a number of time evolution methods: direct exponention, Anrolid/Krylov exponentiation, RK4 integration, and Monte Carlo (which can be combined with any of the previous methods).
Circuit sampling with QiliSim can be done as follows:
from qilisdk.digital import Circuit, H, CNOT from qilisdk.functionals import Sampling from qilisdk.backends import QiliSim # Create a 2‑qubit circuit circuit = Circuit(2) circuit.add(H(0)) circuit.add(CNOT(0, 1)) # Initialize the Sampling functional with 1000 shots sampling = Sampling(circuit=circuit, nshots=1000) # Use the QiliSim backend to execute the sampling backend = QiliSim() result = backend.execute(sampling) print(result)Time evolution with QiliSim can be done as follows:
from qilisdk.analog import Schedule, X, Z, Y from qilisdk.core import ket, tensor_prod from qilisdk.core.interpolator import Interpolation from qilisdk.backends import QiliSim from qilisdk.functionals import TimeEvolution # Define total time and timestep T = 10.0 dt = 0.5 nqubits = 1 # Define Hamiltonians Hx = sum(X(i) for i in range(nqubits)) Hz = sum(Z(i) for i in range(nqubits)) # Build a time‑dependent schedule schedule = Schedule( hamiltonians={"driver": Hx, "problem": Hz}, coefficients={ "driver": {(0.0, T): lambda t: 1 - t / T}, "problem": {(0.0, T): lambda t: t / T}, }, dt=dt, interpolation=Interpolation.LINEAR, ) # Prepare an equal superposition initial state initial_state = tensor_prod([(ket(0) - ket(1)).unit() for _ in range(nqubits)]).unit() # Create the TimeEvolution functional time_evolution = TimeEvolution( schedule=schedule, initial_state=initial_state, observables=[Z(0), X(0), Y(0)], nshots=100, store_intermediate_results=False, ) # Execute on the QiliSim backend and inspect results backend = QiliSim() results = backend.execute(time_evolution) print(results)(PR #126)
Introduced noise model abstractions with digital, analog, and parameter noise classes.
Example:
from qilisdk.noise_models import ( DissipationNoise, KrausNoise, NoiseModel, ParameterNoise, ) from qilisdk.digital import X import numpy as np op = QTensor(np.array([[1.0, 0.0], [0.0, 1.0]])) model = NoiseModel() model.add(KrausNoise(kraus_operators=[op], affected_qubits=[0], affected_gates=[X])) # OR model.add(DissipationNoise(jump_operators=[op])) # OR model.add(ParameterNoise(affected_parameters=["theta"], noise_std=0.05))(PR #127)
Noise model support added to the CudaBackend. Now, when executing a functional using the CudaBackend, the given noise model is used to perform a noisy simulation. (PR #131)
Added internal support for density matrix initial states when simulating circuits in QiliSim, as well as Monte-Carlo simulation. (PR #141)
Added TrotterizedTimeEvolution with state initialization, introduced reusable trotterization utilities, tightened time-evolution state validation. Circuit now supports list-based add/insert, circuit append/prepend, and gate/circuit addition operators with new tests and documentation for those behaviors. Expanded docs/tests for trotterization, QAOA behavior, and backends.
Examples:
from qilisdk.analog.hamiltonian import Z from qilisdk.analog.schedule import Schedule from qilisdk.digital import H from qilisdk.digital.ansatz import TrotterizedTimeEvolution schedule = Schedule( hamiltonians={"h": Z(0)}, coefficients={"h": {0.0: 1.0, 1.0: 1.0}}, dt=0.1, total_time=1.0, ) ansatz = TrotterizedTimeEvolution( schedule=schedule, trotter_steps=2, state_initialization=[H(0)], ) ansatz.draw()from qilisdk.analog.hamiltonian import X, Z from qilisdk.utils.trotterization import trotter_evolution hamiltonian = X(0) + 2 * Z(0) gates = list(trotter_evolution(hamiltonian, time=0.5, trotter_steps=2))(PR #193)
Bugfixes
- Fixed the Hamiltonian
to_matrix()andto_qtensor()routines to skip unnecessary sparse→dense→sparse conversions by caching single-qubit factors, resulting in noticeably faster tensor construction for medium- and large-qubit systems. (PR #98) - Parameters with equal bounds (i.e. min == max) are no longer optimized. (PR #113)
- Reworked analog schedule timing so
Tderives from coefficients or an explicit max time andtlistis generated fromdt, with all backends/renderers consuming the same steps (and tests adjusted accordingly); the interpolator now validates overlapping intervals, keeps interval endpoints only, and is exported viaqilisdk.core; QuTiP builds Hamiltonians viato_qtensor(...).dense()with correct dimensions (PR #118) - Fixed a bug in which the CUDA backend would throw an error if given a gate with an integer parameter, e.g. RX with theta=1. (PR #120)
- Added a extra check at the end of the variational program evaluation to confirm that the parameters that are being passed to the functional are actually valid. Provide a more helpful error message in case the optimizers fail. (PR #121)
- Optional dependency handling is now more robust: missing optional symbols are exported as attribute-aware stubs so both calling them and accessing members (e.g.
SpeQtrum.login()) raises an informativeOptionalDependencyErrorwith the correctpip install qilisdk[extra]hint, and optional imports fall back to stubs even when a dependency is installed but fails during import. (PR #125) - The test suite no longer errors during collection when optional extras aren't installed; optional-feature tests (CUDA, QuTiP, SpeQtrum, OpenFermion) are skipped via
pytest.importorskip(..., exc_type=ImportError)unless their dependencies can be imported. (PR #125) - Fixed a Dependabot-reported vulnerability of
nbconvertby updating the affected dependency to a safe version. (PR #144)
Improved Documentation
- Added information about the C++ requirements to the README, as well as more informative error messages if a compiler is not available. This only concerns installing from source, when installing QiliSDK from pypi (i.e. "pip install qilisdk") a compiler will not be needed as there will be prebuild wheels available. (PR #145)
- Updated TimeEvolution documentation examples (backends, functionals, cost_functions) to use the new Schedule signature with explicit driver/problem Hamiltonians, coefficient mappings, and linear interpolation import. (PR #119)
- Documentation has been updated to include a section about noise models, detailing their usage in QiliSDK as well as a brief mathematical description of each supported noise type. (PR #131)
- Fixed Time Evolution example in the code examples in the docs. (PR #133)
Deprecations and Removals
- Removed
kwargsfrom the constructors of theScheduleandInterpolatorclasses. (PR #122)
Misc
Files
qilimanjaro-tech/qilisdk-0.1.8.zip
Files
(1.2 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:b9c68d67e4415401976dd268af449b0e
|
1.2 MB | Preview Download |
Additional details
Related works
- Is supplement to
- Software: https://github.com/qilimanjaro-tech/qilisdk/tree/0.1.8 (URL)
Software
- Repository URL
- https://github.com/qilimanjaro-tech/qilisdk