Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 3.59 KB

File metadata and controls

102 lines (72 loc) · 3.59 KB

Quromorphic.jl

Julia Build Status Coverage Documentation

Quromorphic.jl is a quantum neuromorphic model prototyping library written in Julia. It combines quantum computing principles with neuromorphic architectures, providing tools for designing, simulating, and evaluating hybrid quantum-neural systems. and is designed to scale efficiently for distributed computing environments.


Installation

  1. Quromorphic.jl requires Julia 1.12 or later.

  2. Clone this repository:

using Pkg
Pkg.add(url="https://github.com/Heterotic-Research/Quromorphic.jl")
  1. Start Julia and instantiate the project:
    julia> ] activate .
    julia> instantiate

Qiskit Integration

Quromorphic ships with a Qiskit.jl frontend so you can define circuits using the familiar builder API and run them through the high-performance QSim back end.

using Quromorphic.QCirc
import Quromorphic.QSim
using Qiskit

qc = QuantumCircuit(2, 2)
qc.h(1)
qc.cx(1, 2)
qc.measure(1, 1)
qc.measure(2, 2)

result = simulate(qc)
println(result.measurements)  # Dict with P(0), P(1) for each qubit

QSim.prstate(result.statevector)  # Pretty-print the final amplitudes
  • Pass method = :density_matrix to simulate to run decoherence-aware workloads.
  • Provide an initial_state vector or density matrix (e.g. from QSim.statevector) to warm-start simulations.

From the command line, launch the same snippet directly:

julia --project=. -e 'using Quromorphic.QCirc, Quromorphic.QSim, Qiskit; qc = QuantumCircuit(2, 2); qc.h(1); qc.cx(1, 2); display(simulate(qc))'

Working Directly with QSim

You can bypass the Qiskit frontend and manipulate state vectors or density matrices with the low-level QSim API when you need fine-grained control over simulation primitives.

using Quromorphic.QSim

ψ = QSim.statevector(3, 0)   # |000⟩
QSim.h!(ψ, 1)
QSim.cnot!(ψ, 1, 2)
QSim.rz!(ψ, 3, π / 3)

probabilities = abs2.(ψ)

For density-matrix workflows:

ρ = QSim.density_matrix(2, 0)
QSim.h!(ρ, 1)
QSim.cz!(ρ, 1, 2)
p0, p1 = QSim.measure_z(ρ, 2)

Benchmarking

Run the multi-thread scaling benchmarks with the project environment activated:

julia --project benchmarks/multithreading.jl

The driver spawns fresh Julia workers for each thread count listed in QSIM_THREAD_LIST (defaults to 1,2,4,8) and prints a table summarizing gate timings and throughput speedups. Tune the workload with these environment variables:

  • QSIM_STATE_QUBITS: state-vector qubit count (default 7, limited to ≤12 to avoid huge dense matrices)
  • QSIM_DENSITY_QUBITS: density-matrix qubit count (default 6, limited to ≤9)
  • QSIM_BENCH_REPEATS: number of timing samples per gate (default 5)
  • QSIM_BENCH_EVALS: number of inner evaluations per sample (default 1)
  • QSIM_BENCH_SEED: RNG seed for reproducible inputs (default 1234)

Example run at a higher thread sweep:

QSIM_THREAD_LIST=1,2,4,8,12 QSIM_STATE_QUBITS=8 julia --project benchmarks/multithreading.jl