Dynex Circuit Class - dynexcoin/DynexSDK GitHub Wiki
Requirements
To enable quantum gate circuits in the Dynex SDK, the following imports are required:
import dynex
from dynex import dynex_circuit
The dynex_circuit class requires the PennyLane package to be installed (pip install pennylane
), if you are working with Qiskit, you need Qiskit package installed (pip install qiskit
) and the PennyLane Qiskit Plugin (pip install pennylane-qiskit
). Working with OpenQASM circuits does not require additional plugins to be installed because these are based on text file instructions.
Method: dynex_circuit.execute()
Quantum gate circuits in the Dynex SDK can be defined with PennLane, Qiskit or OpenQASM methods. To execute a circuit and measure the results on the Dynex platform, the method dynex_circuit.execute()
is being used. Here is an example of a simple circuit:
params = []
wires = 1
def simple_circuit(params):
qml.PauliX(wires=0) # Apply X gate (NOT gate)
return qml.state()
# run circuit on Dynex:
measure = dynex_circuit.execute(simple_circuit, params, wires, debugging=False, mainnet=False, is_cluster=True, method='measure')
print('Mesaure:',measure)
Parameters
- circuit: A circuit in one of the following formats: [openQASM, PennyLane, Qiskit, Cirq] (circuit class)
- params: Parameters for circuit execution (
list
) - wires: number of qubits (
int
) - method: Type of circuit measurement:
measure
: samples of a single measurementprobs
: computational basis state probabilitiesall
: all solutions as arrayssampleset
: dimod sampleset - shots: Sets the minimum number of solutions to retrieve from the network. Works both on mainnet=False and mainnet=True (Default: 1). Typically used for situations where not only the best global optimum (sampleset.first) is required, but multiple optima from different workers (
int
). - description: Defines the description for the job, which is shown in Dynex job dashboards as well as in the network explorer (
string
)
Sampling Parameters
- num_reads: Defines the number of parallel samples to be performed (
int
value in the range of [32, MAX_NUM_READS] as defined in your license) - annealing_time: Defines the number of integration steps for the sampling. Models are being converted into neuromorphic circuits, which are then simulated with ODE integration by the participating workers (
int
value in the range of [1, MAX_ANNEALING_TIME] as defined in your license) - switchfraction: Defines the percentage of variables which are replaced by random values during warm start samplings (
double
in the range of [0.0, 1.0]) - alpha: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon). See our equations of motion for more information. - beta: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon). See our equations of motion for more information. - gamma: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon). See our equations of motion for more information. - delta: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon). See our equations of motion for more information. - epsilon: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon) .See our equations of motion for more information. - zeta: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is using automatic tuning of these parameters for the ODE integration. Setting values defines the upper bound for the automated parameter tuning (
double
value in the range of [0.00000001, 100.0] for alpha and beta, and [0.0 and 1.0] for gamma, delta and epsilon). See our equations of motion for more information. - minimum_stepsize: The ODE integration of the QUBU/Ising or SAT model based neuromorphic circuits is performig adaptive stepsizes for each ODE integration forward Euler step. This value defines the smallest step size for a single adaptive integration step (
double
value in the range of [0.0000000000000001, 1.0]). See our equations of motion for more information. - debugging: Only applicable for test-net sampling. Defines if the sampling process should be quiet with no terminal output (FALSE) or if process updates are to be shown (TRUE) (
bool
) - bnb: Use alternative branch-and-bound sampling when in mainnet=False (
bool
) - block_fee: For spot compute, computing jobs on the Dynex platform are being prioritised by the block fee which is being offered for computation. If this parameter is not specified, the current average block fee on the platform is being charged. To set an individual block fee for the sampling, specify this parameter, which is the amount of DNX in nanoDNX (1 DNX = 1,000,000,000 nanoDNX)
Returns
- Returns the measurement based on the parameter 'measure':
method="measure"
performs measurements in the computational basis and returns the results that are applied to any set of observables.
method="all"
performs the measurement for each individual shot.
method="probs"
returns the probability of each computational basis state for individual qubits (rather than full basis states).
Next: Dynex Circuit Examples