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.
Key Features
-
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
Complexclass for fast and immutable calculations, ensuring accurate quantum state collapse. -
Measurements: Features methods for measurements including
measure(q, c)andmeasureAll()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 { ... }
Use Cases
Quantum4J is suited for:
- Java developers exploring quantum computing.
- Researchers preferring Java environments for quantum experiments.
- JVM-based enterprise applications investigating quantum computing use-cases.
- Developers in need of an open and extensible Java quantum SDK.
Installation
Follow the forthcoming instructions for Maven integration or Gradle implementation, or clone the repository from source for development purposes.
Getting Started
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());
}
}
Comprehensive Test Suite
Ensure the accuracy of quantum gates and measurement behaviors with a complete JUnit 5 test suite.
Performance Insights
Quantum4J can handle quantum circuits of up to ~25 qubits, which aligns with typical Java RAM limitations on standard machines.
Future Developments
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.