PKTron - Pakistan's 1st Quantum AI Powered Simulation Framework
Project description
PKTron v3.2.3
Pakistan's First Quantum Computing Framework — Top #1 in South Asia, Top #1 Asian, and Top #5 Globally by Features & Modules
pip install pktron
pip install pktron==3.2.3
What's New in v3.2.3 (8 Major Fixes)
- Real GPU support — CuPy integration in StatevectorSimulator (silent fallback to NumPy)
- Real Bravyi-Kitaev — Full Fenwick tree implementation, any n ≤ 16, no JW fallback
- Real SABRE routing — Proper heuristic look-ahead, APSP distance matrix, δ=0.5 decay
- Quantum BoltzmannMachine — Real quantum circuits (RY+RZZ), parameter-shift training
- BeH2 Hamiltonian — Real STO-3G integrals, 64×64 Hermitian matrix, E₀ ≈ −15.58 Ha
- QuantumGAN — Real adversarial gradient exchange via parameter-shift rule
- HardwareBackend — mode='simulate'|'hardware', SDK stubs per backend, clear docstrings
- Version 3.2.3 —
__all__with 72 exports, docstrings, consistent metadata
Full Feature Set (72 public classes/functions)
Core Infrastructure
- Gate — Dataclass for quantum gates (name, qubits, params, matrix)
- QuantumCircuit — 30+ gate builder with method chaining (H, X, Y, Z, S, T, RX/RY/RZ, U3, CX, CY, CZ, SWAP, TOFFOLI, FREDKIN, CRX/CRY/CRZ, RZZ, custom gates)
- StatevectorSimulator — GPU-accelerated (CuPy) up to ~25 qubits, silent NumPy fallback
- execute() — Convenience wrapper for the default simulator
- Pauli constants — I, X, Y, Z, H_gate, S, Sdg, T, Tdg, RX, RY, RZ, U3, CNOT, CZ, SWAP, TOFFOLI, FREDKIN
Simulators (9)
| Simulator | Description |
|---|---|
| StatevectorSimulator | Exact statevector, GPU-ready via CuPy |
| DensityMatrixSimulator | Lindblad master equation with depolarizing, amplitude & phase damping |
| MPSSimulator | Matrix Product States via SVD, handles 100+ qubits |
| CliffordSimulator | Aaronson-Gottesman tableau, 1000+ qubits in polynomial time |
| QuantumTrajectorySimulator | Monte Carlo Wave Function (MCWF) for open systems |
| PEPSSimulator | 2D lattice Projected Entangled Pair States |
| MERASimulator | Multi-Scale Entanglement Renormalization Ansatz |
| TensorNetworkSimulator | Greedy contraction ordering |
| PulseLevelSimulator | Trotter-Suzuki pulse-level simulation |
Algorithms (15)
| Algorithm | Description |
|---|---|
| VQE | Variational Quantum Eigensolver, L-BFGS-B optimizer |
| QAOA + qaoa_max_cut | Quantum Approximate Optimization, Max-Cut |
| GroverSearch | O(√N/M) oracle calls |
| Shor | Integer factorization |
| QuantumFourierTransform | Exact QFT with circuit builder |
| QuantumPhaseEstimation | n-ancilla phase estimation |
| HHLAlgorithm | Linear systems Ax=b |
| SimonsAlgorithm | Hidden period finding |
| DeutschJozsa | Constant vs balanced oracle |
| QuantumWalk | Discrete (coin-based) and continuous-time |
| QuantumAnnealing | Transverse-field Ising QUBO solver |
| AmplitudeAmplification | Generalized Grover |
| QuantumCounting | QPE-based solution counting |
| QSVM | Quantum kernel SVM with SLSQP |
Quantum Error Correction (5)
| Code | Description |
|---|---|
| Steane7QEC | [[7,1,3]] code, X/Z syndrome measurement |
| SurfaceCode | Distance-3, 17-qubit patch, MWPM decoder |
| BaconShorCode | [[9,1,3]] subsystem code, gauge operators |
| ColorCode | [[7,1,3]] triangular lattice, lookup-table correction |
| RepetitionCode | Bit-flip or phase-flip, majority vote |
Error Mitigation (5)
| Method | Description |
|---|---|
| ZeroNoiseExtrapolation | Gate folding + Richardson extrapolation |
| ProbabilisticErrorCancellation | Quasi-probability decomposition |
| CliffordDataRegression | Near-Clifford training + linear regression |
| DynamicalDecoupling | XY4, XY8, and UDD sequences |
| ReadoutErrorMitigation | Calibration matrix inversion |
Quantum Chemistry (10 methods)
- Hamiltonians: H2, LiH, H2O, BeH2 (real STO-3G integrals, 64x64, E0 = -15.58 Ha)
- Transforms: Jordan-Wigner, Bravyi-Kitaev (Fenwick tree, n <= 16)
- Ansatze: UCC singles + doubles (Trotterized)
- Solvers: Full CI (exact diagonalization), qEOM (excitation energies), SSVQE (k excited states)
Quantum Machine Learning (8)
| Class | Description |
|---|---|
| QuantumNeuralNetwork | Parameter-shift gradients, RY+CX architecture |
| QuantumGAN | Real adversarial gradient exchange via parameter-shift |
| QuantumAutoencoder | Encoder/decoder QNNs for state compression |
| QuantumCNN | Sliding-window parametrized filters |
| QuantumBoltzmannMachine | Real quantum circuits (RY+RZZ), parameter-shift training |
| QuantumFederatedLearning | FedAvg aggregation across QNN clients |
| QuantumReinforcementLearning | Quantum policy network, REINFORCE-style |
| QuantumTransferLearning | Classical feature extractor + variational quantum layer |
Cryptography
- BB84Protocol — BB84, E91, B92 QKD protocols + QRNG
- PostQuantumCrypto — LWE lattice-based keygen, WOTS hash-based signatures
Hardware & Pulse Control
- DRAGPulse — Gaussian DRAG envelope, leakage suppression
- CrossResonancePulse — ZX interaction, superconducting CNOT
- HardwareBackend — IBM (Perth/Simulator), Google Weber, IonQ Harmony, AWS SV1
- SABRERouter — APSP distance matrix + heuristic look-ahead (delta=0.5), real SWAP insertion
Benchmarking
- QuantumBenchmarking — Quantum Volume, Randomized Benchmarking, XEB, CLOPS
Installation
pip install pktron # Core (NumPy + SciPy only)
pip install pktron[gpu] # + CuPy GPU acceleration
pip install pktron[chemistry] # + PySCF
pip install pktron[ml] # + PyTorch + TensorFlow
pip install pktron[full] # Everything
Quick Start
from pktron import QuantumCircuit, execute, VQE, QuantumChemistry
# Bell state
qc = QuantumCircuit(2).h(0).cx(0, 1)
result = execute(qc, shots=1000)
print(result['counts']) # {'00': ~500, '11': ~500}
# VQE ground state of H2
H = QuantumChemistry.h2_hamiltonian(0.735)
energy = VQE(H).run(ansatz_depth=2)['energy']
print(f"H2 ground state: {energy:.4f} Ha")
License
MIT — Inquiries: info@thecetqap.com GitHub: https://github.com/thecetqap/pktron
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pktron-3.2.3.tar.gz
(45.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pktron-3.2.3-py3-none-any.whl
(43.1 kB
view details)
File details
Details for the file pktron-3.2.3.tar.gz.
File metadata
- Download URL: pktron-3.2.3.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b6c286b0f5f054ca4093585f6f7b229d82d4fdc5f94ce6e5f06b45bb64d7ab1
|
|
| MD5 |
3aacae3507ed80586986ae360fcdbc27
|
|
| BLAKE2b-256 |
487b22e2c3aa996e7e5d8b9102e46db4c5ef68cd58918d222a7f6703e0efcf1f
|
File details
Details for the file pktron-3.2.3-py3-none-any.whl.
File metadata
- Download URL: pktron-3.2.3-py3-none-any.whl
- Upload date:
- Size: 43.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
196658c3a7d43ccd041ed7815fe2945fb3b7d9daf685ee742c390a3402909f6c
|
|
| MD5 |
617976637573f2bf7e7ac8ddccc68b29
|
|
| BLAKE2b-256 |
3f5429b734a61b3f4fb5d0ad0ce60febf83c91f58f5e00ca497b35a00705450a
|