Qubit
QuICT.core.qubit.Qubit ¶
Qubit(fidelity: Union[float, tuple] = 1.0, preparation_fidelity: float = 1.0, gate_fidelity: Union[float, dict] = 1.0, T1: float = 0.0, T2: float = 0.0, work_frequency: float = 0.0, readout_frequency: float = 0.0, gate_duration: float = 0.0)
Bases: object
Implement a Quantum bit
Qubit is the basic unit of Quantum Compute.
Parameters:
-
fidelity(Union[float, tuple], default:1.0) –The qubit's measured fidelity, where the fidelity of a quantum qubit is the overlap between the ideal theoretical operation and the actual experimental operation. if it is list, it represent the measured fidelity for state 0 and state 1.
-
preparation_fidelity(float, default:1.0) –The qubit's state preparation fidelity refers to the degree of accuracy with which a quantum bit (qubit) can be prepared in a specific state.
-
gate_fidelity(Union[float, dict], default:1.0) –The fidelity for applying single-qubit quantum gate in this qubit. e.g. {GateType.h: 0.993, GateType.x: 0.989}
-
T1((float, μs), default:0.0) –The longitudinal coherence time, which refers to the time it takes for the qubit to decay back to its ground state from an excited state. Default to None.
-
T2((float, μs), default:0.0) –the transverse coherence time, which refers to the time it takes for the qubit to lose its coherence when subjected to unwanted phase or amplitude fluctuations. Default to None.
-
work_frequency(Union[float, list], default:0.0) –The working frequency in current Qubit.
-
readout_frequency(Union[float, list], default:0.0) –The frequency when measured qubit in current Qubit.
-
gate_duration(Union[float, list], default:0.0) –The amount of time that a Quantum Gate operators on a Qubit.
Source code in QuICT/core/qubit/qubit.py
__bool__ ¶
int value of the qubit(measure result)
Returns:
-
bool–measure result
__int__ ¶
int value of the qubit(measure result)
Returns:
-
int–measure result
Source code in QuICT/core/qubit/qubit.py
__str__ ¶
string describe of the qubit
Returns:
-
str–a simple describe
Source code in QuICT/core/qubit/qubit.py
QuICT.core.qubit.Qureg ¶
Bases: list
Implement a Quantum Register
Qureg is a list of Qubits, which is a subClass of list.
initial a qureg with qubit(s)
Parameters:
-
qubits(Union[int, Qubit, Qureg], default:None) –the qubits which make up the qureg, it can have below form, 1) int 2) qubit 3) [qubits/quregs]
Source code in QuICT/core/qubit/qubit.py
__add__ ¶
get a combined qureg with this qureg and other qureg
Parameters:
-
other(Qureg)–qureg to be added.
Return
Qureg: the result or slice
__call__ ¶
get a smaller qureg from this qureg
Parameters:
-
indexes(object) –the indexes passed in, it can have follow form: 1) int 2) list
Returns: Qubit[s]: the qureg correspond to the indexes
Source code in QuICT/core/qubit/qubit.py
__eq__ ¶
check two qureg is same or not. Iff all qubits in two qureg are same will return True; otherwise, return False.
Parameters:
-
other(Qureg)–qureg to be checked.
Source code in QuICT/core/qubit/qubit.py
__getitem__ ¶
to fit the slice operator, overloaded this function.
get a smaller qureg/qubit from this qureg
Parameters:
-
item(int/slice)–slice passed in.
Return
Qubit/Qureg: the result or slice
Source code in QuICT/core/qubit/qubit.py
__iadd__ ¶
get a combined qureg with this qureg and other qureg
Parameters:
-
other(Qureg)–qureg to be added.
Return
Qureg: the result or slice
Source code in QuICT/core/qubit/qubit.py
__int__ ¶
the value of the register
Return the value of the register if all qubits have been measured. Note that the compute mode is BigEndian.
Returns:
-
int–the value of the register
Raises:
-
Exception–some qubit has not be measured
Source code in QuICT/core/qubit/qubit.py
__str__ ¶
the string of the value of the register
Returns:
-
str–the value of the qureg
index ¶
Return the index of given qubits.
Parameters:
Returns:
-
Union[int, list]–Union[int, list]: The index of given qubits in current qureg.
Source code in QuICT/core/qubit/qubit.py
reset_qubits ¶
set_fidelity ¶
Set the fidelity for each qubits
Parameters:
-
fidelity(list) –The list of fidelity for each qubits, should equal to len(qureg).
Source code in QuICT/core/qubit/qubit.py
set_gate_fidelity ¶
Set the Single-Qubit Gate Fidelity for each qubits
Parameters:
-
gate_fidelity(list) –The list of gate fidelity for each qubits, should equal to len(qureg).
Source code in QuICT/core/qubit/qubit.py
set_preparation_fidelity ¶
Set the QSP fidelity for each qubits
Parameters:
-
fidelity(list) –The list of fidelity for each qubits, should equal to len(qureg).
Source code in QuICT/core/qubit/qubit.py
set_t1_time ¶
Set the T1 coherence time for each qubit
Parameters:
-
t1_time(list) –The T1 time for each qubit
Source code in QuICT/core/qubit/qubit.py
set_t2_time ¶
Set the T2 coherence time for each qubit
Parameters:
-
t2_time(list) –The T2 time for each qubit