isqtools package¶
Subpackages¶
- isqtools.backend package
- Submodules
- isqtools.backend.abstract_backend module
- isqtools.backend.arclight_backend module
- isqtools.backend.autograd_backend module
AutogradBackendAutogradBackend.H()AutogradBackend.RX()AutogradBackend.RXY()AutogradBackend.RY()AutogradBackend.RZ()AutogradBackend.S()AutogradBackend.SD()AutogradBackend.T()AutogradBackend.TD()AutogradBackend.X()AutogradBackend.X2M()AutogradBackend.X2P()AutogradBackend.Y()AutogradBackend.Y2M()AutogradBackend.Y2P()AutogradBackend.Z()AutogradBackend.as_tensor()AutogradBackend.conj()AutogradBackend.copy()AutogradBackend.dot()AutogradBackend.get_zero_state()AutogradBackend.ravel()AutogradBackend.real()AutogradBackend.reshape()AutogradBackend.sqrt()AutogradBackend.stack()AutogradBackend.sum()
- isqtools.backend.hardware_backend module
- isqtools.backend.numpy_backend module
NumpyBackendNumpyBackend.H()NumpyBackend.RX()NumpyBackend.RXY()NumpyBackend.RY()NumpyBackend.RZ()NumpyBackend.S()NumpyBackend.SD()NumpyBackend.T()NumpyBackend.TD()NumpyBackend.X()NumpyBackend.X2M()NumpyBackend.X2P()NumpyBackend.Y()NumpyBackend.Y2M()NumpyBackend.Y2P()NumpyBackend.Z()NumpyBackend.as_tensor()NumpyBackend.conj()NumpyBackend.copy()NumpyBackend.dot()NumpyBackend.get_zero_state()NumpyBackend.ravel()NumpyBackend.real()NumpyBackend.reshape()NumpyBackend.sqrt()NumpyBackend.stack()NumpyBackend.sum()
- isqtools.backend.qcis_backend module
- isqtools.backend.qcis_backend2 module
- isqtools.backend.state_vector_simulator module
StateVectorSimulatorStateVectorSimulator.H()StateVectorSimulator.RX()StateVectorSimulator.RXY()StateVectorSimulator.RY()StateVectorSimulator.RZ()StateVectorSimulator.S()StateVectorSimulator.SD()StateVectorSimulator.T()StateVectorSimulator.TD()StateVectorSimulator.X()StateVectorSimulator.X2M()StateVectorSimulator.X2P()StateVectorSimulator.Y()StateVectorSimulator.Y2M()StateVectorSimulator.Y2P()StateVectorSimulator.Z()StateVectorSimulator.as_tensor()StateVectorSimulator.check()StateVectorSimulator.conj()StateVectorSimulator.copy()StateVectorSimulator.dot()StateVectorSimulator.get_zero_state()StateVectorSimulator.getstate()StateVectorSimulator.multi_gate()StateVectorSimulator.probs()StateVectorSimulator.ravel()StateVectorSimulator.real()StateVectorSimulator.reshape()StateVectorSimulator.reshape_double()StateVectorSimulator.reshape_single()StateVectorSimulator.sample()StateVectorSimulator.shift()StateVectorSimulator.single_gate()StateVectorSimulator.single_rotate_gate()StateVectorSimulator.sqrt()StateVectorSimulator.stack()StateVectorSimulator.state()StateVectorSimulator.sum()StateVectorSimulator.swap()
StateVectorSimulatorError
- isqtools.backend.tensorflow_backend module
TensorFlowBackendTensorFlowBackend.H()TensorFlowBackend.RX()TensorFlowBackend.RXY()TensorFlowBackend.RY()TensorFlowBackend.RZ()TensorFlowBackend.S()TensorFlowBackend.SD()TensorFlowBackend.T()TensorFlowBackend.TD()TensorFlowBackend.X()TensorFlowBackend.X2M()TensorFlowBackend.X2P()TensorFlowBackend.Y()TensorFlowBackend.Y2M()TensorFlowBackend.Y2P()TensorFlowBackend.Z()TensorFlowBackend.as_tensor()TensorFlowBackend.conj()TensorFlowBackend.copy()TensorFlowBackend.dot()TensorFlowBackend.get_zero_state()TensorFlowBackend.ravel()TensorFlowBackend.real()TensorFlowBackend.reshape()TensorFlowBackend.sqrt()TensorFlowBackend.stack()TensorFlowBackend.sum()
- isqtools.backend.tiany_backend module
- isqtools.backend.torch_backend module
TorchBackendTorchBackend.H()TorchBackend.RX()TorchBackend.RXY()TorchBackend.RY()TorchBackend.RZ()TorchBackend.S()TorchBackend.SD()TorchBackend.T()TorchBackend.TD()TorchBackend.X()TorchBackend.X2M()TorchBackend.X2P()TorchBackend.Y()TorchBackend.Y2M()TorchBackend.Y2P()TorchBackend.Z()TorchBackend.as_tensor()TorchBackend.conj()TorchBackend.copy()TorchBackend.dot()TorchBackend.get_zero_state()TorchBackend.ravel()TorchBackend.real()TorchBackend.reshape()TorchBackend.sqrt()TorchBackend.stack()TorchBackend.sum()
- Module contents
- isqtools.chem package
- isqtools.circuits package
- Submodules
- isqtools.circuits.abstract_circuit module
- isqtools.circuits.isq_circuit module
- isqtools.circuits.str_circuit module
StrCircuitStrCircuit.num_qubitsStrCircuit.backendStrCircuit.sampleStrCircuit.shotsStrCircuit.qcis_listStrCircuit.CNOT()StrCircuit.CX()StrCircuit.CY()StrCircuit.CZ()StrCircuit.H()StrCircuit.M()StrCircuit.RX()StrCircuit.RXY()StrCircuit.RY()StrCircuit.RZ()StrCircuit.S()StrCircuit.SD()StrCircuit.T()StrCircuit.TD()StrCircuit.X()StrCircuit.X2M()StrCircuit.X2P()StrCircuit.Y()StrCircuit.Y2M()StrCircuit.Y2P()StrCircuit.Z()StrCircuit.chain()StrCircuit.cnot()StrCircuit.comb()StrCircuit.cx()StrCircuit.cy()StrCircuit.cz()StrCircuit.h()StrCircuit.m()StrCircuit.measure()StrCircuit.mqbit()StrCircuit.param()StrCircuit.pauli()StrCircuit.pauli_measure()StrCircuit.perm()StrCircuit.qcisStrCircuit.ring()StrCircuit.rx()StrCircuit.rxy()StrCircuit.ry()StrCircuit.rz()StrCircuit.s()StrCircuit.sd()StrCircuit.single()StrCircuit.t()StrCircuit.td()StrCircuit.x()StrCircuit.x2m()StrCircuit.x2p()StrCircuit.y()StrCircuit.y2m()StrCircuit.y2p()StrCircuit.z()
StrCircuitError
- Module contents
- isqtools.draw package
- isqtools.neural_networks package
Submodules¶
isqtools.isqc_path module¶
- get_isqc_path()¶
Get the current default
isqcpath.- Returns:
The current default
isqcpath.- Return type:
str
- set_isqc_path(isqc_path)¶
Set the default
isqcpath.- Parameters:
isqc_path (str) – The path to set as the default
isqcpath.- Return type:
None
isqtools.utils module¶
This file provides some utility functions for calling the isqc compiler
from python.
- class CompileTarget(*values)¶
Bases:
Enum- OPEN_QASM3 = 'open-qasm3'¶
- QCIS = 'qcis'¶
- QIR = 'qir'¶
- UNI = 'uni'¶
- classmethod from_string(value)¶
Convert a string to the corresponding CompileTarget enum value.
- Parameters:
value (
str)- Return type:
- class FindSimulator¶
Bases:
objectTo build a SIMULATOR BIN for isqc.
- static get_dir_name_of_simulator(isqcDIR)¶
- static get_isQ_dir()¶
- classmethod get_simulator_bin_path()¶
- classmethod make_simulator_bin()¶
Automatically find the directory of isqc, create a SIMULATOR file with appropriate content, and set file permissions.
- static set_simulator_file_name()¶
- exception IsqcError¶
Bases:
ExceptionIsQ compiler Error.
- gen_qcis_from_so(file, int_param=None, double_param=None, additional_args='')¶
According to the compilation plan of isQ compiler, this function is not open to users.
- Parameters:
file (
str|Path)int_param (
Sequence[int] |int|None)double_param (
Sequence[float] |float|None)additional_args (
str)
- Return type:
None
- isqc_compile(file, target=CompileTarget.QIR, int_param=None, double_param=None, additional_args='')¶
This function encapsulates the
compileof isQ compiler.- Parameters:
file (
str|Path) – The path to the file that needs to be compiled.target (
CompileTarget|str) – The compiled target output form (either a CompileTarget enum or a string).int_param (
Sequence[int] |int|None) – An integer variable (array) passed in when compiling.double_param (
Sequence[float] |float|None) – An double variable (array) passed in when compiling.additional_args (
str) – Other arguments passed in when compiling, see more: https://www.arclightquantum.com/isq-docs/latest/
- Return type:
None
- isqc_run(file, target=CompileTarget.QIR, shots=100, int_param=None, double_param=None)¶
This method executes
compileandsimulatein sequence.- Parameters:
file (
str|Path)target (
CompileTarget)shots (
int)int_param (
Sequence[int] |int|None)double_param (
Sequence[float] |float|None)
- Return type:
tuple[dict[str,int],str,int] |tuple[str,str,int]
- isqc_simulate(file, shots=100, int_param=None, double_param=None, debug=False, additional_args='')¶
This function encapsulates the
simulateof isQ compiler.- Parameters:
file (
str|Path) – The path to the file that needs to be compiled.shots (
int) – Shots number of quantum simulation.int_param (
Sequence[int] |int|None) – An integer variable (array) passed in when compiling.double_param (
Sequence[float] |float|None) – An double variable (array) passed in when compiling.additional_args (
str) – Other arguments passed in when compiling, see more: https://www.arclightquantum.com/isq-docs/latest/debug (
bool)
- Return type:
tuple[dict[str,int],str,int] |tuple[str,str,int]- Returns:
A dictionary with simulation results if successful, otherwise a tuple containing stdout, stderr, and the return code.
- Raises:
IsqcError – If the file format is unsupported or the file does not exist.
subprocess.CalledProcessError – If the simulation command fails.