Class NativeQuantumBackend
java.lang.Object
org.episteme.nativ.physics.quantum.backends.NativeQuantumBackend
- All Implemented Interfaces:
AlgorithmProvider, Backend, ComputeBackend, NativeBackend, QuantumBackend
@AutoService({AlgorithmProvider.class,QuantumBackend.class,ComputeBackend.class,Backend.class,NativeBackend.class})
public class NativeQuantumBackend
extends Object
implements NativeBackend, QuantumBackend, AlgorithmProvider
Native Quantum Provider using Panama FFM bindings for QuEST or Qiskit Aer.
Provides high-performance quantum circuit simulation using native libraries.
- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Nested Class Summary
Nested classes/interfaces inherited from interface QuantumBackend
QuantumBackend.QuantumCircuit, QuantumBackend.QuantumResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCircuit(int numQubits, int numClassicalBits) Creates a new quantum circuit.Creates an execution context for running operations.executeHardware(QuantumBackend.QuantumCircuit circuit, int shots, String backend) Executes a quantum circuit on real quantum hardware.executeSimulator(QuantumBackend.QuantumCircuit circuit, int shots) Executes a quantum circuit on a simulator.Returns the type of hardware accelerator used by this backend.Returns the unique category of the algorithm.String[]Returns available quantum backends (simulators and hardware).getBackendInfo(String backendName) Returns backend information (num_qubits, connectivity, etc.).getName()Returns the display name for UI presentation.Returns the name of the native library this backend depends on.intReturns the priority for auto-selection (higher = preferred).Returns a human-readable status message for this backend.booleanChecks if this backend is currently available (libraries loaded, etc.).booleanisLoaded()Checks if the native library is loaded and available.voidvoidshutdown()Called when the application is shutting down or the backend is being replaced.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AlgorithmProvider
description, getMetadata, scoreMethods inherited from interface Backend
getAlgorithmProviders, isExplicitlyDisabledMethods inherited from interface ComputeBackend
createBackend, getDescription, getId, supportsComplexNumbers, supportsFloatingPoint, supportsParallelOpsMethods inherited from interface QuantumBackend
execute, getType
-
Constructor Details
-
NativeQuantumBackend
public NativeQuantumBackend()
-
-
Method Details
-
isAvailable
public boolean isAvailable()Description copied from interface:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend- Specified by:
isAvailablein interfaceQuantumBackend
-
getStatusMessage
Description copied from interface:BackendReturns a human-readable status message for this backend. Useful for debugging "Unavailable" states.- Specified by:
getStatusMessagein interfaceBackend- Returns:
- status message (e.g., "Ready", "Native library missing", etc.)
-
shutdown
public void shutdown()Description copied from interface:BackendCalled when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.- Specified by:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend
-
isLoaded
public boolean isLoaded()Description copied from interface:NativeBackendChecks if the native library is loaded and available.- Specified by:
isLoadedin interfaceNativeBackend- Returns:
- true if the native library has been successfully loaded
-
getNativeLibraryName
Description copied from interface:NativeBackendReturns the name of the native library this backend depends on.- Specified by:
getNativeLibraryNamein interfaceNativeBackend- Returns:
- library name (e.g., "openblas", "cuda", "fftw3")
-
createCircuit
Description copied from interface:QuantumBackendCreates a new quantum circuit.- Specified by:
createCircuitin interfaceQuantumBackend
-
executeSimulator
public QuantumBackend.QuantumResult executeSimulator(QuantumBackend.QuantumCircuit circuit, int shots) Description copied from interface:QuantumBackendExecutes a quantum circuit on a simulator.- Specified by:
executeSimulatorin interfaceQuantumBackend
-
executeHardware
public QuantumBackend.QuantumResult executeHardware(QuantumBackend.QuantumCircuit circuit, int shots, String backend) Description copied from interface:QuantumBackendExecutes a quantum circuit on real quantum hardware.- Specified by:
executeHardwarein interfaceQuantumBackend
-
getAvailableBackends
Description copied from interface:QuantumBackendReturns available quantum backends (simulators and hardware).- Specified by:
getAvailableBackendsin interfaceQuantumBackend
-
getBackendInfo
Description copied from interface:QuantumBackendReturns backend information (num_qubits, connectivity, etc.).- Specified by:
getBackendInfoin interfaceQuantumBackend
-
getAlgorithmType
Description copied from interface:AlgorithmProviderReturns the unique category of the algorithm.- Specified by:
getAlgorithmTypein interfaceAlgorithmProvider
-
getPriority
public int getPriority()Description copied from interface:BackendReturns the priority for auto-selection (higher = preferred). Used when multiple backends are available.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend
-
getAcceleratorType
Description copied from interface:ComputeBackendReturns the type of hardware accelerator used by this backend.- Specified by:
getAcceleratorTypein interfaceComputeBackend- Returns:
- the accelerator type
-
createContext
Description copied from interface:ComputeBackendCreates an execution context for running operations.The context should be used within a try-with-resources block to ensure proper cleanup of resources.
- Specified by:
createContextin interfaceComputeBackend- Returns:
- new execution context
-
runCircuit
public void runCircuit() -
getName
-