Skip to main content

PkTron Quantum HPC, QML, SDK & Non-Equilibrium Metrics with the NEF (Noise & Error Free) Framework Simulator — Top #1 in Asia and South Asia, Top 5 Globally (Based on Features, Modules and Breadth)

Project description

PkTron Quantum HPC, QML, SDK, & Quantifiable Non-Equilibrium Metrics with The NEF (Noise & Error Free) Framework Simulator

Top #1 in Asia and South Asia, Top 5 Globally (Based on Features, Modules and Breadth)

Python License HPC SDK Version

PKTron is a full-stack quantum computing framework: a high-performance simulator, a quantum machine-learning toolkit, a hardware-aware SDK, and — new in v9.0.0 — two independent research systems: the Non-Equilibrium (NEQ) post-Born-rule metrics engine and the NEF (Noise & Error Free) five-layer mitigation framework. It ships 180+ public classes, 60+ functions, a compiled C statevector kernel (AVX-512/AVX2/OpenMP), optional GPU and MPI backends, and broad interoperability with Qiskit, Cirq, PennyLane, QASM3, Quil, IonQ and Braket.

Developed and maintained by CETQAC — Centre of Excellence for Technology, Quantum and AI (Pakistan / Canada).

pip install pktron            # core (numpy + scipy only)
pip install pktron[gpu]       # + CuPy GPU acceleration
pip install pktron[dev]       # + pytest, build, twine
import pktron as pk

qc = pk.QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
result = pk.execute(qc, shots=1024)
print(result)            # Bell-state counts: ~50% '00', ~50% '11'

Sample Circuits — Copy, Paste, Run

Every snippet below runs against the public pktron API exactly as installed from PyPI.

1. Bell state + measurement

import pktron as pk

qc = pk.QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
counts = pk.execute(qc, shots=2048)
print(counts)

2. GHZ state (3 qubits)

import pktron as pk

ghz = pk.QuantumCircuit(3)
ghz.h(0)
ghz.cx(0, 1)
ghz.cx(0, 2)
print(ghz.draw())                       # ASCII circuit diagram
sv = pk.StatevectorSimulator().run(ghz, shots=0)['statevector']
print("amplitudes:", sv)

3. VQE — ground-state energy

import numpy as np, pktron as pk

H = np.array([[1, 0], [0, -1]], dtype=complex)   # single-qubit Z
res = pk.VQE(H).run(n_qubits=1)
print("ground-state energy:", res["energy"])      # → -1.0

4. Grover search

import pktron as pk

grover = pk.GroverSearch(n_qubits=3, marked=[5])
res = grover.run()
print("found marked state:", res["found"])         # → 5

5. Zero-Noise Extrapolation (error mitigation)

import numpy as np, pktron as pk

qc = pk.QuantumCircuit(3); qc.h(0); qc.cx(0, 1); qc.cx(0, 2)
obs = np.kron(np.array([[1, 0], [0, -1]]), np.eye(4))   # Z on qubit 0
executor = lambda c: pk.StatevectorSimulator().run(c, shots=0)
res = pk.ZeroNoiseExtrapolation().run(qc, executor, obs)
print("zero-noise value:", res["zero_noise_value"])

6. System I — Non-Equilibrium Mode (NEQ) ★ new in v9.0.0

A post-Born-rule simulation engine. At coherence parameter gamma = 0 it recovers the exact Born rule; as gamma grows it produces a controlled, fully quantified deviation.

import pktron as pk

ghz = pk.QuantumCircuit(3); ghz.h(0); ghz.cx(0, 1); ghz.cx(1, 2)

# Born recovery at gamma = 0
born = pk.NEQSimulator(pk.CoherenceWeighter("exponential", gamma=0.0)).run(ghz)
print("delta_neq (should be ~0):", born.delta_neq)
print("is Born-equivalent:", born.is_born_equivalent())

# Quantified non-equilibrium deviation at gamma = 0.5
neq = pk.NEQSimulator(pk.CoherenceWeighter("exponential", gamma=0.5)).run(ghz)
print("P_neq:", neq.p_neq)               # normalised post-Born distribution
print("delta_neq (TVD):", neq.delta_neq)
print("KL forward / reverse:", neq.kl_forward, neq.kl_reverse)
print("Hellinger:", neq.hellinger)
print("partition Z:", neq.partition_Z)

# Sweep gamma and analyse
scan = pk.NEQSimulator().scan_gamma(ghz, [0.0, 0.25, 0.5, 1.0])
print("delta_neq vs gamma:", [round(r.delta_neq, 4) for r in scan])

# Export full metrics as JSON
print(pk.DeviationAnalyzer(neq).export("json"))

7. System II — NEF (Noise & Error Free) Framework ★ new in v9.0.0

An orchestrated five-layer mitigation pipeline — DD → ZNE → PEC → CDR → Symmetry Verification — that returns a fully itemised error budget.

import numpy as np, pktron as pk

qc = pk.QuantumCircuit(2); qc.h(0); qc.cx(0, 1)
observable = np.kron(np.diag([1, -1]), np.eye(2))     # Z on qubit 0

# Run the full five-layer pipeline
result = pk.NoiseNullifier().run(qc, observable)
print("raw value:       ", result.raw_value)
print("mitigated value: ", result.mitigated_value)
print("layers applied:  ", result.layers_applied)     # ['dd','zne','pec','cdr','sv']
print("error budget:    ", result.error_budget)

# Configure / disable individual layers
cfg = pk.NEFConfig(enable_pec=False, enable_sv=False, dd_sequence="xy8")
print(pk.NoiseNullifier(cfg).run(qc, observable).layers_applied)   # ['dd','zne','cdr']

# Richardson extrapolation primitive (coefficients sum to 1)
rich = pk.RichardsonExtrapolator([1, 2, 3])
print("coefficients:", rich.coefficients)              # [3, -3, 1]

# Benchmark mitigated vs raw over several trials
print(pk.NoiseNullifier().benchmark(qc, observable, n_trials=5))

8. Compose both new systems on one circuit

import numpy as np, pktron as pk

qc = pk.QuantumCircuit(3); qc.h(0); qc.cx(0, 1); qc.cx(0, 2)
obs = np.kron(np.array([[1, 0], [0, -1]]), np.eye(4))

neq = pk.NEQSimulator(pk.CoherenceWeighter("exponential", gamma=1.0)).run(qc)
nef = pk.NoiseNullifier().run(qc, obs)
print("NEQ partition Z:", neq.partition_Z)
print("NEF mitigated  :", nef.mitigated_value)

Complete Feature & Module Reference

Version history shipped in this release

v4.0.0 → v4.0.4 → v5.0.1 → v6.0.0 → v6.1.6 → v7.0.0 → v8.0.0 → v8.0.1 → v9.0.0

Core module — pktron/core.py

Simulators: StatevectorSimulator (Clifford fast-path, auto-MPS routing, GPU fallback), DensityMatrixSimulator, MPSSimulator, CliffordSimulator, UnitarySimulator, ExtendedStabilizerSimulator, SuperOpSimulator.

Circuit & execution: QuantumCircuit (with draw(), depth(), all gate methods), execute(), Gate.

Algorithms: VQE, GroverSearch, Shor, QuantumPhaseEstimation, HHLAlgorithm, SimonsAlgorithm, DeutschJozsa, QuantumWalk, QuantumAnnealing.

QML: QuantumNeuralNetwork, QuantumGAN, QuantumAutoencoder, QuantumCNN, QuantumBoltzmannMachine, QuantumFederatedLearning, QuantumTransferLearning.

Error correction: Steane7QEC, SurfaceCode (arbitrary odd d ≥ 3), ProbabilisticErrorCancellation.

Error mitigation: ZeroNoiseExtrapolation, ReadoutErrorMitigation.

Compilation & routing: SABRERouter, DynamicalDecoupling.

Chemistry & physics: QuantumChemistry (H2, N2, CH4, CO2, NH3, C2H4).

Cryptography: BB84Protocol, PostQuantumCrypto.

Benchmarking & noise: QuantumBenchmarking, NoiseModel, PauliError.

Additional modules (29 files)

  • matchgate_sim.pyMatchgateSimulator (Gaussian fermionic / covariance-matrix simulation, O(n³)).
  • dmrg.pyDMRGSolver (2-site DMRG for 1D Hamiltonians with MPO).
  • fermionic_gaussian.pyFermionicGaussianSimulator (free-fermion quadratic Hamiltonians).
  • qkd_pipeline.pyQKDPipeline (BB84, E91, B92, TwinField, MDI, DIQKD; sifting, privacy amplification; eavesdrop strategies; fiber-loss model).
  • barren_plateau.pyBarrenPlateauAnalyzer.
  • noise_aware_compile.pyNoiseAwareCompiler.
  • qsvt.pyQSVT, QSPAngleFinder, BlockEncoding, LinearCombinationBlockEncoding.
  • circuit_debugger.pyQuantumCircuitDebugger (gate-by-gate step-through).
  • advanced_qml.pyBarrenPlateauFreeQNN, QuantumKernelTrainer, QuantumMAML, ShotFrugalOptimizer, EstimatorQNN, SamplerQNN.
  • advanced_mitigation.pySymmetryVerification, ErrorAmplification, PauliNoiselearner.
  • advanced_crypto.pyQuantumSecretSharing, BlindQuantumComputing, QuantumDigitalSignature, QuantumMoney.
  • advanced_algorithms.pyQuantumMetropolis, LCU, QuantumSDP, AdiabaticOptimizer, PhaseKickback.
  • new_algorithms.pyQuantumWalkSearch, VQITE, GRAPE, ParallelTemperingAnnealing, QuantumNAS, QuantumErrorLearning.
  • interop.pyInteropConverter (import Qiskit/Cirq/PennyLane; export QASM3/Quil/IonQ/Braket).
  • config.pyPKTronConfig. validation.pyQuantumStateValidator. profiling.pyPerformanceMonitor.
  • hardware_calibration.pyCalibrationData, DeviceCalibration. gate_scheduler.pyGateSequence, TimingInfo.
  • noise_models.pyNoiseModel (ABC), DepolarizingNoise, AmplitudeDamping, PhaseDamping, KrausChannel, NoiseModelBuilder.
  • drift_simulator.pyDriftEngine. dynamic_circuits.pyDynamicCircuit, MidCircuitMeasurement, ConditionalGate.
  • hardware_report.pyHardwareExecutionReport. virtual_devices.pyVirtualDevice.
  • multi_gpu_engine.pyGPUScheduler, MultiGPUSimulator.
  • advanced.pyUCCSDSolver, ADAPTVQESolver, VirtualDistillation, OpenQASM3Compiler, JAXOptimizer, AdaptiveMPSSimulator, SurfaceCodeDistance.

Transpiler / pass manager

CouplingMap, TranspilerPass (ABC), BasicDecomposition, NoiseAdaptiveRouting, GateCancellation, PassManager.

Gradients / autodiff — pktron/gradients.py

ParameterShiftGradient, QuantumNaturalGradient, SPSAOptimizer, make_gradient().

ML framework integration

TorchLayer, KerasLayer, JAXLayer, QNNCircuit, EstimatorQNN, SamplerQNN.

Primitives / runtime layer

Estimator, Sampler, StatevectorEstimator, StatevectorSampler, NoisyEstimator, Session, Job, PrimitiveResult.

Observables / Pauli framework — pktron/pauli.py

Pauli, PauliList, SparsePauliOp, PauliTerm, PauliSum, pauli_basis(n), commutator(), anti_commutator().

Chemistry expansion

Molecule, ElectronicStructureProblem, HartreeFockInitialPoint, ActiveSpaceTransformer, FreezeCoreTransformer, Z2Symmetries, ParityMapper, BravyiKitaev, kUpCCGSD, PUCCD, SUCCD, EvolvedOperatorAnsatz.

Error-correction expansion

SurfaceCode(distance=d), BlossomVDecoder, PyMatchingDecoder, FaultTolerantCircuit, ColorCode(distance=d), HeavyHexCode, ThresholdEstimator.

Error-mitigation expansion

fold_gates_at_random(), fold_gates_from_left(), fold_global(), RichardsonExtrapolation(order), ExponentialExtrapolation, PolyExpExtrapolation.

Pulse level

PulseSchedule, DriveChannel, ControlChannel, MeasureChannel, GaussianPulse, DRAGPulse, ConstantPulse, GaussianSquarePulse, PulseSimulator.

Benchmarking expansion

StandardRB, InterleavedRB, MirrorRB, XEB, CLOPS, ProcessTomography, StateTomography, GateTomography.

Interoperability

QASM2Codec, QASM3Parser, QuilExporter, QiskitImporter, CirqImporter, PennyLaneImporter, IonQExporter, BraketExporter, QPYCodec.

Circuit construction & visualization

RXGate, RYGate, RZGate, U3Gate, CCXGate, C3XGate, QuantumRegister, ClassicalRegister, InstructionSet, CircuitInstruction; CircuitDrawer with .draw(mode='text'|'unicode'|'mpl', ...).

Decomposition — pktron/decompose.py

euler_zyz(), kak_decompose(), HardwareBackend helpers.

HPC subsystem

  • kernels/ — C kernel (sv_kernels.c): AVX-512/AVX2/OpenMP gate application, probabilities, sampling, expectation, fusion; KernelSet, load_kernels().
  • scheduler/ — gate normalization, 1-qubit fusion, Clifford detection; build_schedule(), OpNode.
  • runtime/StatevectorRuntime (schedule → Clifford/GPU/C-kernel/NumPy fallback).
  • sparse/SparseHamiltonian, ising_hamiltonian(), heisenberg_hamiltonian(), from_dense(), expectation_pauli().
  • cache/CircuitCache (LRU + disk, SHA-256 hash). gpu/GPUBackend (CuPy). distributed/DistributedSimulator (MPI). benchmarks/ — full benchmarking harness.

Finance module — pktron/finance/core.py

QuantumAmplitudeEstimation, QuantumPortfolioOptimizer, QuantumOptionPricer, QuantumCreditRisk, OptionsPricing, PortfolioOptimizer, MonteCarloVaR, AnomalyDetection.

Defense module — pktron/defense/core.py

QuantumVRP, QuantumGameTheory, MissionScheduler, SwarmOptimizer, TargetDetection, QuantumCryptanalysis.

v7.0.0 modules (23 features)

  • v7_simulators.pySparseStatevectorSimulator, DynamicCircuitSimulator, LindbladSolver.
  • v7_algebra.pySparsePauliOp, AdjointDifferentiator, NaturalGradient.
  • v7_compiler.pyCommutationCancellationPass, TemplateOptimizationPass, DepthOptimizationPass, NativeGateDecomposition, QubitRemappingPass, optimize_circuit(), circuit_unitary().
  • v7_qasm3.pyqasm3_export(), qasm3_parse().
  • v7_tomography.pyStateTomography, ProcessTomography, GateSetTomography.
  • v7_mitigation.pyCliffordDataRegression, PauliTwirling, SymmetryVerification.
  • v7_benchmarking.pyRandomizedBenchmarking, InterleavedRB, SimultaneousRB, MirrorBenchmarking.
  • v7_noise.pyDeviceNoiseModel, fake_ibm_nairobi(), CorrelatedCrosstalk, thermal_relaxation_kraus(), depolarizing_kraus().
  • v7_resources.pyFaultTolerantResourceEstimator, TCountOptimizer.

v8.0.0 modules (7 features)

compile.pyNoiseAdaptiveTranspiler; verify.pyCircuitVerifier; diff.pyAdjointGradient; noiselearn.pyNoiseCharacterizer; resource.pyResourceEstimator; corrected finance/ and defense/ implementations.

v8.0.1 frontier algorithms (10) — pktron/algorithms_v801.py

QuantumLatticeSieving, QuantumMoneyVerifier, QuantumCopyProtection, IQPSampling, QuantumGravityHolographic, NonAbelianAnyonSimulator, QuantumNPOracle, FaultTolerantMetropolisSampling, QuantumFullyHomomorphicEncryption, CVQKDMetropolitanRouter.

v9.0.0 new systems (2)

System I — Non-Equilibrium Mode — pktron/neq.py NEQSimulator (post-Born-rule engine, exact Born recovery at γ=0), CoherenceWeighter (exponential/gaussian/polynomial/custom modes), NEQResult (p_neq, delta_neq, kl_forward, kl_reverse, hellinger, partition_Z, is_born_equivalent()), DeviationAnalyzer (deviation, kl_divergence, hellinger, export). Verified: Born rule recovered exactly at γ=0 (δ_neq < 1e-10); TVD monotone in γ; KL and Hellinger metrics consistent.

System II — Noise & Error Free Framework — pktron/nef.py NoiseNullifier (orchestrated five-layer pipeline: DD → ZNE → PEC → CDR → SymmetryVerification), NEFConfig, NEFResult (raw_value, mitigated_value, error_budget, layers_applied, improvement_factor()), RichardsonExtrapolator (coefficients verified to sum to 1), nef.SymmetryVerification. Verified: Richardson coefficients correct; noiseless circuits return exact expectation; noise suppression demonstrated.


Summary count

Category Count
Python modules / files 45+
Public classes 180+
Public functions 60+
C-extension functions 14
QKD protocols 6
Interop targets 8
Error-mitigation methods 12+
Error-correction codes 6
Benchmarking protocols 8
Finance algorithms 8
Defense algorithms 6
v7 features 23
v8.0.0 features 7
v8.0.1 frontier algorithms 10
v9.0.0 new systems 2 (NEQ + NEF)


How PKTron Compares (Breadth & Modules)

This comparison is scoped to feature and module breadth shipped in the framework itself — not performance, maturity, or hardware access. Marks reflect each framework's current capabilities.

Legend: ✅ built-in  ·  ◐ partial / via companion package or extension  ·  ⬜ not available

Capability PKTron Qiskit Cirq PennyLane Qulacs TensorCircuit TKET Braket
Simulator backends (SV/DM/MPS/stabilizer/…) ✅ 7 types ◐ SV+DM ◐ SV+DM ◐ SV+DM ◐ TN+SV+DM ◐ ext ◐ cloud
GPU acceleration ◐ cloud
MPI / distributed ◐ cloud
Compiled C/C++ kernel ✅ AVX-512 ✅ qsim ✅ Lightning ◐ XLA
Quantum machine learning ◐ TFQ
Quantum chemistry ✅ Nature ◐ OpenFermion ✅ qchem
Quantum finance ✅ Finance
Defense / mission domain modules
Error-correction codes ✅ 6 codes ◐ qec
Error mitigation ✅ 12+
Transpiler / routing ✅ best-in-class
Pulse-level control
Benchmarking (RB/tomography/XEB) ✅ 8
Interop (QASM3/Quil/IonQ/Braket/…) ✅ 8 targets ✅ plugins
NEQ — post-Born non-equilibrium metrics
NEF — unified 5-layer mitigation object
Everything in one pip install ⬜ (split) ◐ core+plugins
Context PKTron Qiskit Cirq PennyLane Qulacs TensorCircuit TKET Braket
Execution model Simulation-first Sim + QPU Sim + QPU Sim + QPU Sim Sim + cloud Compiler + QPU Cloud QPU
Maturity Emerging Established Established Established Established Growing Established Established

Takeaway: PKTron is the only framework here that ships finance and defense domain modules, six error-correction codes, an eight-protocol benchmarking suite, and the NEQ + NEF systems — all in a single pip install. Qiskit matches PKTron on many rows, but only by combining several separate packages (Aer, Nature, Finance, Experiments); and no other framework provides NEQ post-Born metrics or a unified NEF mitigation object at all. This breadth across simulators, QML, chemistry, finance, defense, error correction, mitigation, and benchmarking is the basis for PKTron's standing on features, modules, and breadth.

What's new in v9.0.6

  • PkDag / TranspileStage — a DAG circuit representation (topological order, predecessor/successor queries, in-place substitute) for writing custom transpiler passes without rebuilding the pipeline. Mirrors Qiskit's C-API QkDag at the interface level (pure-Python implementation).
  • CouplingMap / Target — device connectivity (BFS distance, neighbours) plus a richer hardware target with per-gate error rates, per-qubit T1/T2 and readout error, and Target.from_coupling_map(...).
  • VF2Layout / VF2PostLayout — VF2-style subgraph-isomorphism layout, and a post-routing refinement pass that re-maps to a strictly lower expected-error qubit assignment using the Target error rates.
  • GridsynthDecomposer — Rz to Clifford+T single-qubit synthesis via a bounded-depth Clifford+T search: exact for Clifford+T-multiple angles (e.g. pi/4 -> T, pi/2 -> S), ~0.10 worst-case operator-norm error otherwise. This is a documented simplified stand-in for full number-theoretic Ross-Selinger (deferred); every returned sequence's accuracy is verified against the ideal Rz.
  • RuntimeExecutor — a job-submission primitive (.status() / .result()) that runs arbitrary user programs against a backend. Distinct from the existing AsyncExecutor thread-pool task runner.
  • PauliNoiseLearnerV2 — incremental noise-model refinement via .update() (EMA re-fit toward fresh calibration data without discarding the prior model).
  • QPYCodec / FastQPYCodec — exact binary circuit serialization, plus a dedup-optimized variant that stores repeated gates/sub-circuits once. On repetitive workloads this yields a large payload-size reduction (measured by benchmark_qpy, e.g. ~45x smaller on the shipped benchmark); wall-clock is comparable, so no speedup is claimed.

Deferred to 9.1.0: third-party compiled (C/Rust) extension registration against a stable C API (Qiskit v2.4-style) — not shipped in 9.0.6.

What's new in v9.0.0

  • System I — NEQ: a quantifiable post-Born-rule simulation engine with tunable coherence weighting and full deviation metrics (TVD, forward/reverse KL, Hellinger, partition function), with exact Born recovery at γ=0.
  • System II — NEF: a configurable five-layer error-mitigation pipeline returning an itemised error budget, sampling overhead, and post-selection rate.
  • Both systems are fully wired into the top-level namespace and validated by 20 spec assertions plus an 8-step end-to-end integration test.

License & citation

MIT License © CETQAC — Centre of Excellence for Technology, Quantum and AI (Pakistan / Canada).

@software{pktron2026,
  title  = {PKTron: Quantum HPC, QML, SDK & Non-Equilibrium Metrics with the NEF Framework},
  author = {CETQAC},
  year   = {2026},
  version = {9.0.0},
  url    = {https://github.com/paktronsimulatorpakistan}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pktron-9.0.6-py3-none-any.whl (419.1 kB view details)

Uploaded Python 3

File details

Details for the file pktron-9.0.6-py3-none-any.whl.

File metadata

  • Download URL: pktron-9.0.6-py3-none-any.whl
  • Upload date:
  • Size: 419.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pktron-9.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0b65e272ab3ff88d29af369c0876a7daa8c6c7d5e60f49a0f613309b35edac
MD5 9501757128623d37286d895ee8d2b6d5
BLAKE2b-256 bd900843b9c60803018658272d521ce0e7bd6b1eb003376bbab0ff1b1d5390d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page