qsimov_cloud_client package
Submodules
qsimov_cloud_client.client module
- class qsimov_cloud_client.client.QsimovCloudClient(token)[source]
Bases:
objectQsimovCloudClient is a Python client for interacting with the Qsimov cloud services.
- calculate_distance_range()[source]
Calculate the range of distances for the computation.
- Returns
A tuple containing the minimum and maximum distances.
- Return type
tuple
- calculate_extra_qubits()[source]
Calculate the extra qubits needed for the superposition.
- Returns
The number of extra qubits needed.
- Return type
int
- calculate_num_superposed()[source]
Calculate the total number of superposed states.
- Returns
The total number of superposed states.
- Return type
int
- can_have_nan(value)[source]
Specify whether NaN (0/0) values are inclided in the superposition.
- Parameters
value (bool) – True if NaN is included, False otherwise.
- Raises
ValueError – If the value is not a boolean.
- generate_circuit()[source]
Generate the quantum circuit based on the specified parameters.
- Returns
An object representing the generated quantum circuit.
- Return type
- set_ancilla_mode(ancilla_mode)[source]
Set the mode for ancilla qubits.
- Parameters
ancilla_mode (str) –
The mode for ancilla qubits. It should be one of the following:
’clean’: Clean ancilla qubits mode.
’noancilla’: No ancilla qubits mode. This mode may result in exponential growth in the number of gates within the quantum circuit. This approach is not scalable and is limited to circuits with up to 10 qubits. Consider choosing an alternative ancilla mode for larger-scale quantum computations.
- Raises
ValueError – If the ancilla_mode is not valid.
- set_distances(distances)[source]
Set the specific distances for the superposition.
- Parameters
distances (iterable) – A list of distances. The distances should be provided as strings. If they include decimals, use fraction format (e.g., ‘3/2’ for 1.5).
- Raises
ValueError – If the distances are not a valid list.
- set_metric(metric)[source]
Set the metric for the quantum superposition.
- Parameters
metric (str) – The metric to be used for the superposition. See full documentation for available metrics.
- Raises
ValueError – If the metric is not a non-empty string.
- set_qasm_version(qasm_version)[source]
Set the version of the QASM (Quantum Assembly) language.
- Parameters
qasm_version (str) –
The QASM version. It should be one of the following:
’2.0’: QASM version 2.0.
- Raises
ValueError – If the qasm_version is not one of the valid options.
- set_range(distance_range)[source]
Set the range of distances/similarities for the superposition.
- Parameters
distance_range (tuple) – A tuple containing the minimum and maximum distances. The distances should be provided as strings. If they include decimals, use fraction format (e.g., ‘3/2’ for 1.5).
- Raises
ValueError – If the range is not valid.
- set_state(state_bin=None, num_qubits=None, state=None)[source]
Set the reference quantum state for the computation.
- Parameters
state_bin (str) – Binary representation of the quantum state.
num_qubits (int) – Number of qubits (if state_bin is not provided).
state (int) – Integer representation of the reference quantum state (if state_bin is not provided).
- Raises
ValueError – If the parameters are not valid or out of range.
- class qsimov_cloud_client.client.SuperpositionCircuit(data, res)[source]
Bases:
objectRepresents a superposition circuit generated by the Qsimov cloud service.
This class provides access to various properties and information about the generated superposition circuit.
- get_ancilla_mode()[source]
Get the mode for ancilla qubits in the circuit.
- Returns
The ancilla mode.
- Return type
str
- get_distances()[source]
Get the distances used for the superposition.
- Returns
The distances used.
- Return type
tuple
- get_extra_qubits()[source]
Get the number of extra qubits required for the circuit.
- Returns
The number of extra qubits.
- Return type
int
- get_metric()[source]
Get the metric used for the superposition.
- Returns
The metric used.
- Return type
str
- get_num_superposed()[source]
Get the total number of states superposed.
- Returns
The total number of states superposed.
- Return type
int
- get_qasm_code()[source]
Get the QASM code representing the generated superposition circuit.
- Returns
The QASM code.
- Return type
str
- get_qasm_version()[source]
Get the version of QASM used for the circuit generation.
- Returns
The QASM version.
- Return type
str
- get_range()[source]
Get the range of distances used for the superposition.
- Returns
A tuple containing the minimum and maximum distances, or None if no range is specified.
- Return type
tuple or None
- get_state()[source]
Get the number of qubits and the reference quantum state.
- Returns
A tuple containing the number of qubits and the reference quantum state.
- Return type
tuple
qsimov_cloud_client.utils module
- qsimov_cloud_client.utils.parse_number(number)[source]
Parse a string representation of a number into a Sympy Rational number or a float infinite number.
- Parameters
number (str) – The string representation of the number to be parsed.
- Returns
The parsed numerical value.
- Return type
Union[sp.Rational, float]
- Raises
ValueError – If the input is not a valid number representation.