Quantum4J brings quantum programming capabilities to Java developers with its intuitive API and comprehensive feature set. Designed for JVM-based applications, it allows efficient simulation, supports a full set of quantum gates, and offers extensibility for custom implementations. Explore the future of computing with a lightweight, open-source SDK.
Quantum4J is a pure-Java quantum computing framework aimed at making quantum programming accessible within the JVM ecosystem. Featuring a clean and intuitive API inspired by Qiskit, it enables developers to simulate quantum circuits efficiently with its fast state-vector simulator and QASM exporter, alongside a comprehensive set of standard quantum gates.
Full Standard Gate Set: Supports single-qubit gates (X, Y, Z, H, S, T), rotation gates (RX, RY, RZ), controlled gates (CX, CZ, CH), two-qubit gates (SWAP, iSWAP), and three-qubit gates (CCX).
State-Vector Simulator: An efficient N-qubit statevector engine that handles 1-, 2-, and 3-qubit unitaries with a custom Complex class for fast and immutable calculations, ensuring accurate quantum state collapse.
Measurements: Features methods for measurements including measure(q, c) and measureAll() with options for deterministic and sampled measurement modes.
OpenQASM Exporter: Easily export any quantum circuit to OpenQASM 2.0, allowing for interoperability with various quantum computing platforms. Example usage:
String qasm = QasmExporter.toQasm(circuit);
Extensible Architecture: Custom gate implementations can be executed with ease, allowing developers to extend the framework effortlessly:
class MyGate extends SingleQubitGate {
...
}
Quantum4J is suited for:
Follow the forthcoming instructions for Maven integration or Gradle implementation, or clone the repository from source for development purposes.
Quickly create quantum states, such as a Bell State, with minimal code:
import io.quantum4j.core.circuit.QuantumCircuit;
import io.quantum4j.core.backend.*;
public class BellState {
public static void main(String[] args) {
QuantumCircuit qc = QuantumCircuit.create(2)
.h(0)
.cx(0, 1)
.measureAll();
Result r = new StateVectorBackend().run(qc, RunOptions.shots(1000));
System.out.println(r.getCounts());
}
}
Ensure the accuracy of quantum gates and measurement behaviors with a complete JUnit 5 test suite.
Quantum4J can handle quantum circuits of up to ~25 qubits, which aligns with typical Java RAM limitations on standard machines.
The roadmap includes enhancements such as additional gates, noise models, and cloud execution interfaces, paving the way for broader application and integration into quantum computing workflows.
Quantum4J is fully open-source and dependency-free, making it a reliable tool for anyone interested in leveraging quantum computing capabilities within Java applications.
No comments yet.
Sign in to be the first to comment.