hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6b120a92ecd09c64477b37c0276e9eadc432db14 | baidu/Quanlse | Quanlse/Scheduler/__init__.py | [
"Apache-2.0"
] | Python | savePulse | bool | def savePulse(self) -> bool:
"""
If save the pulse for quantum gates in cache
"""
return self._savePulse |
If save the pulse for quantum gates in cache
| If save the pulse for quantum gates in cache | [
"If",
"save",
"the",
"pulse",
"for",
"quantum",
"gates",
"in",
"cache"
] | def savePulse(self) -> bool:
return self._savePulse | [
"def",
"savePulse",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_savePulse"
] | If save the pulse for quantum gates in cache | [
"If",
"save",
"the",
"pulse",
"for",
"quantum",
"gates",
"in",
"cache"
] | [
"\"\"\"\n If save the pulse for quantum gates in cache\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b120a92ecd09c64477b37c0276e9eadc432db14 | baidu/Quanlse | Quanlse/Scheduler/__init__.py | [
"Apache-2.0"
] | Python | savePulse | null | def savePulse(self, value: bool):
"""
If save the pulse for quantum gates in cache
"""
self._savePulse = value |
If save the pulse for quantum gates in cache
| If save the pulse for quantum gates in cache | [
"If",
"save",
"the",
"pulse",
"for",
"quantum",
"gates",
"in",
"cache"
] | def savePulse(self, value: bool):
self._savePulse = value | [
"def",
"savePulse",
"(",
"self",
",",
"value",
":",
"bool",
")",
":",
"self",
".",
"_savePulse",
"=",
"value"
] | If save the pulse for quantum gates in cache | [
"If",
"save",
"the",
"pulse",
"for",
"quantum",
"gates",
"in",
"cache"
] | [
"\"\"\"\n If save the pulse for quantum gates in cache\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "bool",
"docstring": null,
"docstring_tokens"... |
6b120a92ecd09c64477b37c0276e9eadc432db14 | baidu/Quanlse | Quanlse/Scheduler/__init__.py | [
"Apache-2.0"
] | Python | subSysNum | int | def subSysNum(self) -> int:
"""
Return the number of sub-systems.
"""
return self._subSysNum |
Return the number of sub-systems.
| Return the number of sub-systems. | [
"Return",
"the",
"number",
"of",
"sub",
"-",
"systems",
"."
] | def subSysNum(self) -> int:
return self._subSysNum | [
"def",
"subSysNum",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_subSysNum"
] | Return the number of sub-systems. | [
"Return",
"the",
"number",
"of",
"sub",
"-",
"systems",
"."
] | [
"\"\"\"\n Return the number of sub-systems.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b120a92ecd09c64477b37c0276e9eadc432db14 | baidu/Quanlse | Quanlse/Scheduler/__init__.py | [
"Apache-2.0"
] | Python | sysLevel | Union[int, List[int]] | def sysLevel(self) -> Union[int, List[int]]:
"""
Return the size of the sub-systems.
"""
return self._sysLevel |
Return the size of the sub-systems.
| Return the size of the sub-systems. | [
"Return",
"the",
"size",
"of",
"the",
"sub",
"-",
"systems",
"."
] | def sysLevel(self) -> Union[int, List[int]]:
return self._sysLevel | [
"def",
"sysLevel",
"(",
"self",
")",
"->",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
":",
"return",
"self",
".",
"_sysLevel"
] | Return the size of the sub-systems. | [
"Return",
"the",
"size",
"of",
"the",
"sub",
"-",
"systems",
"."
] | [
"\"\"\"\n Return the size of the sub-systems.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b120a92ecd09c64477b37c0276e9eadc432db14 | baidu/Quanlse | Quanlse/Scheduler/__init__.py | [
"Apache-2.0"
] | Python | findGatePulsePair | Union[GatePulsePair, None] | def findGatePulsePair(self, cirLine: CircuitLine) -> Union[GatePulsePair, None]:
"""
Find the pulse of a fixed gate in pulse cache.
:param cirLine: CircuitLine object to be searched in pulse cache
:return: the returned GatePulsePair
"""
for pair in self._pulseCache:
... |
Find the pulse of a fixed gate in pulse cache.
:param cirLine: CircuitLine object to be searched in pulse cache
:return: the returned GatePulsePair
| Find the pulse of a fixed gate in pulse cache. | [
"Find",
"the",
"pulse",
"of",
"a",
"fixed",
"gate",
"in",
"pulse",
"cache",
"."
] | def findGatePulsePair(self, cirLine: CircuitLine) -> Union[GatePulsePair, None]:
for pair in self._pulseCache:
if GatePulsePair(cirLine) == pair:
return pair
return None | [
"def",
"findGatePulsePair",
"(",
"self",
",",
"cirLine",
":",
"CircuitLine",
")",
"->",
"Union",
"[",
"GatePulsePair",
",",
"None",
"]",
":",
"for",
"pair",
"in",
"self",
".",
"_pulseCache",
":",
"if",
"GatePulsePair",
"(",
"cirLine",
")",
"==",
"pair",
... | Find the pulse of a fixed gate in pulse cache. | [
"Find",
"the",
"pulse",
"of",
"a",
"fixed",
"gate",
"in",
"pulse",
"cache",
"."
] | [
"\"\"\"\n Find the pulse of a fixed gate in pulse cache.\n\n :param cirLine: CircuitLine object to be searched in pulse cache\n :return: the returned GatePulsePair\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cirLine",
"type": "CircuitLine"
}
] | {
"returns": [
{
"docstring": "the returned GatePulsePair",
"docstring_tokens": [
"the",
"returned",
"GatePulsePair"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstr... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | caliSingleQubitGates | <not_specific> | def caliSingleQubitGates(sche: Scheduler, q0: int, q1: int, runner: Callable = None, bounds: List = None,
q0ParaInit: Optional[List[float]] = None, q1ParaInit: List[float] = None, options: Any = None):
"""
Find the best qubit frequency.
:param sche: the Scheduler instance
:para... |
Find the best qubit frequency.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be calibrated
:param runner: a callable function which can pass the QJob/QJobList instances and obtain the result
:param bound... | Find the best qubit frequency. | [
"Find",
"the",
"best",
"qubit",
"frequency",
"."
] | def caliSingleQubitGates(sche: Scheduler, q0: int, q1: int, runner: Callable = None, bounds: List = None,
q0ParaInit: Optional[List[float]] = None, q1ParaInit: List[float] = None, options: Any = None):
_, idealMatrixList = caliSingleQubitGatesJob(sche, q0, q1, None, None, True)
def _sin... | [
"def",
"caliSingleQubitGates",
"(",
"sche",
":",
"Scheduler",
",",
"q0",
":",
"int",
",",
"q1",
":",
"int",
",",
"runner",
":",
"Callable",
"=",
"None",
",",
"bounds",
":",
"List",
"=",
"None",
",",
"q0ParaInit",
":",
"Optional",
"[",
"List",
"[",
"f... | Find the best qubit frequency. | [
"Find",
"the",
"best",
"qubit",
"frequency",
"."
] | [
"\"\"\"\n Find the best qubit frequency.\n\n :param sche: the Scheduler instance\n :param q0: the index of the first qubit to be calibrated\n :param q1: the index of the second qubit to be calibrated\n :param runner: a callable function which can pass the QJob/QJobList instances and obtain the result... | [
{
"param": "sche",
"type": "Scheduler"
},
{
"param": "q0",
"type": "int"
},
{
"param": "q1",
"type": "int"
},
{
"param": "runner",
"type": "Callable"
},
{
"param": "bounds",
"type": "List"
},
{
"param": "q0ParaInit",
"type": "Optional[List[float]]"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sche",
"type": "Scheduler",
"docstring": "the Scheduler instance",
"docstring_tokens": [
"the",
"Scheduler",
"instance"
],
"default": null,
"is_optional": null
},
{
"iden... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | _singleQubitCaliLoss | <not_specific> | def _singleQubitCaliLoss(x):
"""
Obtain the calibration pulse jobs and calculate the loss function.
"""
# Generate the pulse jobs for calibration
caliJobs, _ = caliSingleQubitGatesJob(sche, q0, q1, [x[0], x[1]], [x[2], x[3]], False)
# Simulate the calibration pulse
... |
Obtain the calibration pulse jobs and calculate the loss function.
| Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | def _singleQubitCaliLoss(x):
caliJobs, _ = caliSingleQubitGatesJob(sche, q0, q1, [x[0], x[1]], [x[2], x[3]], False)
if isinstance(sche, PulseModel):
results = sche.simulate(jobList=caliJobs, options=options)
else:
if runner is None or not callable(runner):
... | [
"def",
"_singleQubitCaliLoss",
"(",
"x",
")",
":",
"caliJobs",
",",
"_",
"=",
"caliSingleQubitGatesJob",
"(",
"sche",
",",
"q0",
",",
"q1",
",",
"[",
"x",
"[",
"0",
"]",
",",
"x",
"[",
"1",
"]",
"]",
",",
"[",
"x",
"[",
"2",
"]",
",",
"x",
"[... | Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | [
"\"\"\"\n Obtain the calibration pulse jobs and calculate the loss function.\n \"\"\"",
"# Generate the pulse jobs for calibration",
"# Simulate the calibration pulse",
"# Obtain the output population value",
"# Obtain the ideal population",
"# Calculate the loss function"
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | czCaliCondPhaseJob | <not_specific> | def czCaliCondPhaseJob(sche: Scheduler, q0: int, q1: int, q0ZAmp: float, q1ZAmp: float, czLen: float):
"""
Generate the calibration pulses (QJobList instances) for the conditional phase by tuning the Z pulse.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
... |
Generate the calibration pulses (QJobList instances) for the conditional phase by tuning the Z pulse.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be calibrated
:param q0ZAmp: the amplitude of Z pulse on th... | Generate the calibration pulses (QJobList instances) for the conditional phase by tuning the Z pulse. | [
"Generate",
"the",
"calibration",
"pulses",
"(",
"QJobList",
"instances",
")",
"for",
"the",
"conditional",
"phase",
"by",
"tuning",
"the",
"Z",
"pulse",
"."
] | def czCaliCondPhaseJob(sche: Scheduler, q0: int, q1: int, q0ZAmp: float, q1ZAmp: float, czLen: float):
qubits = (q0, q1)
sche.conf["caliDataCZ"][qubits]["q0ZAmp"] = q0ZAmp
sche.conf["caliDataCZ"][qubits]["q1ZAmp"] = q1ZAmp
sche.conf["caliDataCZ"][qubits]["czLen"] = czLen
sche.conf["caliDataCZ"][qubi... | [
"def",
"czCaliCondPhaseJob",
"(",
"sche",
":",
"Scheduler",
",",
"q0",
":",
"int",
",",
"q1",
":",
"int",
",",
"q0ZAmp",
":",
"float",
",",
"q1ZAmp",
":",
"float",
",",
"czLen",
":",
"float",
")",
":",
"qubits",
"=",
"(",
"q0",
",",
"q1",
")",
"s... | Generate the calibration pulses (QJobList instances) for the conditional phase by tuning the Z pulse. | [
"Generate",
"the",
"calibration",
"pulses",
"(",
"QJobList",
"instances",
")",
"for",
"the",
"conditional",
"phase",
"by",
"tuning",
"the",
"Z",
"pulse",
"."
] | [
"\"\"\"\n Generate the calibration pulses (QJobList instances) for the conditional phase by tuning the Z pulse.\n\n :param sche: the Scheduler instance\n :param q0: the index of the first qubit to be calibrated\n :param q1: the index of the second qubit to be calibrated\n :param q0ZAmp: the amplitude... | [
{
"param": "sche",
"type": "Scheduler"
},
{
"param": "q0",
"type": "int"
},
{
"param": "q1",
"type": "int"
},
{
"param": "q0ZAmp",
"type": "float"
},
{
"param": "q1ZAmp",
"type": "float"
},
{
"param": "czLen",
"type": "float"
}
] | {
"returns": [
{
"docstring": "the QJobList instance",
"docstring_tokens": [
"the",
"QJobList",
"instance"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sche",
"type": "Scheduler",
"docstring": "the Scheduler instanc... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | czCaliCondPhase | <not_specific> | def czCaliCondPhase(sche: Scheduler, q0: int, q1: int, runner: Callable = None, method: str = 'dual_annealing',
maxIter: int = 50, q0ZAmpInit: float = None, q1ZAmpInit: float = None, czLenInit: float = None,
options: Any = None):
"""
Run the conditional phase calibration ... |
Run the conditional phase calibration procedure for the controlled-Z gates.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be calibrated
:param runner: a callable function which can pass the QJob/QJobList ins... | Run the conditional phase calibration procedure for the controlled-Z gates. | [
"Run",
"the",
"conditional",
"phase",
"calibration",
"procedure",
"for",
"the",
"controlled",
"-",
"Z",
"gates",
"."
] | def czCaliCondPhase(sche: Scheduler, q0: int, q1: int, runner: Callable = None, method: str = 'dual_annealing',
maxIter: int = 50, q0ZAmpInit: float = None, q1ZAmpInit: float = None, czLenInit: float = None,
options: Any = None):
def _condPhaseCaliLoss(x):
caliJobs = ... | [
"def",
"czCaliCondPhase",
"(",
"sche",
":",
"Scheduler",
",",
"q0",
":",
"int",
",",
"q1",
":",
"int",
",",
"runner",
":",
"Callable",
"=",
"None",
",",
"method",
":",
"str",
"=",
"'dual_annealing'",
",",
"maxIter",
":",
"int",
"=",
"50",
",",
"q0ZAm... | Run the conditional phase calibration procedure for the controlled-Z gates. | [
"Run",
"the",
"conditional",
"phase",
"calibration",
"procedure",
"for",
"the",
"controlled",
"-",
"Z",
"gates",
"."
] | [
"\"\"\"\n Run the conditional phase calibration procedure for the controlled-Z gates.\n\n :param sche: the Scheduler instance\n :param q0: the index of the first qubit to be calibrated\n :param q1: the index of the second qubit to be calibrated\n :param runner: a callable function which can pass the ... | [
{
"param": "sche",
"type": "Scheduler"
},
{
"param": "q0",
"type": "int"
},
{
"param": "q1",
"type": "int"
},
{
"param": "runner",
"type": "Callable"
},
{
"param": "method",
"type": "str"
},
{
"param": "maxIter",
"type": "int"
},
{
"param":... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sche",
"type": "Scheduler",
"docstring": "the Scheduler instance",
"docstring_tokens": [
"the",
"Scheduler",
"instance"
],
"default": null,
"is_optional": null
},
{
"iden... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | _condPhaseCaliLoss | <not_specific> | def _condPhaseCaliLoss(x):
"""
Obtain the calibration pulse jobs and calculate the loss function.
"""
# Generate the pulse jobs for calibration
caliJobs = czCaliCondPhaseJob(sche, q0, q1, x[0], x[1], x[2])
# Simulate the calibration pulse
if isinstance(sche, Pul... |
Obtain the calibration pulse jobs and calculate the loss function.
| Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | def _condPhaseCaliLoss(x):
caliJobs = czCaliCondPhaseJob(sche, q0, q1, x[0], x[1], x[2])
if isinstance(sche, PulseModel):
results = sche.simulate(jobList=caliJobs, options=options)
else:
if runner is None or not callable(runner):
raise ArgumentError("Pleas... | [
"def",
"_condPhaseCaliLoss",
"(",
"x",
")",
":",
"caliJobs",
"=",
"czCaliCondPhaseJob",
"(",
"sche",
",",
"q0",
",",
"q1",
",",
"x",
"[",
"0",
"]",
",",
"x",
"[",
"1",
"]",
",",
"x",
"[",
"2",
"]",
")",
"if",
"isinstance",
"(",
"sche",
",",
"Pu... | Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | [
"\"\"\"\n Obtain the calibration pulse jobs and calculate the loss function.\n \"\"\"",
"# Generate the pulse jobs for calibration",
"# Simulate the calibration pulse",
"# Obtain the output population value",
"# Population of the first qubit in basis |0> when the second qubit is |1>",
"# Pop... | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | czCaliDynamicalPhaseJob | <not_specific> | def czCaliDynamicalPhaseJob(sche: Scheduler, q0: int, q1: int, q0VZPhase: float, q1VZPhase: float):
"""
Calibrate the dynamical phase by tuning the Z pulse.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be ca... |
Calibrate the dynamical phase by tuning the Z pulse.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be calibrated
:param q0VZPhase: the amplitude of the calibration phase on the first qubit
:param q1VZPha... | Calibrate the dynamical phase by tuning the Z pulse. | [
"Calibrate",
"the",
"dynamical",
"phase",
"by",
"tuning",
"the",
"Z",
"pulse",
"."
] | def czCaliDynamicalPhaseJob(sche: Scheduler, q0: int, q1: int, q0VZPhase: float, q1VZPhase: float):
qubits = (q0, q1)
sche.conf["caliDataCZ"][qubits]["q0VZPhase"] = q0VZPhase
sche.conf["caliDataCZ"][qubits]["q1VZPhase"] = q1VZPhase
sche.clearCircuit()
H(sche.Q[q0])
H(sche.Q[q1])
CZ(sche.Q[q0... | [
"def",
"czCaliDynamicalPhaseJob",
"(",
"sche",
":",
"Scheduler",
",",
"q0",
":",
"int",
",",
"q1",
":",
"int",
",",
"q0VZPhase",
":",
"float",
",",
"q1VZPhase",
":",
"float",
")",
":",
"qubits",
"=",
"(",
"q0",
",",
"q1",
")",
"sche",
".",
"conf",
... | Calibrate the dynamical phase by tuning the Z pulse. | [
"Calibrate",
"the",
"dynamical",
"phase",
"by",
"tuning",
"the",
"Z",
"pulse",
"."
] | [
"\"\"\"\n Calibrate the dynamical phase by tuning the Z pulse.\n\n :param sche: the Scheduler instance\n :param q0: the index of the first qubit to be calibrated\n :param q1: the index of the second qubit to be calibrated\n :param q0VZPhase: the amplitude of the calibration phase on the first qubit\n... | [
{
"param": "sche",
"type": "Scheduler"
},
{
"param": "q0",
"type": "int"
},
{
"param": "q1",
"type": "int"
},
{
"param": "q0VZPhase",
"type": "float"
},
{
"param": "q1VZPhase",
"type": "float"
}
] | {
"returns": [
{
"docstring": "the QJob instance",
"docstring_tokens": [
"the",
"QJob",
"instance"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sche",
"type": "Scheduler",
"docstring": "the Scheduler instance",
... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | czCaliDynamicalPhase | <not_specific> | def czCaliDynamicalPhase(sche: Scheduler, q0: int, q1: int, runner: Callable = None, method: str = 'Nelder-Mead',
maxIter: int = 50, q0VZPhaseInit: float = None, q1VZPhaseInit: float = None,
options: Any = None):
"""
Run the dynamical phase calibration procedure... |
Run the dynamical phase calibration procedure for the controlled-Z gates.
:param sche: the Scheduler instance
:param q0: the index of the first qubit to be calibrated
:param q1: the index of the second qubit to be calibrated
:param runner: a callable function which can pass the QJob/QJobList insta... | Run the dynamical phase calibration procedure for the controlled-Z gates. | [
"Run",
"the",
"dynamical",
"phase",
"calibration",
"procedure",
"for",
"the",
"controlled",
"-",
"Z",
"gates",
"."
] | def czCaliDynamicalPhase(sche: Scheduler, q0: int, q1: int, runner: Callable = None, method: str = 'Nelder-Mead',
maxIter: int = 50, q0VZPhaseInit: float = None, q1VZPhaseInit: float = None,
options: Any = None):
def _dynamicalPhaseCaliLoss(x):
caliJob = czC... | [
"def",
"czCaliDynamicalPhase",
"(",
"sche",
":",
"Scheduler",
",",
"q0",
":",
"int",
",",
"q1",
":",
"int",
",",
"runner",
":",
"Callable",
"=",
"None",
",",
"method",
":",
"str",
"=",
"'Nelder-Mead'",
",",
"maxIter",
":",
"int",
"=",
"50",
",",
"q0V... | Run the dynamical phase calibration procedure for the controlled-Z gates. | [
"Run",
"the",
"dynamical",
"phase",
"calibration",
"procedure",
"for",
"the",
"controlled",
"-",
"Z",
"gates",
"."
] | [
"\"\"\"\n Run the dynamical phase calibration procedure for the controlled-Z gates.\n\n :param sche: the Scheduler instance\n :param q0: the index of the first qubit to be calibrated\n :param q1: the index of the second qubit to be calibrated\n :param runner: a callable function which can pass the QJ... | [
{
"param": "sche",
"type": "Scheduler"
},
{
"param": "q0",
"type": "int"
},
{
"param": "q1",
"type": "int"
},
{
"param": "runner",
"type": "Callable"
},
{
"param": "method",
"type": "str"
},
{
"param": "maxIter",
"type": "int"
},
{
"param":... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sche",
"type": "Scheduler",
"docstring": "the Scheduler instance",
"docstring_tokens": [
"the",
"Scheduler",
"instance"
],
"default": null,
"is_optional": null
},
{
"iden... |
638556b7ea405e85c0888ff1507e5f2c977c87ac | baidu/Quanlse | Quanlse/Calibration/TwoQubit.py | [
"Apache-2.0"
] | Python | _dynamicalPhaseCaliLoss | <not_specific> | def _dynamicalPhaseCaliLoss(x):
"""
Obtain the calibration pulse jobs and calculate the loss function.
"""
# Generate the pulse jobs for calibration
caliJob = czCaliDynamicalPhaseJob(sche, q0, q1, x[0], x[1])
# Simulate the calibration pulse
if isinstance(sche, ... |
Obtain the calibration pulse jobs and calculate the loss function.
| Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | def _dynamicalPhaseCaliLoss(x):
caliJob = czCaliDynamicalPhaseJob(sche, q0, q1, x[0], x[1])
if isinstance(sche, PulseModel):
results = sche.simulate(job=caliJob, options=options)
else:
if runner is None or not callable(runner):
raise ArgumentError("Please ... | [
"def",
"_dynamicalPhaseCaliLoss",
"(",
"x",
")",
":",
"caliJob",
"=",
"czCaliDynamicalPhaseJob",
"(",
"sche",
",",
"q0",
",",
"q1",
",",
"x",
"[",
"0",
"]",
",",
"x",
"[",
"1",
"]",
")",
"if",
"isinstance",
"(",
"sche",
",",
"PulseModel",
")",
":",
... | Obtain the calibration pulse jobs and calculate the loss function. | [
"Obtain",
"the",
"calibration",
"pulse",
"jobs",
"and",
"calculate",
"the",
"loss",
"function",
"."
] | [
"\"\"\"\n Obtain the calibration pulse jobs and calculate the loss function.\n \"\"\"",
"# Generate the pulse jobs for calibration",
"# Simulate the calibration pulse",
"# Obtain the output population value",
"# Obtain the ideal population",
"# Calculate the loss function"
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
990759f00b01730545ccc33364b4487ff820deed | baidu/Quanlse | Example/9-example-RB.py | [
"Apache-2.0"
] | Python | targetGateErrorRate | <not_specific> | def targetGateErrorRate(pGate, pRef, dimension):
"""
Calculate the specific gate error rate.
"""
return ((1 - (pGate / pRef)) * (dimension - 1)) / dimension |
Calculate the specific gate error rate.
| Calculate the specific gate error rate. | [
"Calculate",
"the",
"specific",
"gate",
"error",
"rate",
"."
] | def targetGateErrorRate(pGate, pRef, dimension):
return ((1 - (pGate / pRef)) * (dimension - 1)) / dimension | [
"def",
"targetGateErrorRate",
"(",
"pGate",
",",
"pRef",
",",
"dimension",
")",
":",
"return",
"(",
"(",
"1",
"-",
"(",
"pGate",
"/",
"pRef",
")",
")",
"*",
"(",
"dimension",
"-",
"1",
")",
")",
"/",
"dimension"
] | Calculate the specific gate error rate. | [
"Calculate",
"the",
"specific",
"gate",
"error",
"rate",
"."
] | [
"\"\"\"\n Calculate the specific gate error rate.\n \"\"\""
] | [
{
"param": "pGate",
"type": null
},
{
"param": "pRef",
"type": null
},
{
"param": "dimension",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pGate",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pRef",
"type": null,
"docstring": null,
"docstring_tokens": ... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | combineOperatorAndOnSubSys | Union[QOperator, List[QOperator]] | def combineOperatorAndOnSubSys(subSysNum: int, operators: Union[QOperator, List[QOperator]] = None,
onSubSys: Union[int, List[int]] = None) -> Union[QOperator, List[QOperator]]:
"""
Set onSubSys information into the operator.
:param subSysNum: subsystem's number
:param op... |
Set onSubSys information into the operator.
:param subSysNum: subsystem's number
:param operators: the corresponding operator object(s)
:param onSubSys: subsystem's index(es)
:return: returned QOperator object(s)
| Set onSubSys information into the operator. | [
"Set",
"onSubSys",
"information",
"into",
"the",
"operator",
"."
] | def combineOperatorAndOnSubSys(subSysNum: int, operators: Union[QOperator, List[QOperator]] = None,
onSubSys: Union[int, List[int]] = None) -> Union[QOperator, List[QOperator]]:
if isinstance(operators, list) and not isinstance(onSubSys, list):
raise ArgumentError("operator is... | [
"def",
"combineOperatorAndOnSubSys",
"(",
"subSysNum",
":",
"int",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
"="... | Set onSubSys information into the operator. | [
"Set",
"onSubSys",
"information",
"into",
"the",
"operator",
"."
] | [
"\"\"\"\n Set onSubSys information into the operator.\n\n :param subSysNum: subsystem's number\n :param operators: the corresponding operator object(s)\n :param onSubSys: subsystem's index(es)\n :return: returned QOperator object(s)\n\n \"\"\"",
"# Verify if operator and onSubSys have the same s... | [
{
"param": "subSysNum",
"type": "int"
},
{
"param": "operators",
"type": "Union[QOperator, List[QOperator]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
}
] | {
"returns": [
{
"docstring": "returned QOperator object(s)",
"docstring_tokens": [
"returned",
"QOperator",
"object",
"(",
"s",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "subSysNum",
"type":... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | formatOperatorInput | Union | def formatOperatorInput(operators: Union[QOperator, Callable, List[QOperator], List[Callable]],
onSubSys: Union[int, List[int]], sysLevel: Union[int, List[int]]) -> Union:
"""
We allow input the Callable QOperator instances or the function.
"""
_operators = []
if isinstance(o... |
We allow input the Callable QOperator instances or the function.
| We allow input the Callable QOperator instances or the function. | [
"We",
"allow",
"input",
"the",
"Callable",
"QOperator",
"instances",
"or",
"the",
"function",
"."
] | def formatOperatorInput(operators: Union[QOperator, Callable, List[QOperator], List[Callable]],
onSubSys: Union[int, List[int]], sysLevel: Union[int, List[int]]) -> Union:
_operators = []
if isinstance(operators, list):
for opIdx, op in enumerate(operators):
if isinst... | [
"def",
"formatOperatorInput",
"(",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
... | We allow input the Callable QOperator instances or the function. | [
"We",
"allow",
"input",
"the",
"Callable",
"QOperator",
"instances",
"or",
"the",
"function",
"."
] | [
"\"\"\"\n We allow input the Callable QOperator instances or the function.\n \"\"\"",
"# Input operator is an QOperator instance",
"# Input operator is callable",
"# Input operator is an QOperator instance",
"# Input operator is callable"
] | [
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "sysLevel",
"type": "Union[int, List[int]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "onSubSys",
... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | tensor | ndarray | def tensor(*args) -> ndarray:
"""
Return the tensor product of all matrices in the list.
:param matrixList: the list of matrices to take the tensor product
:return: tensor product of matrices in the list
"""
# We firstly need to check if all the matrix in the list a numpy.ndarray
if len(arg... |
Return the tensor product of all matrices in the list.
:param matrixList: the list of matrices to take the tensor product
:return: tensor product of matrices in the list
| Return the tensor product of all matrices in the list. | [
"Return",
"the",
"tensor",
"product",
"of",
"all",
"matrices",
"in",
"the",
"list",
"."
] | def tensor(*args) -> ndarray:
if len(args) == 1 and isinstance(args[0], List):
args = tuple(args[0])
else:
if isinstance(args, ndarray):
return args
matrixReturn = array([[1.0]], dtype=complex)
for matrixIndex, matrixItem in enumerate(args):
matrixReturn = kron(matrix... | [
"def",
"tensor",
"(",
"*",
"args",
")",
"->",
"ndarray",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"List",
")",
":",
"args",
"=",
"tuple",
"(",
"args",
"[",
"0",
"]",
")",
"else",
":"... | Return the tensor product of all matrices in the list. | [
"Return",
"the",
"tensor",
"product",
"of",
"all",
"matrices",
"in",
"the",
"list",
"."
] | [
"\"\"\"\n Return the tensor product of all matrices in the list.\n\n :param matrixList: the list of matrices to take the tensor product\n :return: tensor product of matrices in the list\n \"\"\"",
"# We firstly need to check if all the matrix in the list a numpy.ndarray"
] | [] | {
"returns": [
{
"docstring": "tensor product of matrices in the list",
"docstring_tokens": [
"tensor",
"product",
"of",
"matrices",
"in",
"the",
"list"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [
... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | expect | float | def expect(matrix: ndarray, state: ndarray) -> float:
"""
Return the expectation value of the matrix in the given state.
:param matrix: the given matrix
:param state: the given state (1-d state or 2-d density matrix)
:return: expectation value of the matrix in given state
"""
def isSquare(... |
Return the expectation value of the matrix in the given state.
:param matrix: the given matrix
:param state: the given state (1-d state or 2-d density matrix)
:return: expectation value of the matrix in given state
| Return the expectation value of the matrix in the given state. | [
"Return",
"the",
"expectation",
"value",
"of",
"the",
"matrix",
"in",
"the",
"given",
"state",
"."
] | def expect(matrix: ndarray, state: ndarray) -> float:
def isSquare(m: ndarray) -> bool:
return all(len(row) == len(m) for row in m)
if not isSquare(matrix):
raise ArgumentError('Matrix is not a square matrix')
if state.shape[0] != matrix.shape[1]:
raise ArgumentError('Dimension Misma... | [
"def",
"expect",
"(",
"matrix",
":",
"ndarray",
",",
"state",
":",
"ndarray",
")",
"->",
"float",
":",
"def",
"isSquare",
"(",
"m",
":",
"ndarray",
")",
"->",
"bool",
":",
"\"\"\"\n This function is used to check whether the matrix is a square matrix\n :... | Return the expectation value of the matrix in the given state. | [
"Return",
"the",
"expectation",
"value",
"of",
"the",
"matrix",
"in",
"the",
"given",
"state",
"."
] | [
"\"\"\"\n Return the expectation value of the matrix in the given state.\n\n :param matrix: the given matrix\n :param state: the given state (1-d state or 2-d density matrix)\n :return: expectation value of the matrix in given state\n \"\"\"",
"\"\"\"\n This function is used to check whether... | [
{
"param": "matrix",
"type": "ndarray"
},
{
"param": "state",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "expectation value of the matrix in given state",
"docstring_tokens": [
"expectation",
"value",
"of",
"the",
"matrix",
"in",
"given",
"state"
],
"type": null
}
],
"raises": [],
"params":... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | isSquare | bool | def isSquare(m: ndarray) -> bool:
"""
This function is used to check whether the matrix is a square matrix
:param m: input matrix
:return: a bool value
"""
return all(len(row) == len(m) for row in m) |
This function is used to check whether the matrix is a square matrix
:param m: input matrix
:return: a bool value
| This function is used to check whether the matrix is a square matrix | [
"This",
"function",
"is",
"used",
"to",
"check",
"whether",
"the",
"matrix",
"is",
"a",
"square",
"matrix"
] | def isSquare(m: ndarray) -> bool:
return all(len(row) == len(m) for row in m) | [
"def",
"isSquare",
"(",
"m",
":",
"ndarray",
")",
"->",
"bool",
":",
"return",
"all",
"(",
"len",
"(",
"row",
")",
"==",
"len",
"(",
"m",
")",
"for",
"row",
"in",
"m",
")"
] | This function is used to check whether the matrix is a square matrix | [
"This",
"function",
"is",
"used",
"to",
"check",
"whether",
"the",
"matrix",
"is",
"a",
"square",
"matrix"
] | [
"\"\"\"\n This function is used to check whether the matrix is a square matrix\n :param m: input matrix\n :return: a bool value\n \"\"\""
] | [
{
"param": "m",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "a bool value",
"docstring_tokens": [
"a",
"bool",
"value"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "m",
"type": "ndarray",
"docstring": null,
"docstring_tokens": [
"No... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | computationalBasisList | List[str] | def computationalBasisList(qubitNum: int, sysLevel: int) -> List[str]:
"""
Return a list of strings labeling eigenstates.
For example, ``computationalBasisList(2, 3)`` will return:
``['00', '01', '02', '10', '11', '12', '20', '21', '22']``
:param qubitNum: the number of qubits in the system
:pa... |
Return a list of strings labeling eigenstates.
For example, ``computationalBasisList(2, 3)`` will return:
``['00', '01', '02', '10', '11', '12', '20', '21', '22']``
:param qubitNum: the number of qubits in the system
:param sysLevel: the energy level of the qubits in the system
:return: the li... | Return a list of strings labeling eigenstates. | [
"Return",
"a",
"list",
"of",
"strings",
"labeling",
"eigenstates",
"."
] | def computationalBasisList(qubitNum: int, sysLevel: int) -> List[str]:
if not isinstance(sysLevel, int):
raise ArgumentError('The system level can only be an integer.')
itemCount = sysLevel ** qubitNum
strList = []
for index in range(itemCount):
bStr = ''
for qu in range(qubitNum... | [
"def",
"computationalBasisList",
"(",
"qubitNum",
":",
"int",
",",
"sysLevel",
":",
"int",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"not",
"isinstance",
"(",
"sysLevel",
",",
"int",
")",
":",
"raise",
"ArgumentError",
"(",
"'The system level can only b... | Return a list of strings labeling eigenstates. | [
"Return",
"a",
"list",
"of",
"strings",
"labeling",
"eigenstates",
"."
] | [
"\"\"\"\n Return a list of strings labeling eigenstates.\n For example, ``computationalBasisList(2, 3)`` will return:\n ``['00', '01', '02', '10', '11', '12', '20', '21', '22']``\n\n :param qubitNum: the number of qubits in the system\n :param sysLevel: the energy level of the qubits in the system\n ... | [
{
"param": "qubitNum",
"type": "int"
},
{
"param": "sysLevel",
"type": "int"
}
] | {
"returns": [
{
"docstring": "the list of strings labeling eigenstates",
"docstring_tokens": [
"the",
"list",
"of",
"strings",
"labeling",
"eigenstates"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "qubi... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | generateBasisIndexList | List[int] | def generateBasisIndexList(basisStrList: List[str], sysLevel: int) -> List[int]:
"""
Return a list of integers which indicates the basis indices according to the input basis string list.
For example, ``generateBasisIndexList(['00', '01', '10', '11'], 3)`` will return:
``[0, 1, 3, 4]``
:param basisS... |
Return a list of integers which indicates the basis indices according to the input basis string list.
For example, ``generateBasisIndexList(['00', '01', '10', '11'], 3)`` will return:
``[0, 1, 3, 4]``
:param basisStrList: basis string list
:param sysLevel: the energy level of qubits in the system.... | Return a list of integers which indicates the basis indices according to the input basis string list. | [
"Return",
"a",
"list",
"of",
"integers",
"which",
"indicates",
"the",
"basis",
"indices",
"according",
"to",
"the",
"input",
"basis",
"string",
"list",
"."
] | def generateBasisIndexList(basisStrList: List[str], sysLevel: int) -> List[int]:
if not isinstance(sysLevel, int):
raise ArgumentError('The system level can only be an integer.')
strLen = [len(item) for item in basisStrList]
if max(strLen) != min(strLen):
raise ArgumentError('All input digit... | [
"def",
"generateBasisIndexList",
"(",
"basisStrList",
":",
"List",
"[",
"str",
"]",
",",
"sysLevel",
":",
"int",
")",
"->",
"List",
"[",
"int",
"]",
":",
"if",
"not",
"isinstance",
"(",
"sysLevel",
",",
"int",
")",
":",
"raise",
"ArgumentError",
"(",
"... | Return a list of integers which indicates the basis indices according to the input basis string list. | [
"Return",
"a",
"list",
"of",
"integers",
"which",
"indicates",
"the",
"basis",
"indices",
"according",
"to",
"the",
"input",
"basis",
"string",
"list",
"."
] | [
"\"\"\"\n Return a list of integers which indicates the basis indices according to the input basis string list.\n For example, ``generateBasisIndexList(['00', '01', '10', '11'], 3)`` will return:\n ``[0, 1, 3, 4]``\n\n :param basisStrList: basis string list\n :param sysLevel: the energy level of qubi... | [
{
"param": "basisStrList",
"type": "List[str]"
},
{
"param": "sysLevel",
"type": "int"
}
] | {
"returns": [
{
"docstring": "basis indixes list",
"docstring_tokens": [
"basis",
"indixes",
"list"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "basisStrList",
"type": "List[str]",
"docstring": "basis string list",... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | translateStrToInt | int | def translateStrToInt(strN: str) -> int:
"""
Translate a string to int.
:param strN: input string
:return: an int value
"""
intNum = 0
for digIndex, charN in enumerate(strN):
dig = int(charN)
if dig >= sysLevel:
raise Argume... |
Translate a string to int.
:param strN: input string
:return: an int value
| Translate a string to int. | [
"Translate",
"a",
"string",
"to",
"int",
"."
] | def translateStrToInt(strN: str) -> int:
intNum = 0
for digIndex, charN in enumerate(strN):
dig = int(charN)
if dig >= sysLevel:
raise ArgumentError(f"Digit '{dig}' is greater than sysLevel '{sysLevel}'.")
intNum += (sysLevel ** (digLen - digIndex - 1)... | [
"def",
"translateStrToInt",
"(",
"strN",
":",
"str",
")",
"->",
"int",
":",
"intNum",
"=",
"0",
"for",
"digIndex",
",",
"charN",
"in",
"enumerate",
"(",
"strN",
")",
":",
"dig",
"=",
"int",
"(",
"charN",
")",
"if",
"dig",
">=",
"sysLevel",
":",
"ra... | Translate a string to int. | [
"Translate",
"a",
"string",
"to",
"int",
"."
] | [
"\"\"\"\n Translate a string to int.\n :param strN: input string\n :return: an int value\n \"\"\""
] | [
{
"param": "strN",
"type": "str"
}
] | {
"returns": [
{
"docstring": "an int value",
"docstring_tokens": [
"an",
"int",
"value"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "strN",
"type": "str",
"docstring": null,
"docstring_tokens": [
"Non... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | globalPhase | float | def globalPhase(U: ndarray) -> float:
r"""
Compute the global phase of a 2*2 unitary matrix.
Each 2*2 unitary matrix can be equivalently characterized as:
:math:`U = e^{i\alpha} R_z(\phi) R_y(\theta) R_z(\lambda)`
We aim to compute the global phase `\alpha`.
See also Theorem 4.1 in `Nielsen & ... | r"""
Compute the global phase of a 2*2 unitary matrix.
Each 2*2 unitary matrix can be equivalently characterized as:
:math:`U = e^{i\alpha} R_z(\phi) R_y(\theta) R_z(\lambda)`
We aim to compute the global phase `\alpha`.
See also Theorem 4.1 in `Nielsen & Chuang`'s book.
:param U: the matrix ... | r"""
Compute the global phase of a 2*2 unitary matrix.
Each 2*2 unitary matrix can be equivalently characterized as. | [
"r",
"\"",
"\"",
"\"",
"Compute",
"the",
"global",
"phase",
"of",
"a",
"2",
"*",
"2",
"unitary",
"matrix",
".",
"Each",
"2",
"*",
"2",
"unitary",
"matrix",
"can",
"be",
"equivalently",
"characterized",
"as",
"."
] | def globalPhase(U: ndarray) -> float:
coe = linalg.det(U) ** (-0.5)
alpha = - angle(coe)
return alpha | [
"def",
"globalPhase",
"(",
"U",
":",
"ndarray",
")",
"->",
"float",
":",
"coe",
"=",
"linalg",
".",
"det",
"(",
"U",
")",
"**",
"(",
"-",
"0.5",
")",
"alpha",
"=",
"-",
"angle",
"(",
"coe",
")",
"return",
"alpha"
] | r"""
Compute the global phase of a 2*2 unitary matrix. | [
"r",
"\"",
"\"",
"\"",
"Compute",
"the",
"global",
"phase",
"of",
"a",
"2",
"*",
"2",
"unitary",
"matrix",
"."
] | [
"r\"\"\"\n Compute the global phase of a 2*2 unitary matrix.\n Each 2*2 unitary matrix can be equivalently characterized as:\n\n :math:`U = e^{i\\alpha} R_z(\\phi) R_y(\\theta) R_z(\\lambda)`\n\n We aim to compute the global phase `\\alpha`.\n See also Theorem 4.1 in `Nielsen & Chuang`'s book.\n\n ... | [
{
"param": "U",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "the global phase of the unitary matrix",
"docstring_tokens": [
"the",
"global",
"phase",
"of",
"the",
"unitary",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier"... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | population | dict | def population(rho: ndarray, subNum: int, dimList: List[int], plot=False) -> dict:
"""
Output a dictionary to show population of multi-qubit matrix
:param rho: density matrix
:param subNum: number of qubits
:param dimList: the dimension of each subsystem
:param plot: an option to plot populatio... |
Output a dictionary to show population of multi-qubit matrix
:param rho: density matrix
:param subNum: number of qubits
:param dimList: the dimension of each subsystem
:param plot: an option to plot population
:return: a dictionary illustrate population of each energy level
| Output a dictionary to show population of multi-qubit matrix | [
"Output",
"a",
"dictionary",
"to",
"show",
"population",
"of",
"multi",
"-",
"qubit",
"matrix"
] | def population(rho: ndarray, subNum: int, dimList: List[int], plot=False) -> dict:
a = rho.shape
if a[0] != a[1]:
raise ArgumentError("The input matrix is invalid")
if subNum != len(dimList):
raise ArgumentError("Invalid dimList: dimList is inconsistent with subNum")
dim = 1
for j in... | [
"def",
"population",
"(",
"rho",
":",
"ndarray",
",",
"subNum",
":",
"int",
",",
"dimList",
":",
"List",
"[",
"int",
"]",
",",
"plot",
"=",
"False",
")",
"->",
"dict",
":",
"a",
"=",
"rho",
".",
"shape",
"if",
"a",
"[",
"0",
"]",
"!=",
"a",
"... | Output a dictionary to show population of multi-qubit matrix | [
"Output",
"a",
"dictionary",
"to",
"show",
"population",
"of",
"multi",
"-",
"qubit",
"matrix"
] | [
"\"\"\"\n Output a dictionary to show population of multi-qubit matrix\n\n :param rho: density matrix\n :param subNum: number of qubits\n :param dimList: the dimension of each subsystem\n :param plot: an option to plot population\n :return: a dictionary illustrate population of each energy level\n... | [
{
"param": "rho",
"type": "ndarray"
},
{
"param": "subNum",
"type": "int"
},
{
"param": "dimList",
"type": "List[int]"
},
{
"param": "plot",
"type": null
}
] | {
"returns": [
{
"docstring": "a dictionary illustrate population of each energy level",
"docstring_tokens": [
"a",
"dictionary",
"illustrate",
"population",
"of",
"each",
"energy",
"level"
],
"type": null
}
],
"raises... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | findIndex | <not_specific> | def findIndex(referenceVecs: ndarray, indexKet: Union[List[ndarray], ndarray]):
"""
Find the index of the given kets in the indexKet using inner product.
:param referenceVecs: ndarray of reference vectors.
:param indexKet: target ket or kets list.
:return: list of index number.
"""
# initia... |
Find the index of the given kets in the indexKet using inner product.
:param referenceVecs: ndarray of reference vectors.
:param indexKet: target ket or kets list.
:return: list of index number.
| Find the index of the given kets in the indexKet using inner product. | [
"Find",
"the",
"index",
"of",
"the",
"given",
"kets",
"in",
"the",
"indexKet",
"using",
"inner",
"product",
"."
] | def findIndex(referenceVecs: ndarray, indexKet: Union[List[ndarray], ndarray]):
idxList = []
refVecList = copy.deepcopy(referenceVecs.T)
if isinstance(indexKet, list):
for ket in indexKet:
innerProd = [vec for vec in refVecList @ ket]
innerVal = max(innerProd)
ind... | [
"def",
"findIndex",
"(",
"referenceVecs",
":",
"ndarray",
",",
"indexKet",
":",
"Union",
"[",
"List",
"[",
"ndarray",
"]",
",",
"ndarray",
"]",
")",
":",
"idxList",
"=",
"[",
"]",
"refVecList",
"=",
"copy",
".",
"deepcopy",
"(",
"referenceVecs",
".",
"... | Find the index of the given kets in the indexKet using inner product. | [
"Find",
"the",
"index",
"of",
"the",
"given",
"kets",
"in",
"the",
"indexKet",
"using",
"inner",
"product",
"."
] | [
"\"\"\"\n Find the index of the given kets in the indexKet using inner product.\n\n :param referenceVecs: ndarray of reference vectors.\n :param indexKet: target ket or kets list.\n :return: list of index number.\n \"\"\"",
"# initialize index list"
] | [
{
"param": "referenceVecs",
"type": "ndarray"
},
{
"param": "indexKet",
"type": "Union[List[ndarray], ndarray]"
}
] | {
"returns": [
{
"docstring": "list of index number.",
"docstring_tokens": [
"list",
"of",
"index",
"number",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "referenceVecs",
"type": "ndarray",
"docs... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | fitCR | <not_specific> | def fitCR(xData: array, yData: array):
"""
Fit the rabi oscillation of cross-resonance effect.
:param xData: The data of x values.
:param yData: The data of y values.
:return: The callable fitting function and the fitting parameters.
"""
def fit(x, p):
return 0.5 * cos(2 * pi * p[... |
Fit the rabi oscillation of cross-resonance effect.
:param xData: The data of x values.
:param yData: The data of y values.
:return: The callable fitting function and the fitting parameters.
| Fit the rabi oscillation of cross-resonance effect. | [
"Fit",
"the",
"rabi",
"oscillation",
"of",
"cross",
"-",
"resonance",
"effect",
"."
] | def fitCR(xData: array, yData: array):
def fit(x, p):
return 0.5 * cos(2 * pi * p[1] * x) + 0.5
def error(p, x, y, fitFunc):
return ((y - fitFunc(x, p)) ** 2).sum() / len(y)
step = xData[1] - xData[0]
pows = abs(fft.fft(yData))
freqs = fft.fftfreq(xData.size, step)
index = argmax... | [
"def",
"fitCR",
"(",
"xData",
":",
"array",
",",
"yData",
":",
"array",
")",
":",
"def",
"fit",
"(",
"x",
",",
"p",
")",
":",
"return",
"0.5",
"*",
"cos",
"(",
"2",
"*",
"pi",
"*",
"p",
"[",
"1",
"]",
"*",
"x",
")",
"+",
"0.5",
"def",
"er... | Fit the rabi oscillation of cross-resonance effect. | [
"Fit",
"the",
"rabi",
"oscillation",
"of",
"cross",
"-",
"resonance",
"effect",
"."
] | [
"\"\"\"\n Fit the rabi oscillation of cross-resonance effect.\n\n :param xData: The data of x values.\n :param yData: The data of y values.\n\n :return: The callable fitting function and the fitting parameters.\n \"\"\""
] | [
{
"param": "xData",
"type": "array"
},
{
"param": "yData",
"type": "array"
}
] | {
"returns": [
{
"docstring": "The callable fitting function and the fitting parameters.",
"docstring_tokens": [
"The",
"callable",
"fitting",
"function",
"and",
"the",
"fitting",
"parameters",
"."
],
"type": null
... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | blockDiag | <not_specific> | def blockDiag(matrix: ndarray, subIndex: List[int]):
"""
Block diagonalize a given matrix using the principle of least action.
:param matrix: The given matrix to be block diagonalized.
:param subIndex: The indexes of sub-system.
:return: Block diagonalization Matrix and transform Unitary
"""
... |
Block diagonalize a given matrix using the principle of least action.
:param matrix: The given matrix to be block diagonalized.
:param subIndex: The indexes of sub-system.
:return: Block diagonalization Matrix and transform Unitary
| Block diagonalize a given matrix using the principle of least action. | [
"Block",
"diagonalize",
"a",
"given",
"matrix",
"using",
"the",
"principle",
"of",
"least",
"action",
"."
] | def blockDiag(matrix: ndarray, subIndex: List[int]):
if matrix.shape[0] is not matrix.shape[1]:
raise ArgumentError('Not a square matrix')
if len(subIndex) > max(matrix.shape):
raise ArgumentError(f'Number of indexes {len(subIndex)} exceeds matrix dimension len{matrix}')
valsInit, vecsInit =... | [
"def",
"blockDiag",
"(",
"matrix",
":",
"ndarray",
",",
"subIndex",
":",
"List",
"[",
"int",
"]",
")",
":",
"if",
"matrix",
".",
"shape",
"[",
"0",
"]",
"is",
"not",
"matrix",
".",
"shape",
"[",
"1",
"]",
":",
"raise",
"ArgumentError",
"(",
"'Not a... | Block diagonalize a given matrix using the principle of least action. | [
"Block",
"diagonalize",
"a",
"given",
"matrix",
"using",
"the",
"principle",
"of",
"least",
"action",
"."
] | [
"\"\"\"\n Block diagonalize a given matrix using the principle of least action.\n\n :param matrix: The given matrix to be block diagonalized.\n :param subIndex: The indexes of sub-system.\n\n :return: Block diagonalization Matrix and transform Unitary\n \"\"\"",
"# Calculate the eigenvectors and ei... | [
{
"param": "matrix",
"type": "ndarray"
},
{
"param": "subIndex",
"type": "List[int]"
}
] | {
"returns": [
{
"docstring": "Block diagonalization Matrix and transform Unitary",
"docstring_tokens": [
"Block",
"diagonalization",
"Matrix",
"and",
"transform",
"Unitary"
],
"type": null
}
],
"raises": [],
"params": [
{
... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | eigenSystem | <not_specific> | def eigenSystem(matrix: ndarray):
"""
compute the eigenvalues and the corresponding eigenvectors for the given matrix.
(sorted by eigenvalues: Ascending order)
:param matrix: base matrix of the eigen system
:return: sorted eigenvalues (eigenenergies) and corresponding eigenvectors (eigenstates) (o... |
compute the eigenvalues and the corresponding eigenvectors for the given matrix.
(sorted by eigenvalues: Ascending order)
:param matrix: base matrix of the eigen system
:return: sorted eigenvalues (eigenenergies) and corresponding eigenvectors (eigenstates) (ordered by column)
| compute the eigenvalues and the corresponding eigenvectors for the given matrix.
(sorted by eigenvalues: Ascending order) | [
"compute",
"the",
"eigenvalues",
"and",
"the",
"corresponding",
"eigenvectors",
"for",
"the",
"given",
"matrix",
".",
"(",
"sorted",
"by",
"eigenvalues",
":",
"Ascending",
"order",
")"
] | def eigenSystem(matrix: ndarray):
eigenVals, eigenVecs = linalg.eig(matrix)
sortedIndex = eigenVals.argsort()
eigenVecs = eigenVecs[:, sortedIndex]
eigenVals = eigenVals[sortedIndex]
eigenVecs = eigenVecs
return eigenVals.real, eigenVecs | [
"def",
"eigenSystem",
"(",
"matrix",
":",
"ndarray",
")",
":",
"eigenVals",
",",
"eigenVecs",
"=",
"linalg",
".",
"eig",
"(",
"matrix",
")",
"sortedIndex",
"=",
"eigenVals",
".",
"argsort",
"(",
")",
"eigenVecs",
"=",
"eigenVecs",
"[",
":",
",",
"sortedI... | compute the eigenvalues and the corresponding eigenvectors for the given matrix. | [
"compute",
"the",
"eigenvalues",
"and",
"the",
"corresponding",
"eigenvectors",
"for",
"the",
"given",
"matrix",
"."
] | [
"\"\"\"\n compute the eigenvalues and the corresponding eigenvectors for the given matrix.\n (sorted by eigenvalues: Ascending order)\n\n :param matrix: base matrix of the eigen system\n\n :return: sorted eigenvalues (eigenenergies) and corresponding eigenvectors (eigenstates) (ordered by column)\n \... | [
{
"param": "matrix",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "sorted eigenvalues (eigenenergies) and corresponding eigenvectors (eigenstates) (ordered by column)",
"docstring_tokens": [
"sorted",
"eigenvalues",
"(",
"eigenenergies",
")",
"and",
"corresponding",
"eigenv... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | wigner | <not_specific> | def wigner(rho: ndarray, xRange: ndarray, yRange: ndarray):
"""
Calculate the wigner function of density matrix using laguerre polynomial.
:param rho: Input density matrix.
:param xRange: The range of the X quadrature in the phase space.
:param yRange: The range of the y quadrature in the phase spa... |
Calculate the wigner function of density matrix using laguerre polynomial.
:param rho: Input density matrix.
:param xRange: The range of the X quadrature in the phase space.
:param yRange: The range of the y quadrature in the phase space.
| Calculate the wigner function of density matrix using laguerre polynomial. | [
"Calculate",
"the",
"wigner",
"function",
"of",
"density",
"matrix",
"using",
"laguerre",
"polynomial",
"."
] | def wigner(rho: ndarray, xRange: ndarray, yRange: ndarray):
X, P = meshgrid(xRange, yRange)
T = X ** 2 + P ** 2
def _wignerLaguerre(_m, _n):
if _m == _n:
poly = laguerre(_n)
_w = ((-1) ** _n / pi) * exp(-T) * poly(2 * T)
else:
factor1 = sqrt(factorial(m) /... | [
"def",
"wigner",
"(",
"rho",
":",
"ndarray",
",",
"xRange",
":",
"ndarray",
",",
"yRange",
":",
"ndarray",
")",
":",
"X",
",",
"P",
"=",
"meshgrid",
"(",
"xRange",
",",
"yRange",
")",
"T",
"=",
"X",
"**",
"2",
"+",
"P",
"**",
"2",
"def",
"_wign... | Calculate the wigner function of density matrix using laguerre polynomial. | [
"Calculate",
"the",
"wigner",
"function",
"of",
"density",
"matrix",
"using",
"laguerre",
"polynomial",
"."
] | [
"\"\"\"\n Calculate the wigner function of density matrix using laguerre polynomial.\n\n :param rho: Input density matrix.\n :param xRange: The range of the X quadrature in the phase space.\n :param yRange: The range of the y quadrature in the phase space.\n \"\"\"",
"\"\"\"\n Return wigner ... | [
{
"param": "rho",
"type": "ndarray"
},
{
"param": "xRange",
"type": "ndarray"
},
{
"param": "yRange",
"type": "ndarray"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rho",
"type": "ndarray",
"docstring": "Input density matrix.",
"docstring_tokens": [
"Input",
"density",
"matrix",
"."
],
"default": null,
"is_optional": null
},
{
... |
db7ab824d7196240ba567a5e8c43d919097cb496 | baidu/Quanlse | Quanlse/Utils/Functions.py | [
"Apache-2.0"
] | Python | coherent | <not_specific> | def coherent(dim: int = 2, alpha: complex = 0 + 0j):
"""
Generate a coherent state using displacement operator.
:param dim: dimension of the coherent state truncated.
:param alpha: the eigenvalue of the annihilation operator.
"""
# Initialize a vacuum state
psi0 = basis(dim, 0)
a = des... |
Generate a coherent state using displacement operator.
:param dim: dimension of the coherent state truncated.
:param alpha: the eigenvalue of the annihilation operator.
| Generate a coherent state using displacement operator. | [
"Generate",
"a",
"coherent",
"state",
"using",
"displacement",
"operator",
"."
] | def coherent(dim: int = 2, alpha: complex = 0 + 0j):
psi0 = basis(dim, 0)
a = destroy(dim).matrix
adag = dagger(a)
disp = linalg.expm(alpha * adag - conj(alpha) * a)
psi = disp @ psi0
return psi | [
"def",
"coherent",
"(",
"dim",
":",
"int",
"=",
"2",
",",
"alpha",
":",
"complex",
"=",
"0",
"+",
"0j",
")",
":",
"psi0",
"=",
"basis",
"(",
"dim",
",",
"0",
")",
"a",
"=",
"destroy",
"(",
"dim",
")",
".",
"matrix",
"adag",
"=",
"dagger",
"("... | Generate a coherent state using displacement operator. | [
"Generate",
"a",
"coherent",
"state",
"using",
"displacement",
"operator",
"."
] | [
"\"\"\"\n Generate a coherent state using displacement operator.\n\n :param dim: dimension of the coherent state truncated.\n :param alpha: the eigenvalue of the annihilation operator.\n \"\"\"",
"# Initialize a vacuum state",
"# construct a displacement operator"
] | [
{
"param": "dim",
"type": "int"
},
{
"param": "alpha",
"type": "complex"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dim",
"type": "int",
"docstring": "dimension of the coherent state truncated.",
"docstring_tokens": [
"dimension",
"of",
"the",
"coherent",
"state",
"truncated",
"."
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | waveFunctionToSequence | 'QWaveform' | def waveFunctionToSequence(self, dt: float, maxEndTime: float = None) -> 'QWaveform':
"""
Transform the function in QWaveform object to a sequence.
:param dt: AWG sampling time
:param maxEndTime: maximum ending time
:return: returned QWaveform object
"""
if self... |
Transform the function in QWaveform object to a sequence.
:param dt: AWG sampling time
:param maxEndTime: maximum ending time
:return: returned QWaveform object
| Transform the function in QWaveform object to a sequence. | [
"Transform",
"the",
"function",
"in",
"QWaveform",
"object",
"to",
"a",
"sequence",
"."
] | def waveFunctionToSequence(self, dt: float, maxEndTime: float = None) -> 'QWaveform':
if self.func is not None:
if dt is not None:
_dt = dt
elif self.dt is not None:
_dt = self.dt
else:
raise Error.ArgumentError("Argument dt is ... | [
"def",
"waveFunctionToSequence",
"(",
"self",
",",
"dt",
":",
"float",
",",
"maxEndTime",
":",
"float",
"=",
"None",
")",
"->",
"'QWaveform'",
":",
"if",
"self",
".",
"func",
"is",
"not",
"None",
":",
"if",
"dt",
"is",
"not",
"None",
":",
"_dt",
"=",... | Transform the function in QWaveform object to a sequence. | [
"Transform",
"the",
"function",
"in",
"QWaveform",
"object",
"to",
"a",
"sequence",
"."
] | [
"\"\"\"\n Transform the function in QWaveform object to a sequence.\n\n :param dt: AWG sampling time\n :param maxEndTime: maximum ending time\n :return: returned QWaveform object\n \"\"\"",
"# QWAVEFORM_FLAG_ALWAYS_ON flag",
"# Generate sequence"
] | [
{
"param": "self",
"type": null
},
{
"param": "dt",
"type": "float"
},
{
"param": "maxEndTime",
"type": "float"
}
] | {
"returns": [
{
"docstring": "returned QWaveform object",
"docstring_tokens": [
"returned",
"QWaveform",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstrin... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | copy | 'QWaveform' | def copy(self) -> 'QWaveform':
"""
Return the copy of the object
"""
return copy.deepcopy(self) |
Return the copy of the object
| Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | def copy(self) -> 'QWaveform':
return copy.deepcopy(self) | [
"def",
"copy",
"(",
"self",
")",
"->",
"'QWaveform'",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | [
"\"\"\"\n Return the copy of the object\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | load | 'QWaveform' | def load(base64Str: str) -> 'QWaveform':
"""
Create object from base64 encoded string.
:param base64Str: a input base64 encoded string
:return: returned QWaveform object
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QWave... |
Create object from base64 encoded string.
:param base64Str: a input base64 encoded string
:return: returned QWaveform object
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QWaveform':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
if not hasattr(obj, "freq"):
obj.freq = obj.omega if hasattr(obj, "omega") else None
if not hasattr(obj, "phase0"):
obj.phase0 = obj.phi if hasatt... | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QWaveform'",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64Str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pickle",
".",
"loads",
"(",
"byteStr",
")",
"if",
"not",
"hasattr",
"... | Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | [
"\"\"\"\n Create object from base64 encoded string.\n\n :param base64Str: a input base64 encoded string\n :return: returned QWaveform object\n \"\"\"",
"# type: QWaveform",
"# For compatibility with previous versions"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [
{
"docstring": "returned QWaveform object",
"docstring_tokens": [
"returned",
"QWaveform",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": "a input base64... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | subSysNum | null | def subSysNum(self, value: int):
"""
Set the number of the subsystems.
:param value: the number of the subsystems.
"""
if not isinstance(value, int):
raise Error.ArgumentError("subSysNum must be an integer!")
if value < 1:
raise Error.ArgumentErro... |
Set the number of the subsystems.
:param value: the number of the subsystems.
| Set the number of the subsystems. | [
"Set",
"the",
"number",
"of",
"the",
"subsystems",
"."
] | def subSysNum(self, value: int):
if not isinstance(value, int):
raise Error.ArgumentError("subSysNum must be an integer!")
if value < 1:
raise Error.ArgumentError("subSysNum must be larger than 0!")
self._subSysNum = value | [
"def",
"subSysNum",
"(",
"self",
",",
"value",
":",
"int",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
"\"subSysNum must be an integer!\"",
")",
"if",
"value",
"<",
"1",
":",
"rais... | Set the number of the subsystems. | [
"Set",
"the",
"number",
"of",
"the",
"subsystems",
"."
] | [
"\"\"\"\n Set the number of the subsystems.\n\n :param value: the number of the subsystems.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "int",
"docstring": "the number of the subsystems."... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | sysLevel | null | def sysLevel(self, value: Union[int, List[int]]):
"""
Set the level of the subsystems.
:param value: the number of the subsystems
"""
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sysSize must be an integer or a list!")
... |
Set the level of the subsystems.
:param value: the number of the subsystems
| Set the level of the subsystems. | [
"Set",
"the",
"level",
"of",
"the",
"subsystems",
"."
] | def sysLevel(self, value: Union[int, List[int]]):
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sysSize must be an integer or a list!")
if isinstance(value, list) and min(value) < 2:
raise Error.ArgumentError("All items in sysSize must ... | [
"def",
"sysLevel",
"(",
"self",
",",
"value",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"int",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"raise... | Set the level of the subsystems. | [
"Set",
"the",
"level",
"of",
"the",
"subsystems",
"."
] | [
"\"\"\"\n Set the level of the subsystems.\n\n :param value: the number of the subsystems\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Union[int, List[int]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Union[int, List[int]]",
"docstring": "the number o... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | waveCache | Dict[str, Any] | def waveCache(self) -> Dict[str, Any]:
"""
Return the cache of the pulses.
"""
return self._waveCache |
Return the cache of the pulses.
| Return the cache of the pulses. | [
"Return",
"the",
"cache",
"of",
"the",
"pulses",
"."
] | def waveCache(self) -> Dict[str, Any]:
return self._waveCache | [
"def",
"waveCache",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"_waveCache"
] | Return the cache of the pulses. | [
"Return",
"the",
"cache",
"of",
"the",
"pulses",
"."
] | [
"\"\"\"\n Return the cache of the pulses.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | ctrlOperators | Dict[str, Union[QOperator, List[QOperator]]] | def ctrlOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
"""
Return the dictionary of control operators.
"""
return self._ctrlOperators |
Return the dictionary of control operators.
| Return the dictionary of control operators. | [
"Return",
"the",
"dictionary",
"of",
"control",
"operators",
"."
] | def ctrlOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
return self._ctrlOperators | [
"def",
"ctrlOperators",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_ctrlOperators"
] | Return the dictionary of control operators. | [
"Return",
"the",
"dictionary",
"of",
"control",
"operators",
"."
] | [
"\"\"\"\n Return the dictionary of control operators.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | dt | float | def dt(self) -> float:
"""
Return the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm).
"""
return self._dt |
Return the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm).
| Return the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm). | [
"Return",
"the",
"arbitrary",
"wave",
"generator",
"'",
"s",
"(",
"AWG",
")",
"sampling",
"time",
"interval",
"(",
"also",
"stands",
"for",
"the",
"step",
"size",
"for",
"the",
"piecewise",
"-",
"constant",
"quantum",
"simulation",
"algorithm",
")",
"."
] | def dt(self) -> float:
return self._dt | [
"def",
"dt",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_dt"
] | Return the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm). | [
"Return",
"the",
"arbitrary",
"wave",
"generator",
"'",
"s",
"(",
"AWG",
")",
"sampling",
"time",
"interval",
"(",
"also",
"stands",
"for",
"the",
"step",
"size",
"for",
"the",
"piecewise",
"-",
"constant",
"quantum",
"simulation",
"algorithm",
")",
"."
] | [
"\"\"\"\n Return the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for\n the piecewise-constant quantum simulation algorithm).\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | dt | null | def dt(self, value: float):
"""
Set the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm).
"""
if not isinstance(value, float):
raise Error.ArgumentError("dt must be a float ... |
Set the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm).
| Set the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm). | [
"Set",
"the",
"arbitrary",
"wave",
"generator",
"'",
"s",
"(",
"AWG",
")",
"sampling",
"time",
"interval",
"(",
"also",
"stands",
"for",
"the",
"step",
"size",
"for",
"the",
"piecewise",
"-",
"constant",
"quantum",
"simulation",
"algorithm",
")",
"."
] | def dt(self, value: float):
if not isinstance(value, float):
raise Error.ArgumentError("dt must be a float number!")
if value < 0.0:
raise Error.ArgumentError("dt must be larger than 0!")
self._dt = value | [
"def",
"dt",
"(",
"self",
",",
"value",
":",
"float",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"float",
")",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
"\"dt must be a float number!\"",
")",
"if",
"value",
"<",
"0.0",
":",
"raise",
... | Set the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for
the piecewise-constant quantum simulation algorithm). | [
"Set",
"the",
"arbitrary",
"wave",
"generator",
"'",
"s",
"(",
"AWG",
")",
"sampling",
"time",
"interval",
"(",
"also",
"stands",
"for",
"the",
"step",
"size",
"for",
"the",
"piecewise",
"-",
"constant",
"quantum",
"simulation",
"algorithm",
")",
"."
] | [
"\"\"\"\n Set the arbitrary wave generator's (AWG) sampling time interval (also stands for the step size for\n the piecewise-constant quantum simulation algorithm).\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "float",
"docstring": null,
"docstring_tokens... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | appendWave | null | def appendWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, waves: Union[QWaveform, List[QWaveform]] = None,
strength: Union[int, float] = 1.0, freq: Optional[Union[int, float]] = None,
... |
This method appends control terms and waveforms to a QJob object. Unlike `addWave()`, this function will append
the waveform in the end of the existing waveforms, hence ignore the `t0` parameter of rhe `QWaveform` object.
:param operators: wave operator
:param onSubSys: what subsystem ... | This method appends control terms and waveforms to a QJob object. | [
"This",
"method",
"appends",
"control",
"terms",
"and",
"waveforms",
"to",
"a",
"QJob",
"object",
"."
] | def appendWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, waves: Union[QWaveform, List[QWaveform]] = None,
strength: Union[int, float] = 1.0, freq: Optional[Union[int, float]] = None,
... | [
"def",
"appendWave",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",... | This method appends control terms and waveforms to a QJob object. | [
"This",
"method",
"appends",
"control",
"terms",
"and",
"waveforms",
"to",
"a",
"QJob",
"object",
"."
] | [
"\"\"\"\n This method appends control terms and waveforms to a QJob object. Unlike `addWave()`, this function will append\n the waveform in the end of the existing waveforms, hence ignore the `t0` parameter of rhe `QWaveform` object.\n\n :param operators: wave operator\n :param onSubSys:... | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "waves",
"type": "Union[QWaveform, List[QWaveform]]"
},
{
"para... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | addWave | None | def addWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, waves: Union[QWaveform, List[QWaveform]] = None,
t0: Union[int, float] = None, strength: Union[int, float] = 1.0,
freq: Optional[Union[... |
This method adds control terms and waveforms to a QJob object. Users can specify the operators(QOperator object)
, subsystem's indexes, wave information (QWaveform object), wave strength, wave frequency, wave phase. Moreover,
the users can specify a tag and flag for identifying the purposes of ... | This method adds control terms and waveforms to a QJob object. Users can specify the operators(QOperator object)
, subsystem's indexes, wave information (QWaveform object), wave strength, wave frequency, wave phase. Moreover,
the users can specify a tag and flag for identifying the purposes of the wave. | [
"This",
"method",
"adds",
"control",
"terms",
"and",
"waveforms",
"to",
"a",
"QJob",
"object",
".",
"Users",
"can",
"specify",
"the",
"operators",
"(",
"QOperator",
"object",
")",
"subsystem",
"'",
"s",
"indexes",
"wave",
"information",
"(",
"QWaveform",
"ob... | def addWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, waves: Union[QWaveform, List[QWaveform]] = None,
t0: Union[int, float] = None, strength: Union[int, float] = 1.0,
freq: Optional[Union[... | [
"def",
"addWave",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",
... | This method adds control terms and waveforms to a QJob object. | [
"This",
"method",
"adds",
"control",
"terms",
"and",
"waveforms",
"to",
"a",
"QJob",
"object",
"."
] | [
"\"\"\"\n This method adds control terms and waveforms to a QJob object. Users can specify the operators(QOperator object)\n , subsystem's indexes, wave information (QWaveform object), wave strength, wave frequency, wave phase. Moreover,\n the users can specify a tag and flag for identifying th... | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "waves",
"type": "Union[QWaveform, List[QWaveform]]"
},
{
"para... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | _getFlagAndWaveContainer | <not_specific> | def _getFlagAndWaveContainer(_wave):
""" Return Flag or wave container. """
_realFlag = 0
if flag is not None:
_realFlag = flag
elif _wave.flag is not None:
_realFlag = _wave.flag
if (_realFlag & QWAVEFORM_FLAG_DO_NOT_CLEAR) and... | Return Flag or wave container. | Return Flag or wave container. | [
"Return",
"Flag",
"or",
"wave",
"container",
"."
] | def _getFlagAndWaveContainer(_wave):
_realFlag = 0
if flag is not None:
_realFlag = flag
elif _wave.flag is not None:
_realFlag = _wave.flag
if (_realFlag & QWAVEFORM_FLAG_DO_NOT_CLEAR) and self.parent is None:
raise Error.A... | [
"def",
"_getFlagAndWaveContainer",
"(",
"_wave",
")",
":",
"_realFlag",
"=",
"0",
"if",
"flag",
"is",
"not",
"None",
":",
"_realFlag",
"=",
"flag",
"elif",
"_wave",
".",
"flag",
"is",
"not",
"None",
":",
"_realFlag",
"=",
"_wave",
".",
"flag",
"if",
"(... | Return Flag or wave container. | [
"Return",
"Flag",
"or",
"wave",
"container",
"."
] | [
"\"\"\" Return Flag or wave container. \"\"\""
] | [
{
"param": "_wave",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "_wave",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | addWaveRot | None | def addWaveRot(self, onSubSys: int, waves: Union[QWaveform, List[QWaveform]], t0: Union[int, float] = None,
detuning: Union[int, float] = 0.0, phase: Union[int, float] = 0.0, tag: str = None) -> None:
"""
Add the control terms for the two-qubit cross-resonance effect in
the ro... |
Add the control terms for the two-qubit cross-resonance effect in
the rotating frame with the frequency of the diagonal elements of drift term.
:param onSubSys: what subsystem the wave is acting upon
:param waves: a QWaveform object
:param t0: start time
:param detuning... | Add the control terms for the two-qubit cross-resonance effect in
the rotating frame with the frequency of the diagonal elements of drift term. | [
"Add",
"the",
"control",
"terms",
"for",
"the",
"two",
"-",
"qubit",
"cross",
"-",
"resonance",
"effect",
"in",
"the",
"rotating",
"frame",
"with",
"the",
"frequency",
"of",
"the",
"diagonal",
"elements",
"of",
"drift",
"term",
"."
] | def addWaveRot(self, onSubSys: int, waves: Union[QWaveform, List[QWaveform]], t0: Union[int, float] = None,
detuning: Union[int, float] = 0.0, phase: Union[int, float] = 0.0, tag: str = None) -> None:
levelList = []
if isinstance(self.sysLevel, list):
levelList = self.sysL... | [
"def",
"addWaveRot",
"(",
"self",
",",
"onSubSys",
":",
"int",
",",
"waves",
":",
"Union",
"[",
"QWaveform",
",",
"List",
"[",
"QWaveform",
"]",
"]",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"None",
",",
"detuning",
":",
"Union"... | Add the control terms for the two-qubit cross-resonance effect in
the rotating frame with the frequency of the diagonal elements of drift term. | [
"Add",
"the",
"control",
"terms",
"for",
"the",
"two",
"-",
"qubit",
"cross",
"-",
"resonance",
"effect",
"in",
"the",
"rotating",
"frame",
"with",
"the",
"frequency",
"of",
"the",
"diagonal",
"elements",
"of",
"drift",
"term",
"."
] | [
"\"\"\"\n Add the control terms for the two-qubit cross-resonance effect in\n the rotating frame with the frequency of the diagonal elements of drift term.\n\n :param onSubSys: what subsystem the wave is acting upon\n :param waves: a QWaveform object\n :param t0: start time\n ... | [
{
"param": "self",
"type": null
},
{
"param": "onSubSys",
"type": "int"
},
{
"param": "waves",
"type": "Union[QWaveform, List[QWaveform]]"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "detuning",
"type": "Union[int, float]"
},
{
"param... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | addOperators | str | def addOperators(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]],
onSubSys: Union[int, List[int]], name: str = None, flagDoNotClear: bool = False) -> str:
"""
Add control terms onto the specified subsystem.
:param operators: QOperator object(s)
... |
Add control terms onto the specified subsystem.
:param operators: QOperator object(s)
:param onSubSys: what subsystem the wave is acting upon
:param name: user-defined operator name
:param flagDoNotClear: whether this operator will be cleared
| Add control terms onto the specified subsystem. | [
"Add",
"control",
"terms",
"onto",
"the",
"specified",
"subsystem",
"."
] | def addOperators(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]],
onSubSys: Union[int, List[int]], name: str = None, flagDoNotClear: bool = False) -> str:
_operators = formatOperatorInput(operators, onSubSys, self.sysLevel)
if _operators is not None and ... | [
"def",
"addOperators",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]"... | Add control terms onto the specified subsystem. | [
"Add",
"control",
"terms",
"onto",
"the",
"specified",
"subsystem",
"."
] | [
"\"\"\"\n Add control terms onto the specified subsystem.\n\n :param operators: QOperator object(s)\n :param onSubSys: what subsystem the wave is acting upon\n :param name: user-defined operator name\n :param flagDoNotClear: whether this operator will be cleared\n \"\"\"",
... | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "name",
"type": "str"
},
{
"param": "flagDoNotClear",
"type... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Cal... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | appendJob | None | def appendJob(self, obj: Any, t0: float = None) -> None:
"""
Append objects to the QJob object.
When timeShift is None, all waves appended will be started from the end of the current waves.
:param obj: object to be added
:param t0: start time
:return: None
"""
... |
Append objects to the QJob object.
When timeShift is None, all waves appended will be started from the end of the current waves.
:param obj: object to be added
:param t0: start time
:return: None
| Append objects to the QJob object.
When timeShift is None, all waves appended will be started from the end of the current waves. | [
"Append",
"objects",
"to",
"the",
"QJob",
"object",
".",
"When",
"timeShift",
"is",
"None",
"all",
"waves",
"appended",
"will",
"be",
"started",
"from",
"the",
"end",
"of",
"the",
"current",
"waves",
"."
] | def appendJob(self, obj: Any, t0: float = None) -> None:
if isinstance(obj, QJob):
if obj.sysLevel != self.sysLevel:
raise Error.ArgumentError("sysLevel does not match!")
if obj.subSysNum != self.subSysNum:
raise Error.ArgumentError("subSysNum does not mat... | [
"def",
"appendJob",
"(",
"self",
",",
"obj",
":",
"Any",
",",
"t0",
":",
"float",
"=",
"None",
")",
"->",
"None",
":",
"if",
"isinstance",
"(",
"obj",
",",
"QJob",
")",
":",
"if",
"obj",
".",
"sysLevel",
"!=",
"self",
".",
"sysLevel",
":",
"raise... | Append objects to the QJob object. | [
"Append",
"objects",
"to",
"the",
"QJob",
"object",
"."
] | [
"\"\"\"\n Append objects to the QJob object.\n When timeShift is None, all waves appended will be started from the end of the current waves.\n\n :param obj: object to be added\n :param t0: start time\n :return: None\n \"\"\"",
"# When the object is a QJob.",
"# Start ad... | [
{
"param": "self",
"type": null
},
{
"param": "obj",
"type": "Any"
},
{
"param": "t0",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | clearWaves | None | def clearWaves(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None,
tag: str = None) -> None:
"""
Remove all waveforms in the specified control terms.
... |
Remove all waveforms in the specified control terms.
If no names are given, remove all waveforms in all control terms.
:param operators: the operator of the wave
:param onSubSys: the subsystem of the wave
:param names: the name of control term
:param tag: the tag of the... | Remove all waveforms in the specified control terms.
If no names are given, remove all waveforms in all control terms. | [
"Remove",
"all",
"waveforms",
"in",
"the",
"specified",
"control",
"terms",
".",
"If",
"no",
"names",
"are",
"given",
"remove",
"all",
"waveforms",
"in",
"all",
"control",
"terms",
"."
] | def clearWaves(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None,
tag: str = None) -> None:
if names is not None:
opKey = names
elif operators ... | [
"def",
"clearWaves",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",... | Remove all waveforms in the specified control terms. | [
"Remove",
"all",
"waveforms",
"in",
"the",
"specified",
"control",
"terms",
"."
] | [
"\"\"\"\n Remove all waveforms in the specified control terms.\n If no names are given, remove all waveforms in all control terms.\n\n :param operators: the operator of the wave\n :param onSubSys: the subsystem of the wave\n :param names: the name of control term\n :param t... | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "names",
"type": "Union[str, List[str]]"
},
{
"param": "tag",
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | searchWave | <not_specific> | def searchWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None, tag: str = None):
"""
Search waves by different methods.
:param operators: search by operator
... |
Search waves by different methods.
:param operators: search by operator
:param onSubSys: search by subsystem
:param names: search by name
:param tag: search by tag
| Search waves by different methods. | [
"Search",
"waves",
"by",
"different",
"methods",
"."
] | def searchWave(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None, tag: str = None):
return self.searchWaveTool(self._waves, self._subSysNum, self._sysLevel, operators, onSubSys, name... | [
"def",
"searchWave",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",... | Search waves by different methods. | [
"Search",
"waves",
"by",
"different",
"methods",
"."
] | [
"\"\"\"\n Search waves by different methods.\n\n :param operators: search by operator\n :param onSubSys: search by subsystem\n :param names: search by name\n :param tag: search by tag\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "names",
"type": "Union[str, List[str]]"
},
{
"param": "tag",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Cal... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | searchWaveTool | Dict[str, List[QWaveform]] | def searchWaveTool(container: Dict[str, List[QWaveform]], subSysNum: int, sysLevel: Union[int, List[int]],
operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None,
... |
Search waves by different methods.
:param container: input dictionary
:param subSysNum: subsystem number
:param sysLevel: the system levels
:param operators: search by operator
:param onSubSys: search by subsystem
:param names: search by name
:param tag:... | Search waves by different methods. | [
"Search",
"waves",
"by",
"different",
"methods",
"."
] | def searchWaveTool(container: Dict[str, List[QWaveform]], subSysNum: int, sysLevel: Union[int, List[int]],
operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, names: Union[str, List[str]] = None,
... | [
"def",
"searchWaveTool",
"(",
"container",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"QWaveform",
"]",
"]",
",",
"subSysNum",
":",
"int",
",",
"sysLevel",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
",",
"operators",
":",
"Union",
... | Search waves by different methods. | [
"Search",
"waves",
"by",
"different",
"methods",
"."
] | [
"\"\"\"\n Search waves by different methods.\n\n :param container: input dictionary\n :param subSysNum: subsystem number\n :param sysLevel: the system levels\n :param operators: search by operator\n :param onSubSys: search by subsystem\n :param names: search by name\... | [
{
"param": "container",
"type": "Dict[str, List[QWaveform]]"
},
{
"param": "subSysNum",
"type": "int"
},
{
"param": "sysLevel",
"type": "Union[int, List[int]]"
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"p... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "Dict[str, List[QWaveform]]",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "subSysNum",
"type": "i... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | _searchWaveByNames | null | def _searchWaveByNames(_returnDict, _name):
""" Search Waves by name and tag """
if _name in container.keys():
if tag is None:
_returnDict[_name] = container[_name]
else:
_returnDict[_name] = []
... | Search Waves by name and tag | Search Waves by name and tag | [
"Search",
"Waves",
"by",
"name",
"and",
"tag"
] | def _searchWaveByNames(_returnDict, _name):
if _name in container.keys():
if tag is None:
_returnDict[_name] = container[_name]
else:
_returnDict[_name] = []
for _wave in container[_name]:
... | [
"def",
"_searchWaveByNames",
"(",
"_returnDict",
",",
"_name",
")",
":",
"if",
"_name",
"in",
"container",
".",
"keys",
"(",
")",
":",
"if",
"tag",
"is",
"None",
":",
"_returnDict",
"[",
"_name",
"]",
"=",
"container",
"[",
"_name",
"]",
"else",
":",
... | Search Waves by name and tag | [
"Search",
"Waves",
"by",
"name",
"and",
"tag"
] | [
"\"\"\" Search Waves by name and tag \"\"\""
] | [
{
"param": "_returnDict",
"type": null
},
{
"param": "_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "_returnDict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_name",
"type": null,
"docstring": null,
"docstring_to... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | plot | None | def plot(self, names: Union[str, List[str]] = None, tag: str = None, xUnit: str = 'ns', yUnit: str = 'Amp (a.u.)',
color: Union[str, List[str]] = None, dark: bool = False) -> None:
"""
Print the waveforms of the control terms listed in ``names``.
:param names: the name or name list... |
Print the waveforms of the control terms listed in ``names``.
:param names: the name or name list of the control term
:param tag: the tag of the waveforms to be plotted.
:param xUnit: the unit of the x axis
:param yUnit: the unit of the y axis
:param color: None or list... | Print the waveforms of the control terms listed in ``names``. | [
"Print",
"the",
"waveforms",
"of",
"the",
"control",
"terms",
"listed",
"in",
"`",
"`",
"names",
"`",
"`",
"."
] | def plot(self, names: Union[str, List[str]] = None, tag: str = None, xUnit: str = 'ns', yUnit: str = 'Amp (a.u.)',
color: Union[str, List[str]] = None, dark: bool = False) -> None:
self.computeMaxTime()
maxNs = self.endTime
if names is None:
nameList = []
nam... | [
"def",
"plot",
"(",
"self",
",",
"names",
":",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
"=",
"None",
",",
"tag",
":",
"str",
"=",
"None",
",",
"xUnit",
":",
"str",
"=",
"'ns'",
",",
"yUnit",
":",
"str",
"=",
"'Amp (a.u.)'",
",",
... | Print the waveforms of the control terms listed in ``names``. | [
"Print",
"the",
"waveforms",
"of",
"the",
"control",
"terms",
"listed",
"in",
"`",
"`",
"names",
"`",
"`",
"."
] | [
"\"\"\"\n Print the waveforms of the control terms listed in ``names``.\n\n :param names: the name or name list of the control term\n :param tag: the tag of the waveforms to be plotted.\n :param xUnit: the unit of the x axis\n :param yUnit: the unit of the y axis\n :param c... | [
{
"param": "self",
"type": null
},
{
"param": "names",
"type": "Union[str, List[str]]"
},
{
"param": "tag",
"type": "str"
},
{
"param": "xUnit",
"type": "str"
},
{
"param": "yUnit",
"type": "str"
},
{
"param": "color",
"type": "Union[str, List[str]... | {
"returns": [
{
"docstring": "None\nIn Quanlse, users can specify colors from.\n\n\n\nThe colors will repeat if there are more pulses than colors.",
"docstring_tokens": [
"None",
"In",
"Quanlse",
"users",
"can",
"specify",
"colors",
"fro... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | plotIon | None | def plotIon(self, names: Union[str, List[str]] = None, xUnit: str = r'$\mu$s', yUnit: str = 'Amp (a.u.)',
color: Union[str, List[str]] = None, dark: bool = False) -> None:
"""
Print the waveforms of the control terms listed in ``names``.
:param names: the name or name list of th... |
Print the waveforms of the control terms listed in ``names``.
:param names: the name or name list of the control term
:param xUnit: the unit of the x axis
:param yUnit: the unit of the y axis
:param color: None or list of colors
:param dark: the plot can be switched to ... | Print the waveforms of the control terms listed in ``names``. | [
"Print",
"the",
"waveforms",
"of",
"the",
"control",
"terms",
"listed",
"in",
"`",
"`",
"names",
"`",
"`",
"."
] | def plotIon(self, names: Union[str, List[str]] = None, xUnit: str = r'$\mu$s', yUnit: str = 'Amp (a.u.)',
color: Union[str, List[str]] = None, dark: bool = False) -> None:
self.computeMaxTime()
maxNs = self.endTime
if names is None:
names = list(self.waves.keys())
... | [
"def",
"plotIon",
"(",
"self",
",",
"names",
":",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
"=",
"None",
",",
"xUnit",
":",
"str",
"=",
"r'$\\mu$s'",
",",
"yUnit",
":",
"str",
"=",
"'Amp (a.u.)'",
",",
"color",
":",
"Union",
"[",
"s... | Print the waveforms of the control terms listed in ``names``. | [
"Print",
"the",
"waveforms",
"of",
"the",
"control",
"terms",
"listed",
"in",
"`",
"`",
"names",
"`",
"`",
"."
] | [
"\"\"\"\n Print the waveforms of the control terms listed in ``names``.\n\n :param names: the name or name list of the control term\n :param xUnit: the unit of the x axis\n :param yUnit: the unit of the y axis\n :param color: None or list of colors\n :param dark: the plot c... | [
{
"param": "self",
"type": null
},
{
"param": "names",
"type": "Union[str, List[str]]"
},
{
"param": "xUnit",
"type": "str"
},
{
"param": "yUnit",
"type": "str"
},
{
"param": "color",
"type": "Union[str, List[str]]"
},
{
"param": "dark",
"type": "b... | {
"returns": [
{
"docstring": "None\nIn Quanlse, users can specify colors from.\n\n\n\nThe colors will repeat if there are more pulses than colors.",
"docstring_tokens": [
"None",
"In",
"Quanlse",
"users",
"can",
"specify",
"colors",
"fro... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | keys | KeysView | def keys(self) -> KeysView:
"""
Return all the keys of waves.
:return: returned keys
"""
return self._waves.keys() |
Return all the keys of waves.
:return: returned keys
| Return all the keys of waves. | [
"Return",
"all",
"the",
"keys",
"of",
"waves",
"."
] | def keys(self) -> KeysView:
return self._waves.keys() | [
"def",
"keys",
"(",
"self",
")",
"->",
"KeysView",
":",
"return",
"self",
".",
"_waves",
".",
"keys",
"(",
")"
] | Return all the keys of waves. | [
"Return",
"all",
"the",
"keys",
"of",
"waves",
"."
] | [
"\"\"\"\n Return all the keys of waves.\n\n :return: returned keys\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | computeMaxTime | Tuple[float, float] | def computeMaxTime(self) -> Tuple[float, float]:
"""
Compute the time duration of the whole circuit according to the waves added.
:return: returned total time duration
"""
# Find the longest time
maxTime = 0.0
containers = [self._waves]
if self.parent is ... |
Compute the time duration of the whole circuit according to the waves added.
:return: returned total time duration
| Compute the time duration of the whole circuit according to the waves added. | [
"Compute",
"the",
"time",
"duration",
"of",
"the",
"whole",
"circuit",
"according",
"to",
"the",
"waves",
"added",
"."
] | def computeMaxTime(self) -> Tuple[float, float]:
maxTime = 0.0
containers = [self._waves]
if self.parent is not None:
containers.append(self.parent.doNotClearFlagWaves)
for container in containers:
for key in container.keys():
waves = container[key... | [
"def",
"computeMaxTime",
"(",
"self",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
"]",
":",
"maxTime",
"=",
"0.0",
"containers",
"=",
"[",
"self",
".",
"_waves",
"]",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"containers",
".",
"appe... | Compute the time duration of the whole circuit according to the waves added. | [
"Compute",
"the",
"time",
"duration",
"of",
"the",
"whole",
"circuit",
"according",
"to",
"the",
"waves",
"added",
"."
] | [
"\"\"\"\n Compute the time duration of the whole circuit according to the waves added.\n\n :return: returned total time duration\n \"\"\"",
"# Find the longest time"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "returned total time duration",
"docstring_tokens": [
"returned",
"total",
"time",
"duration"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | buildWaveCache | Dict[str, int] | def buildWaveCache(self, tag: str = None, forPlot: bool = False) -> Dict[str, int]:
"""
Generate the pulse sequences for further usage.
:param tag: wave tag
:param forPlot: whether plot
:return: returned pulse sequences
"""
# Generate the pulse sequences for all ... |
Generate the pulse sequences for further usage.
:param tag: wave tag
:param forPlot: whether plot
:return: returned pulse sequences
| Generate the pulse sequences for further usage. | [
"Generate",
"the",
"pulse",
"sequences",
"for",
"further",
"usage",
"."
] | def buildWaveCache(self, tag: str = None, forPlot: bool = False) -> Dict[str, int]:
waveCounting = {}
self.clearCache()
allKeys = list(self.waves.keys())
if self.parent is not None:
allKeys.extend(self.parent.doNotClearFlagWaves.keys())
for key in allKeys:
... | [
"def",
"buildWaveCache",
"(",
"self",
",",
"tag",
":",
"str",
"=",
"None",
",",
"forPlot",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
"[",
"str",
",",
"int",
"]",
":",
"waveCounting",
"=",
"{",
"}",
"self",
".",
"clearCache",
"(",
")",
"allKeys"... | Generate the pulse sequences for further usage. | [
"Generate",
"the",
"pulse",
"sequences",
"for",
"further",
"usage",
"."
] | [
"\"\"\"\n Generate the pulse sequences for further usage.\n\n :param tag: wave tag\n :param forPlot: whether plot\n :return: returned pulse sequences\n \"\"\"",
"# Generate the pulse sequences for all of the control terms."
] | [
{
"param": "self",
"type": null
},
{
"param": "tag",
"type": "str"
},
{
"param": "forPlot",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "returned pulse sequences",
"docstring_tokens": [
"returned",
"pulse",
"sequences"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | generatePulseSequence | List[Union[float, complex]] | def generatePulseSequence(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, name: str = None, tag: str = None,
forPlot: bool = False, counting: Dict[str, int] = None,
... |
Generate the piecewise-constant pulse sequence according to the waveform configurations during
the whole evolution time.
:param operators: the list of operators
:param onSubSys: the list of subsystems
:param name: the key of control term
:param tag: the tag of the wavef... | Generate the piecewise-constant pulse sequence according to the waveform configurations during
the whole evolution time. | [
"Generate",
"the",
"piecewise",
"-",
"constant",
"pulse",
"sequence",
"according",
"to",
"the",
"waveform",
"configurations",
"during",
"the",
"whole",
"evolution",
"time",
"."
] | def generatePulseSequence(self, operators: Union[QOperator, Callable, List[QOperator], List[Callable]] = None,
onSubSys: Union[int, List[int]] = None, name: str = None, tag: str = None,
forPlot: bool = False, counting: Dict[str, int] = None,
... | [
"def",
"generatePulseSequence",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"Li... | Generate the piecewise-constant pulse sequence according to the waveform configurations during
the whole evolution time. | [
"Generate",
"the",
"piecewise",
"-",
"constant",
"pulse",
"sequence",
"according",
"to",
"the",
"waveform",
"configurations",
"during",
"the",
"whole",
"evolution",
"time",
"."
] | [
"\"\"\"\n Generate the piecewise-constant pulse sequence according to the waveform configurations during\n the whole evolution time.\n\n :param operators: the list of operators\n :param onSubSys: the list of subsystems\n :param name: the key of control term\n :param tag: th... | [
{
"param": "self",
"type": null
},
{
"param": "operators",
"type": "Union[QOperator, Callable, List[QOperator], List[Callable]]"
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
},
{
"param": "name",
"type": "str"
},
{
"param": "tag",
"type": "str"
... | {
"returns": [
{
"docstring": "the list of pulse sequence",
"docstring_tokens": [
"the",
"list",
"of",
"pulse",
"sequence"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | waveFunctionsToSequences | 'QJob' | def waveFunctionsToSequences(self, maxEndTime: float = None) -> 'QJob':
"""
Convert all functions included QWaveform objects into a serializable sequence.
:param maxEndTime: maximum ending time
:return: returned QJob object
"""
obj = copy.deepcopy(self)
obj.clear... |
Convert all functions included QWaveform objects into a serializable sequence.
:param maxEndTime: maximum ending time
:return: returned QJob object
| Convert all functions included QWaveform objects into a serializable sequence. | [
"Convert",
"all",
"functions",
"included",
"QWaveform",
"objects",
"into",
"a",
"serializable",
"sequence",
"."
] | def waveFunctionsToSequences(self, maxEndTime: float = None) -> 'QJob':
obj = copy.deepcopy(self)
obj.clearWaves()
for waveKey in self.waves.keys():
qOp = self.ctrlOperators[waveKey]
if isinstance(qOp, list):
onSubSys = []
for op in qOp:
... | [
"def",
"waveFunctionsToSequences",
"(",
"self",
",",
"maxEndTime",
":",
"float",
"=",
"None",
")",
"->",
"'QJob'",
":",
"obj",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"obj",
".",
"clearWaves",
"(",
")",
"for",
"waveKey",
"in",
"self",
".",
"wav... | Convert all functions included QWaveform objects into a serializable sequence. | [
"Convert",
"all",
"functions",
"included",
"QWaveform",
"objects",
"into",
"a",
"serializable",
"sequence",
"."
] | [
"\"\"\"\n Convert all functions included QWaveform objects into a serializable sequence.\n\n :param maxEndTime: maximum ending time\n :return: returned QJob object\n \"\"\"",
"# Add QOperator",
"# Add QWaveform"
] | [
{
"param": "self",
"type": null
},
{
"param": "maxEndTime",
"type": "float"
}
] | {
"returns": [
{
"docstring": "returned QJob object",
"docstring_tokens": [
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens":... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | copy | 'QJob' | def copy(self) -> 'QJob':
"""
Return the copy of the object
"""
return copy.deepcopy(self) |
Return the copy of the object
| Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | def copy(self) -> 'QJob':
return copy.deepcopy(self) | [
"def",
"copy",
"(",
"self",
")",
"->",
"'QJob'",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | [
"\"\"\"\n Return the copy of the object\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | load | 'QJob' | def load(base64Str: str) -> 'QJob':
"""
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: a QJob object
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QJob
# For compatib... |
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: a QJob object
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QJob':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
for opKey in obj.waves.keys():
for wave in obj.waves[opKey]:
if not hasattr(wave, "freq"):
wave.freq = wave.omega if hasattr(wave, "ome... | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QJob'",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64Str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pickle",
".",
"loads",
"(",
"byteStr",
")",
"for",
"opKey",
"in",
"obj",
... | Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | [
"\"\"\"\n Create object from base64 encoded string.\n\n :param base64Str: a base64 encoded string\n :return: a QJob object\n \"\"\"",
"# type: QJob",
"# For compatibility with previous versions"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [
{
"docstring": "a QJob object",
"docstring_tokens": [
"a",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": "a base64 encoded string",
"docst... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | sysLevel | null | def sysLevel(self, value: Union[int, List[int]]):
"""
Set the level of the subsystems.
:param value: the number of the subsystems.
"""
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sysSize must be an integer or a list!")
... |
Set the level of the subsystems.
:param value: the number of the subsystems.
| Set the level of the subsystems. | [
"Set",
"the",
"level",
"of",
"the",
"subsystems",
"."
] | def sysLevel(self, value: Union[int, List[int]]):
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sysSize must be an integer or a list!")
if isinstance(value, list) and min(value) < 2:
raise Error.ArgumentError("All items in sysSize must ... | [
"def",
"sysLevel",
"(",
"self",
",",
"value",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"int",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"raise... | Set the level of the subsystems. | [
"Set",
"the",
"level",
"of",
"the",
"subsystems",
"."
] | [
"\"\"\"\n Set the level of the subsystems.\n\n :param value: the number of the subsystems.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Union[int, List[int]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Union[int, List[int]]",
"docstring": "the number o... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | createJob | QJob | def createJob(self) -> QJob:
"""
Return a instance of QJob which has same system properties
:return: returned QJob object
"""
newJob = QJob(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJob.LO = self.LO
return newJob |
Return a instance of QJob which has same system properties
:return: returned QJob object
| Return a instance of QJob which has same system properties | [
"Return",
"a",
"instance",
"of",
"QJob",
"which",
"has",
"same",
"system",
"properties"
] | def createJob(self) -> QJob:
newJob = QJob(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJob.LO = self.LO
return newJob | [
"def",
"createJob",
"(",
"self",
")",
"->",
"QJob",
":",
"newJob",
"=",
"QJob",
"(",
"subSysNum",
"=",
"self",
".",
"subSysNum",
",",
"sysLevel",
"=",
"self",
".",
"sysLevel",
",",
"dt",
"=",
"self",
".",
"dt",
")",
"newJob",
".",
"LO",
"=",
"self"... | Return a instance of QJob which has same system properties | [
"Return",
"a",
"instance",
"of",
"QJob",
"which",
"has",
"same",
"system",
"properties"
] | [
"\"\"\"\n Return a instance of QJob which has same system properties\n\n :return: returned QJob object\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "returned QJob object",
"docstring_tokens": [
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens":... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | clone | 'QJobList' | def clone(self) -> 'QJobList':
"""
Return the copy of the object
"""
return copy.deepcopy(self) |
Return the copy of the object
| Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | def clone(self) -> 'QJobList':
return copy.deepcopy(self) | [
"def",
"clone",
"(",
"self",
")",
"->",
"'QJobList'",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | [
"\"\"\"\n Return the copy of the object\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | load | 'QJobList' | def load(base64Str: str) -> 'QJobList':
"""
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: a QJobList object
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QJobList
# F... |
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: a QJobList object
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QJobList':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
for job in obj.jobs:
for opKey in job.waves.keys():
for wave in job.waves[opKey]:
if not hasattr(wave, "freq"):
... | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QJobList'",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64Str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pickle",
".",
"loads",
"(",
"byteStr",
")",
"for",
"job",
"in",
"obj",... | Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | [
"\"\"\"\n Create object from base64 encoded string.\n\n :param base64Str: a base64 encoded string\n :return: a QJobList object\n \"\"\"",
"# type: QJobList",
"# For compatibility with previous versions"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [
{
"docstring": "a QJobList object",
"docstring_tokens": [
"a",
"QJobList",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": "a base64 encoded string",
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | clone | 'QResult' | def clone(self) -> 'QResult':
"""
Return the copy of the object
"""
return copy.deepcopy(self) |
Return the copy of the object
| Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | def clone(self) -> 'QResult':
return copy.deepcopy(self) | [
"def",
"clone",
"(",
"self",
")",
"->",
"'QResult'",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | Return the copy of the object | [
"Return",
"the",
"copy",
"of",
"the",
"object"
] | [
"\"\"\"\n Return the copy of the object\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | load | 'QResult' | def load(base64Str: str) -> 'QResult':
"""
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QResult
return obj |
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QResult':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
return obj | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QResult'",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64Str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pickle",
".",
"loads",
"(",
"byteStr",
")",
"return",
"obj"
] | Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | [
"\"\"\"\n Create object from base64 encoded string.\n\n :param base64Str: a base64 encoded string\n \"\"\"",
"# type: QResult"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": "a base64 encoded string",
"docstring_tokens": [
"a",
"base64",
"encoded",
"string"
],
"default": null,
"is_optional": null
}
],
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | gaussian | QWaveform | def gaussian(t: Union[int, float], a: float, tau: float, sigma: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of Gaussian wave.
:param t: pulse duration
:param a: pulse amplitude
:param tau:... |
Return a QWaveform object of Gaussian wave.
:param t: pulse duration
:param a: pulse amplitude
:param tau: pulse center position
:param sigma: pulse standard deviation
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse execution)
:para... | Return a QWaveform object of Gaussian wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"Gaussian",
"wave",
"."
] | def gaussian(t: Union[int, float], a: float, tau: float, sigma: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, args):
_a, _tau, _sigma = args
if _sigma == 0:
return 0
pulse = _a * exp(- ((_... | [
"def",
"gaussian",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"a",
":",
"float",
",",
"tau",
":",
"float",
",",
"sigma",
":",
"float",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"floa... | Return a QWaveform object of Gaussian wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"Gaussian",
"wave",
"."
] | [
"\"\"\"\n Return a QWaveform object of Gaussian wave.\n\n :param t: pulse duration\n :param a: pulse amplitude\n :param tau: pulse center position\n :param sigma: pulse standard deviation\n :param t0: start time\n :param freq: pulse frequency shift (will not accumulate during the entire pulse e... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "a",
"type": "float"
},
{
"param": "tau",
"type": "float"
},
{
"param": "sigma",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
... | {
"returns": [
{
"docstring": "returned Gaussian QWaveform",
"docstring_tokens": [
"returned",
"Gaussian",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "Union[int, float]",
"docstring": null,... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | square | QWaveform | def square(t: Union[int, float], a: float, t0: Union[int, float] = 0., freq: float = None,
phase: float = None, phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of square wave.
:param t: pulse duration
:param a: pulse amplitude
:param t0: start time
:param freq: puls... |
Return a QWaveform object of square wave.
:param t: pulse duration
:param a: pulse amplitude
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse execution)
:param phase: pulse phase shift (will accumulate during the entire pulse execution)
... | Return a QWaveform object of square wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"square",
"wave",
"."
] | def square(t: Union[int, float], a: float, t0: Union[int, float] = 0., freq: float = None,
phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, args):
return args
wave = QWaveform(f=func, t0=t0, t=t, args=a, freq=freq, phase=phase, phase0=phase0)
wave.name = "square"
... | [
"def",
"square",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"a",
":",
"float",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"float",
"=",
"None",
",",
"phase",
":",
"float",
"=",
"None"... | Return a QWaveform object of square wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"square",
"wave",
"."
] | [
"\"\"\"\n Return a QWaveform object of square wave.\n\n :param t: pulse duration\n :param a: pulse amplitude\n :param t0: start time\n :param freq: pulse frequency shift (will not accumulate during the entire pulse execution)\n :param phase: pulse phase shift (will accumulate during the entire pul... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "a",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
{
"param": "phase",
"type": "float"
},
{
"param": "phase0",
"type": "float"
}
... | {
"returns": [
{
"docstring": "returned square QWaveform",
"docstring_tokens": [
"returned",
"square",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "Union[int, float]",
"docstring": null,
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | delay | QWaveform | def delay(t: Union[int, float], t0: Union[int, float] = 0., freq: float = None,
phase: float = None, phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of delay.
:param t: pulse duration
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during th... |
Return a QWaveform object of delay.
:param t: pulse duration
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse execution)
:param phase: pulse phase shift (will accumulate during the entire pulse execution)
:param phase0: pulse phase shift (wi... | Return a QWaveform object of delay. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"delay",
"."
] | def delay(t: Union[int, float], t0: Union[int, float] = 0., freq: float = None,
phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, _):
return 0.
wave = QWaveform(f=func, t0=t0, t=t, args=None, freq=freq, phase=phase, phase0=phase0)
wave.name = "delay"
return wave | [
"def",
"delay",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"float",
"=",
"None",
",",
"phase",
":",
"float",
"=",
"None",
",",
"phase0",
":",
"fl... | Return a QWaveform object of delay. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"delay",
"."
] | [
"\"\"\"\n Return a QWaveform object of delay.\n\n :param t: pulse duration\n :param t0: start time\n :param freq: pulse frequency shift (will not accumulate during the entire pulse execution)\n :param phase: pulse phase shift (will accumulate during the entire pulse execution)\n :param phase0: pul... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
{
"param": "phase",
"type": "float"
},
{
"param": "phase0",
"type": "float"
}
] | {
"returns": [
{
"docstring": "returned square QWaveform",
"docstring_tokens": [
"returned",
"square",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "Union[int, float]",
"docstring": null,
... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | virtualZ | QWaveform | def virtualZ(phase: float = None, t0: Union[int, float] = 0.) -> QWaveform:
"""
Return a QWaveform object of phase shift (implement Virtual-Z gate).
:param phase: pulse phase shift (will accumulate during the entire pulse execution)
:param t0: start time
:return: returned square QWaveform
"""
... |
Return a QWaveform object of phase shift (implement Virtual-Z gate).
:param phase: pulse phase shift (will accumulate during the entire pulse execution)
:param t0: start time
:return: returned square QWaveform
| Return a QWaveform object of phase shift (implement Virtual-Z gate). | [
"Return",
"a",
"QWaveform",
"object",
"of",
"phase",
"shift",
"(",
"implement",
"Virtual",
"-",
"Z",
"gate",
")",
"."
] | def virtualZ(phase: float = None, t0: Union[int, float] = 0.) -> QWaveform:
def func(_t, _):
return 0.
wave = QWaveform(f=func, t0=t0, t=0.0, args=None, freq=0.0, phase=phase, phase0=0.0,
flag=QWAVEFORM_FLAG_PHASE_SHIFT)
wave.name = "virtualZ"
return wave | [
"def",
"virtualZ",
"(",
"phase",
":",
"float",
"=",
"None",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
")",
"->",
"QWaveform",
":",
"def",
"func",
"(",
"_t",
",",
"_",
")",
":",
"\"\"\" The constant function \"\"\"",
"return",
... | Return a QWaveform object of phase shift (implement Virtual-Z gate). | [
"Return",
"a",
"QWaveform",
"object",
"of",
"phase",
"shift",
"(",
"implement",
"Virtual",
"-",
"Z",
"gate",
")",
"."
] | [
"\"\"\"\n Return a QWaveform object of phase shift (implement Virtual-Z gate).\n\n :param phase: pulse phase shift (will accumulate during the entire pulse execution)\n :param t0: start time\n :return: returned square QWaveform\n \"\"\"",
"\"\"\" The constant function \"\"\""
] | [
{
"param": "phase",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
}
] | {
"returns": [
{
"docstring": "returned square QWaveform",
"docstring_tokens": [
"returned",
"square",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "phase",
"type": "float",
"docstring": "pulse phase shif... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | sin | QWaveform | def sin(t: Union[int, float], a: float, b: float, c: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of sin wave.
x(t) = a * sin(b * t + c)
:param t: pulse duration
:param a: sin wave amplitude
... |
Return a QWaveform object of sin wave.
x(t) = a * sin(b * t + c)
:param t: pulse duration
:param a: sin wave amplitude
:param b: 2 * pi / (sin wave period)
:param c: sin wave phase
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse exe... | Return a QWaveform object of sin wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"sin",
"wave",
"."
] | def sin(t: Union[int, float], a: float, b: float, c: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, args):
_a, _b, _c = args
return _a * math.sin(_b * _t + _c)
wave = QWaveform(f=func, t0=t0, t=t, args=(a, b, c... | [
"def",
"sin",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"a",
":",
"float",
",",
"b",
":",
"float",
",",
"c",
":",
"float",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"float",
"=",
... | Return a QWaveform object of sin wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"sin",
"wave",
"."
] | [
"\"\"\"\n Return a QWaveform object of sin wave.\n x(t) = a * sin(b * t + c)\n\n :param t: pulse duration\n :param a: sin wave amplitude\n :param b: 2 * pi / (sin wave period)\n :param c: sin wave phase\n :param t0: start time\n :param freq: pulse frequency shift (will not accumulate during ... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "a",
"type": "float"
},
{
"param": "b",
"type": "float"
},
{
"param": "c",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
{
... | {
"returns": [
{
"docstring": "returned sin QWaveform",
"docstring_tokens": [
"returned",
"sin",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "Union[int, float]",
"docstring": null,
"do... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | sequence | QWaveform | def sequence(seq: List[Union[float, complex]], t0: Union[int, float] = 0., freq: float = None, phase: float = None,
phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of pulse sequence.
:param seq: pulse sequence
:param t0: pulse start time
:param freq: pulse frequency s... |
Return a QWaveform object of pulse sequence.
:param seq: pulse sequence
:param t0: pulse start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse execution)
:param phase: pulse phase shift (will accumulate during the entire pulse execution)
:param phase0: puls... | Return a QWaveform object of pulse sequence. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"pulse",
"sequence",
"."
] | def sequence(seq: List[Union[float, complex]], t0: Union[int, float] = 0., freq: float = None, phase: float = None,
phase0: float = None) -> QWaveform:
wave = QWaveform(t0=t0, seq=seq, freq=freq, phase=phase, phase0=phase0)
wave.name = "manual_sequence"
return wave | [
"def",
"sequence",
"(",
"seq",
":",
"List",
"[",
"Union",
"[",
"float",
",",
"complex",
"]",
"]",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"float",
"=",
"None",
",",
"phase",
":",
"float",
"=",
"None"... | Return a QWaveform object of pulse sequence. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"pulse",
"sequence",
"."
] | [
"\"\"\"\n Return a QWaveform object of pulse sequence.\n\n :param seq: pulse sequence\n :param t0: pulse start time\n :param freq: pulse frequency shift (will not accumulate during the entire pulse execution)\n :param phase: pulse phase shift (will accumulate during the entire pulse execution)\n :... | [
{
"param": "seq",
"type": "List[Union[float, complex]]"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
{
"param": "phase",
"type": "float"
},
{
"param": "phase0",
"type": "float"
}
] | {
"returns": [
{
"docstring": "returned QWaveform object",
"docstring_tokens": [
"returned",
"QWaveform",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "seq",
"type": "List[Union[float, complex]]",
"docstring... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | quasiSquareErf | QWaveform | def quasiSquareErf(t: Union[int, float], a: float, l: float, r: float, sk: float = None, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
"""
Return the sample pulse with a quasi-square envelope.
:param t: pulse duration
:param ... |
Return the sample pulse with a quasi-square envelope.
:param t: pulse duration
:param a: pulse amplitude
:param l: quasiSquare wave function parameter
:param r: quasiSquare wave function parameter
:param sk: quasiSquare wave function parameter
:param t0: pulse start time
:param freq: p... | Return the sample pulse with a quasi-square envelope. | [
"Return",
"the",
"sample",
"pulse",
"with",
"a",
"quasi",
"-",
"square",
"envelope",
"."
] | def quasiSquareErf(t: Union[int, float], a: float, l: float, r: float, sk: float = None, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, args):
_a, _l, _r, _sk = args
if _sk is None:
_sk = _a * 0.3
... | [
"def",
"quasiSquareErf",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"a",
":",
"float",
",",
"l",
":",
"float",
",",
"r",
":",
"float",
",",
"sk",
":",
"float",
"=",
"None",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"... | Return the sample pulse with a quasi-square envelope. | [
"Return",
"the",
"sample",
"pulse",
"with",
"a",
"quasi",
"-",
"square",
"envelope",
"."
] | [
"\"\"\"\n Return the sample pulse with a quasi-square envelope.\n\n :param t: pulse duration\n :param a: pulse amplitude\n :param l: quasiSquare wave function parameter\n :param r: quasiSquare wave function parameter\n :param sk: quasiSquare wave function parameter\n :param t0: pulse start time... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "a",
"type": "float"
},
{
"param": "l",
"type": "float"
},
{
"param": "r",
"type": "float"
},
{
"param": "sk",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"p... | {
"returns": [
{
"docstring": "returned quasi square QWaveform object",
"docstring_tokens": [
"returned",
"quasi",
"square",
"QWaveform",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | dragY1 | QWaveform | def dragY1(t: Union[int, float], a: float, tau: float, sigma: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
"""
Return a QWaveform object of DRAG wave.
:param t: pulse duration
:param a: pulse amplitude
:param tau: pulse c... |
Return a QWaveform object of DRAG wave.
:param t: pulse duration
:param a: pulse amplitude
:param tau: pulse center position
:param sigma: pulse standard deviation
:param t0: start time
:param freq: pulse frequency shift (will not accumulate during the entire pulse execution)
:param ph... | Return a QWaveform object of DRAG wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"DRAG",
"wave",
"."
] | def dragY1(t: Union[int, float], a: float, tau: float, sigma: float, t0: Union[int, float] = 0.,
freq: float = None, phase: float = None, phase0: float = None) -> QWaveform:
def func(_t, args):
_a, _tau, _sigma = args
if sigma == 0:
return 0
pulse = - _a * (_t - _tau) ... | [
"def",
"dragY1",
"(",
"t",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"a",
":",
"float",
",",
"tau",
":",
"float",
",",
"sigma",
":",
"float",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
",",
"freq",
":",
"float"... | Return a QWaveform object of DRAG wave. | [
"Return",
"a",
"QWaveform",
"object",
"of",
"DRAG",
"wave",
"."
] | [
"\"\"\"\n Return a QWaveform object of DRAG wave.\n\n :param t: pulse duration\n :param a: pulse amplitude\n :param tau: pulse center position\n :param sigma: pulse standard deviation\n :param t0: start time\n :param freq: pulse frequency shift (will not accumulate during the entire pulse execu... | [
{
"param": "t",
"type": "Union[int, float]"
},
{
"param": "a",
"type": "float"
},
{
"param": "tau",
"type": "float"
},
{
"param": "sigma",
"type": "float"
},
{
"param": "t0",
"type": "Union[int, float]"
},
{
"param": "freq",
"type": "float"
},
... | {
"returns": [
{
"docstring": "returned QWaveform object with DRAG",
"docstring_tokens": [
"returned",
"QWaveform",
"object",
"with",
"DRAG"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "t",
"type": "Union[... |
b726fe37b23c2b6da32da885f2f45172de55b88e | baidu/Quanlse | Quanlse/QWaveform.py | [
"Apache-2.0"
] | Python | mix | <not_specific> | def mix(xWave: Optional[QWaveform], yWave: Optional[QWaveform], t0: Union[int, float] = 0.):
"""
Return the mix of two QWaveform instances.
:param xWave: the first QWaveform instances
:param yWave: the second QWaveform instances
:param t0:
:return: returned mixed QWaveform
"""
def func... |
Return the mix of two QWaveform instances.
:param xWave: the first QWaveform instances
:param yWave: the second QWaveform instances
:param t0:
:return: returned mixed QWaveform
| Return the mix of two QWaveform instances. | [
"Return",
"the",
"mix",
"of",
"two",
"QWaveform",
"instances",
"."
] | def mix(xWave: Optional[QWaveform], yWave: Optional[QWaveform], t0: Union[int, float] = 0.):
def func(_t, args):
_xWave, _yWave = args
_xVal = 0. if _xWave is None else _xWave(_t)
_yVal = 0. if _yWave is None else _yWave(_t)
amp = math.sqrt(_xVal ** 2 + _yVal ** 2)
if abs(_xV... | [
"def",
"mix",
"(",
"xWave",
":",
"Optional",
"[",
"QWaveform",
"]",
",",
"yWave",
":",
"Optional",
"[",
"QWaveform",
"]",
",",
"t0",
":",
"Union",
"[",
"int",
",",
"float",
"]",
"=",
"0.",
")",
":",
"def",
"func",
"(",
"_t",
",",
"args",
")",
"... | Return the mix of two QWaveform instances. | [
"Return",
"the",
"mix",
"of",
"two",
"QWaveform",
"instances",
"."
] | [
"\"\"\"\n Return the mix of two QWaveform instances.\n\n :param xWave: the first QWaveform instances\n :param yWave: the second QWaveform instances\n :param t0:\n :return: returned mixed QWaveform\n \"\"\"",
"\"\"\" The mix function \"\"\"",
"# Calculate amplitude",
"# Calculate phase"
] | [
{
"param": "xWave",
"type": "Optional[QWaveform]"
},
{
"param": "yWave",
"type": "Optional[QWaveform]"
},
{
"param": "t0",
"type": "Union[int, float]"
}
] | {
"returns": [
{
"docstring": "returned mixed QWaveform",
"docstring_tokens": [
"returned",
"mixed",
"QWaveform"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "xWave",
"type": "Optional[QWaveform]",
"docstring": "the ... |
b388c09c3e46f9aae97f553fe1492c9325b762a6 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorRBPulse.py | [
"Apache-2.0"
] | Python | generate1QClifford | QJob | def generate1QClifford(ham: QHam = None, cirLine: CircuitLine = None, scheduler: 'SchedulerSuperconduct' = None)\
-> QJob:
"""
Default generator for single qubit gates.
:param ham: QHam object containing the system information
:param cirLine: a CircuitLine object containing the gate information... |
Default generator for single qubit gates.
:param ham: QHam object containing the system information
:param cirLine: a CircuitLine object containing the gate information
:param scheduler: the instance of Quanlse Scheduler Superconducting
:return: returned QJob object
| Default generator for single qubit gates. | [
"Default",
"generator",
"for",
"single",
"qubit",
"gates",
"."
] | def generate1QClifford(ham: QHam = None, cirLine: CircuitLine = None, scheduler: 'SchedulerSuperconduct' = None)\
-> QJob:
subHam = ham.subSystem(cirLine.qRegIndexList)
if cirLine.data.name in ['Cinv']:
job, inf = opt1q(subHam, cirLine.data.getMatrix(), depth=6, targetInfid=0.0002)
else:
... | [
"def",
"generate1QClifford",
"(",
"ham",
":",
"QHam",
"=",
"None",
",",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerSuperconduct'",
"=",
"None",
")",
"->",
"QJob",
":",
"subHam",
"=",
"ham",
".",
"subSystem",
"(",
"cirLine... | Default generator for single qubit gates. | [
"Default",
"generator",
"for",
"single",
"qubit",
"gates",
"."
] | [
"\"\"\"\n Default generator for single qubit gates.\n\n :param ham: QHam object containing the system information\n :param cirLine: a CircuitLine object containing the gate information\n :param scheduler: the instance of Quanlse Scheduler Superconducting\n :return: returned QJob object\n \"\"\"",
... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "cirLine",
"type": "CircuitLine"
},
{
"param": "scheduler",
"type": "'SchedulerSuperconduct'"
}
] | {
"returns": [
{
"docstring": "returned QJob object",
"docstring_tokens": [
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHam",
"docstring": "QHam object containing the sy... |
b388c09c3e46f9aae97f553fe1492c9325b762a6 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorRBPulse.py | [
"Apache-2.0"
] | Python | SingleQubitCliffordPulseGenerator | SchedulerPulseGenerator | def SingleQubitCliffordPulseGenerator(ham: QHam) -> SchedulerPulseGenerator:
"""
Return a single-qubit Clifford pulse SchedulerPulseGenerator instance for the scheduler.
:param ham: a Hamiltonian object
:return: returned generator object
"""
generator = SchedulerPulseGenerator(ham)
gateList... |
Return a single-qubit Clifford pulse SchedulerPulseGenerator instance for the scheduler.
:param ham: a Hamiltonian object
:return: returned generator object
| Return a single-qubit Clifford pulse SchedulerPulseGenerator instance for the scheduler. | [
"Return",
"a",
"single",
"-",
"qubit",
"Clifford",
"pulse",
"SchedulerPulseGenerator",
"instance",
"for",
"the",
"scheduler",
"."
] | def SingleQubitCliffordPulseGenerator(ham: QHam) -> SchedulerPulseGenerator:
generator = SchedulerPulseGenerator(ham)
gateList1q = ['X', 'Y', 'Z', 'H', 'S', 'T', 'RX', 'RY', 'RZ', 'W', 'SQRTW', 'U']
generator.addGenerator(gateList1q, GeneratorCloud.generate1Q)
gateList1QCliff = ['C1', 'C2', 'C3', 'C4', ... | [
"def",
"SingleQubitCliffordPulseGenerator",
"(",
"ham",
":",
"QHam",
")",
"->",
"SchedulerPulseGenerator",
":",
"generator",
"=",
"SchedulerPulseGenerator",
"(",
"ham",
")",
"gateList1q",
"=",
"[",
"'X'",
",",
"'Y'",
",",
"'Z'",
",",
"'H'",
",",
"'S'",
",",
... | Return a single-qubit Clifford pulse SchedulerPulseGenerator instance for the scheduler. | [
"Return",
"a",
"single",
"-",
"qubit",
"Clifford",
"pulse",
"SchedulerPulseGenerator",
"instance",
"for",
"the",
"scheduler",
"."
] | [
"\"\"\"\n Return a single-qubit Clifford pulse SchedulerPulseGenerator instance for the scheduler.\n\n :param ham: a Hamiltonian object\n :return: returned generator object\n \"\"\""
] | [
{
"param": "ham",
"type": "QHam"
}
] | {
"returns": [
{
"docstring": "returned generator object",
"docstring_tokens": [
"returned",
"generator",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHam",
"docstring": "a Hamiltonian objec... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | generateVZ | QJob | def generateVZ(ham: QHamiltonian, cirLine: CircuitLine) -> QJob:
"""
Generate the virtual-z gate
"""
job = ham.createJob()
onQubit = int(cirLine.qRegIndexList[0])
phase = cirLine.data.uGateArgumentList[2]
vz = virtualZ(phase=phase)
job.appendWave(opera... |
Generate the virtual-z gate
| Generate the virtual-z gate | [
"Generate",
"the",
"virtual",
"-",
"z",
"gate"
] | def generateVZ(ham: QHamiltonian, cirLine: CircuitLine) -> QJob:
job = ham.createJob()
onQubit = int(cirLine.qRegIndexList[0])
phase = cirLine.data.uGateArgumentList[2]
vz = virtualZ(phase=phase)
job.appendWave(operators=uWave, onSubSys=onQubit, waves=vz)
return job | [
"def",
"generateVZ",
"(",
"ham",
":",
"QHamiltonian",
",",
"cirLine",
":",
"CircuitLine",
")",
"->",
"QJob",
":",
"job",
"=",
"ham",
".",
"createJob",
"(",
")",
"onQubit",
"=",
"int",
"(",
"cirLine",
".",
"qRegIndexList",
"[",
"0",
"]",
")",
"phase",
... | Generate the virtual-z gate | [
"Generate",
"the",
"virtual",
"-",
"z",
"gate"
] | [
"\"\"\"\n Generate the virtual-z gate\n \"\"\""
] | [
{
"param": "ham",
"type": "QHamiltonian"
},
{
"param": "cirLine",
"type": "CircuitLine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHamiltonian",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cirLine",
"type": "CircuitLine",
"docstring": null,
... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | generateEchoedCR | QJob | def generateEchoedCR(ham: QHamiltonian, cirLine, scheduler) -> QJob:
"""
Generate echoed cross-resonance gate
"""
qIndex = list(cirLine.qRegIndexList)
jobCR = generateCR(ham=ham, cirLine=CircuitLine(CR, qIndex), scheduler=scheduler, tFactor=0.5)
jobX = generate1QGate(ham=... |
Generate echoed cross-resonance gate
| Generate echoed cross-resonance gate | [
"Generate",
"echoed",
"cross",
"-",
"resonance",
"gate"
] | def generateEchoedCR(ham: QHamiltonian, cirLine, scheduler) -> QJob:
qIndex = list(cirLine.qRegIndexList)
jobCR = generateCR(ham=ham, cirLine=CircuitLine(CR, qIndex), scheduler=scheduler, tFactor=0.5)
jobX = generate1QGate(ham=ham, cirLine=CircuitLine(X, [qIndex[0]]), scheduler=scheduler)
... | [
"def",
"generateEchoedCR",
"(",
"ham",
":",
"QHamiltonian",
",",
"cirLine",
",",
"scheduler",
")",
"->",
"QJob",
":",
"qIndex",
"=",
"list",
"(",
"cirLine",
".",
"qRegIndexList",
")",
"jobCR",
"=",
"generateCR",
"(",
"ham",
"=",
"ham",
",",
"cirLine",
"=... | Generate echoed cross-resonance gate | [
"Generate",
"echoed",
"cross",
"-",
"resonance",
"gate"
] | [
"\"\"\"\n Generate echoed cross-resonance gate\n \"\"\""
] | [
{
"param": "ham",
"type": "QHamiltonian"
},
{
"param": "cirLine",
"type": null
},
{
"param": "scheduler",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHamiltonian",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cirLine",
"type": null,
"docstring": null,
"docstrin... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | generateCNOT | QJob | def generateCNOT(ham: QHamiltonian, cirLine, scheduler) -> QJob:
"""
Generate the CNOT gate using echoed-CR gate and virtual-Z gate.
"""
qIndex = list(cirLine.qRegIndexList)
jobVZ = generateVZ(ham=ham, cirLine=CircuitLine(VZ(pi / 2), [qIndex[0]]))
jobEchoedCR = generateEc... |
Generate the CNOT gate using echoed-CR gate and virtual-Z gate.
| Generate the CNOT gate using echoed-CR gate and virtual-Z gate. | [
"Generate",
"the",
"CNOT",
"gate",
"using",
"echoed",
"-",
"CR",
"gate",
"and",
"virtual",
"-",
"Z",
"gate",
"."
] | def generateCNOT(ham: QHamiltonian, cirLine, scheduler) -> QJob:
qIndex = list(cirLine.qRegIndexList)
jobVZ = generateVZ(ham=ham, cirLine=CircuitLine(VZ(pi / 2), [qIndex[0]]))
jobEchoedCR = generateEchoedCR(ham=ham, cirLine=CircuitLine(CR, qIndex), scheduler=scheduler)
jobRX = generate1Q... | [
"def",
"generateCNOT",
"(",
"ham",
":",
"QHamiltonian",
",",
"cirLine",
",",
"scheduler",
")",
"->",
"QJob",
":",
"qIndex",
"=",
"list",
"(",
"cirLine",
".",
"qRegIndexList",
")",
"jobVZ",
"=",
"generateVZ",
"(",
"ham",
"=",
"ham",
",",
"cirLine",
"=",
... | Generate the CNOT gate using echoed-CR gate and virtual-Z gate. | [
"Generate",
"the",
"CNOT",
"gate",
"using",
"echoed",
"-",
"CR",
"gate",
"and",
"virtual",
"-",
"Z",
"gate",
"."
] | [
"\"\"\"\n Generate the CNOT gate using echoed-CR gate and virtual-Z gate.\n \"\"\""
] | [
{
"param": "ham",
"type": "QHamiltonian"
},
{
"param": "cirLine",
"type": null
},
{
"param": "scheduler",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHamiltonian",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cirLine",
"type": null,
"docstring": null,
"docstrin... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | computationalSubspace | ndarray | def computationalSubspace(obj: Union[PulseModel, QHamiltonian]) -> ndarray:
r"""
Return the computational subspace matrix
:param obj: input PulseModel object or QHamiltonian object
:return: a 4-dimensions ndarray
"""
if isinstance(obj, PulseModel):
ham = obj.createQHamiltonian(frameMod... | r"""
Return the computational subspace matrix
:param obj: input PulseModel object or QHamiltonian object
:return: a 4-dimensions ndarray
| r"""
Return the computational subspace matrix | [
"r",
"\"",
"\"",
"\"",
"Return",
"the",
"computational",
"subspace",
"matrix"
] | def computationalSubspace(obj: Union[PulseModel, QHamiltonian]) -> ndarray:
if isinstance(obj, PulseModel):
ham = obj.createQHamiltonian(frameMode='lab')
elif isinstance(obj, QHamiltonian):
ham = obj
else:
raise Error.ArgumentError("Pleases input a PulseModel object or a QHamiltonian... | [
"def",
"computationalSubspace",
"(",
"obj",
":",
"Union",
"[",
"PulseModel",
",",
"QHamiltonian",
"]",
")",
"->",
"ndarray",
":",
"if",
"isinstance",
"(",
"obj",
",",
"PulseModel",
")",
":",
"ham",
"=",
"obj",
".",
"createQHamiltonian",
"(",
"frameMode",
"... | r"""
Return the computational subspace matrix | [
"r",
"\"",
"\"",
"\"",
"Return",
"the",
"computational",
"subspace",
"matrix"
] | [
"r\"\"\"\n Return the computational subspace matrix\n\n :param obj: input PulseModel object or QHamiltonian object\n\n :return: a 4-dimensions ndarray\n \"\"\"",
"# Decoupling coupler",
"# Rearrange",
"# Obtain the computation subspace matrix"
] | [
{
"param": "obj",
"type": "Union[PulseModel, QHamiltonian]"
}
] | {
"returns": [
{
"docstring": "a 4-dimensions ndarray",
"docstring_tokens": [
"a",
"4",
"-",
"dimensions",
"ndarray"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "Union[PulseModel, QHamiltoni... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | staticZZ | float | def staticZZ(obj: Union[PulseModel, QHamiltonian]) -> float:
r"""
Compute the static ZZ strength of the given QCQ model
:param obj: input a PulseModel object or QHamiltonian object
:return: a float
"""
if isinstance(obj, PulseModel):
ham = obj.createQHamiltonian(frameMode='lab')
e... | r"""
Compute the static ZZ strength of the given QCQ model
:param obj: input a PulseModel object or QHamiltonian object
:return: a float
| r"""
Compute the static ZZ strength of the given QCQ model | [
"r",
"\"",
"\"",
"\"",
"Compute",
"the",
"static",
"ZZ",
"strength",
"of",
"the",
"given",
"QCQ",
"model"
] | def staticZZ(obj: Union[PulseModel, QHamiltonian]) -> float:
if isinstance(obj, PulseModel):
ham = obj.createQHamiltonian(frameMode='lab')
elif isinstance(obj, QHamiltonian):
ham = obj
else:
raise Error.ArgumentError("Pleases input a PulseModel object or a QHamiltonian object.")
... | [
"def",
"staticZZ",
"(",
"obj",
":",
"Union",
"[",
"PulseModel",
",",
"QHamiltonian",
"]",
")",
"->",
"float",
":",
"if",
"isinstance",
"(",
"obj",
",",
"PulseModel",
")",
":",
"ham",
"=",
"obj",
".",
"createQHamiltonian",
"(",
"frameMode",
"=",
"'lab'",
... | r"""
Compute the static ZZ strength of the given QCQ model | [
"r",
"\"",
"\"",
"\"",
"Compute",
"the",
"static",
"ZZ",
"strength",
"of",
"the",
"given",
"QCQ",
"model"
] | [
"r\"\"\"\n Compute the static ZZ strength of the given QCQ model\n\n :param obj: input a PulseModel object or QHamiltonian object\n\n :return: a float\n \"\"\"",
"# Create Qubit-Qubit subspace basis vectors",
"# Get the eigen system of QCQ Hamiltonian",
"# vector indexes of QQ eigenvectors"
] | [
{
"param": "obj",
"type": "Union[PulseModel, QHamiltonian]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "Union[PulseModel, QHamiltonian]",
"docstring": "input a PulseModel object or QHamiltonian object",
"... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | effectiveCoupling | float | def effectiveCoupling(obj: Union[PulseModel, QHamiltonian]) -> float:
r"""
Return effective coupling strength of Qubit-Qubit Model
:param obj: input PulseModel object or QHamiltonian object
:return: a float
"""
matrixXY = (tensor(sigmaX().matrix, sigmaX().matrix) + tensor(sigmaY().matrix, sig... | r"""
Return effective coupling strength of Qubit-Qubit Model
:param obj: input PulseModel object or QHamiltonian object
:return: a float
| r"""
Return effective coupling strength of Qubit-Qubit Model | [
"r",
"\"",
"\"",
"\"",
"Return",
"effective",
"coupling",
"strength",
"of",
"Qubit",
"-",
"Qubit",
"Model"
] | def effectiveCoupling(obj: Union[PulseModel, QHamiltonian]) -> float:
matrixXY = (tensor(sigmaX().matrix, sigmaX().matrix) + tensor(sigmaY().matrix, sigmaY().matrix)) / 2
subMatrix = computationalSubspace(obj)
effectiveJ = trace(matrixXY @ subMatrix).real / 2
return effectiveJ | [
"def",
"effectiveCoupling",
"(",
"obj",
":",
"Union",
"[",
"PulseModel",
",",
"QHamiltonian",
"]",
")",
"->",
"float",
":",
"matrixXY",
"=",
"(",
"tensor",
"(",
"sigmaX",
"(",
")",
".",
"matrix",
",",
"sigmaX",
"(",
")",
".",
"matrix",
")",
"+",
"ten... | r"""
Return effective coupling strength of Qubit-Qubit Model | [
"r",
"\"",
"\"",
"\"",
"Return",
"effective",
"coupling",
"strength",
"of",
"Qubit",
"-",
"Qubit",
"Model"
] | [
"r\"\"\"\n Return effective coupling strength of Qubit-Qubit Model\n\n :param obj: input PulseModel object or QHamiltonian object\n\n :return: a float\n \"\"\""
] | [
{
"param": "obj",
"type": "Union[PulseModel, QHamiltonian]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "Union[PulseModel, QHamiltonian]",
"docstring": "input PulseModel object or QHamiltonian object",
"do... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | dressedQubitFreq | Dict | def dressedQubitFreq(obj: Union[PulseModel, QHamiltonian]) -> Dict:
"""
Return the dressed frequencies of the control qubit and the target qubit
:param obj: input a PulseModel object or QHamiltonian object
:return: dressed frequencies dictionary
"""
if isinstance(obj, PulseModel):
ham ... |
Return the dressed frequencies of the control qubit and the target qubit
:param obj: input a PulseModel object or QHamiltonian object
:return: dressed frequencies dictionary
| Return the dressed frequencies of the control qubit and the target qubit | [
"Return",
"the",
"dressed",
"frequencies",
"of",
"the",
"control",
"qubit",
"and",
"the",
"target",
"qubit"
] | def dressedQubitFreq(obj: Union[PulseModel, QHamiltonian]) -> Dict:
if isinstance(obj, PulseModel):
ham = obj.createQHamiltonian(frameMode='lab')
elif isinstance(obj, QHamiltonian):
ham = obj
else:
raise Error.ArgumentError("Pleases input a PulseModel object or a QHamiltonian object.... | [
"def",
"dressedQubitFreq",
"(",
"obj",
":",
"Union",
"[",
"PulseModel",
",",
"QHamiltonian",
"]",
")",
"->",
"Dict",
":",
"if",
"isinstance",
"(",
"obj",
",",
"PulseModel",
")",
":",
"ham",
"=",
"obj",
".",
"createQHamiltonian",
"(",
"frameMode",
"=",
"'... | Return the dressed frequencies of the control qubit and the target qubit | [
"Return",
"the",
"dressed",
"frequencies",
"of",
"the",
"control",
"qubit",
"and",
"the",
"target",
"qubit"
] | [
"\"\"\"\n Return the dressed frequencies of the control qubit and the target qubit\n\n :param obj: input a PulseModel object or QHamiltonian object\n\n :return: dressed frequencies dictionary\n \"\"\"",
"# Create Qubit-Qubit subspace basis vectors",
"# Get the eigen system of QCQ Hamiltonian",
"# ... | [
{
"param": "obj",
"type": "Union[PulseModel, QHamiltonian]"
}
] | {
"returns": [
{
"docstring": "dressed frequencies dictionary",
"docstring_tokens": [
"dressed",
"frequencies",
"dictionary"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "Union[PulseModel, QHamiltonian]",
... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | pauliCoefficient | Dict | def pauliCoefficient(obj: Union[PulseModel, QHamiltonian], drivingAmp: Optional[float] = None) -> Dict:
r"""
Return Pauli coefficients of the Hamiltonian with CR drive
:param obj: input PulseModel object or QHamiltonian object
:param drivingAmp: amplitude of CR pulse
:return: Pauli coefficients di... | r"""
Return Pauli coefficients of the Hamiltonian with CR drive
:param obj: input PulseModel object or QHamiltonian object
:param drivingAmp: amplitude of CR pulse
:return: Pauli coefficients dictionary
| r"""
Return Pauli coefficients of the Hamiltonian with CR drive | [
"r",
"\"",
"\"",
"\"",
"Return",
"Pauli",
"coefficients",
"of",
"the",
"Hamiltonian",
"with",
"CR",
"drive"
] | def pauliCoefficient(obj: Union[PulseModel, QHamiltonian], drivingAmp: Optional[float] = None) -> Dict:
def _diagnoalize(mat: ndarray):
matCache = copy.deepcopy(mat)
eigenVals, eigenVecs = eigenSystem(matCache)
indexVecList = createBasis(mat.shape[0], mat.shape[0])
indexList = findIn... | [
"def",
"pauliCoefficient",
"(",
"obj",
":",
"Union",
"[",
"PulseModel",
",",
"QHamiltonian",
"]",
",",
"drivingAmp",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"Dict",
":",
"def",
"_diagnoalize",
"(",
"mat",
":",
"ndarray",
")",
":",
"... | r"""
Return Pauli coefficients of the Hamiltonian with CR drive | [
"r",
"\"",
"\"",
"\"",
"Return",
"Pauli",
"coefficients",
"of",
"the",
"Hamiltonian",
"with",
"CR",
"drive"
] | [
"r\"\"\"\n Return Pauli coefficients of the Hamiltonian with CR drive\n\n :param obj: input PulseModel object or QHamiltonian object\n :param drivingAmp: amplitude of CR pulse\n\n :return: Pauli coefficients dictionary\n \"\"\"",
"\"\"\"\n Diagonalize the given matrix\n\n :param mat: ... | [
{
"param": "obj",
"type": "Union[PulseModel, QHamiltonian]"
},
{
"param": "drivingAmp",
"type": "Optional[float]"
}
] | {
"returns": [
{
"docstring": "Pauli coefficients dictionary",
"docstring_tokens": [
"Pauli",
"coefficients",
"dictionary"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "Union[PulseModel, QHamiltonian]",
... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | rearrange | ndarray | def rearrange(mat: ndarray) -> ndarray:
"""
Rearrange the Q-Q Hamiltonian matrix by the excitation number
:param mat: input Hamiltonian matrix
:return: rearranged matrix
"""
if mat.shape == (16, 16):
matCache = copy.deepcopy(mat)
matCache[:, [2, 4]] = matCache[:, [4, 2]]
... |
Rearrange the Q-Q Hamiltonian matrix by the excitation number
:param mat: input Hamiltonian matrix
:return: rearranged matrix
| Rearrange the Q-Q Hamiltonian matrix by the excitation number | [
"Rearrange",
"the",
"Q",
"-",
"Q",
"Hamiltonian",
"matrix",
"by",
"the",
"excitation",
"number"
] | def rearrange(mat: ndarray) -> ndarray:
if mat.shape == (16, 16):
matCache = copy.deepcopy(mat)
matCache[:, [2, 4]] = matCache[:, [4, 2]]
matCache[[2, 4], :] = matCache[[4, 2], :]
matCache[:, [3, 5]] = matCache[:, [5, 3]]
matCache[[3, 5], :] = matCache[[5, 3], :]
matC... | [
"def",
"rearrange",
"(",
"mat",
":",
"ndarray",
")",
"->",
"ndarray",
":",
"if",
"mat",
".",
"shape",
"==",
"(",
"16",
",",
"16",
")",
":",
"matCache",
"=",
"copy",
".",
"deepcopy",
"(",
"mat",
")",
"matCache",
"[",
":",
",",
"[",
"2",
",",
"4"... | Rearrange the Q-Q Hamiltonian matrix by the excitation number | [
"Rearrange",
"the",
"Q",
"-",
"Q",
"Hamiltonian",
"matrix",
"by",
"the",
"excitation",
"number"
] | [
"\"\"\"\n Rearrange the Q-Q Hamiltonian matrix by the excitation number\n\n :param mat: input Hamiltonian matrix\n\n :return: rearranged matrix\n \"\"\""
] | [
{
"param": "mat",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "mat",
"type": "ndarray",
"docstring": "input Hamiltonian matrix",
"docstring_tokens": [
"input",
"H... |
1f1cb702e10d0c3ea0ffe65db0d0d7cbe9dee4e1 | baidu/Quanlse | Quanlse/Simulator/PulseSimQCQ.py | [
"Apache-2.0"
] | Python | computeBlockDiagonalize | [ndarray, ndarray] | def computeBlockDiagonalize(mat: ndarray, blockDim: int = 4) -> [ndarray, ndarray]:
"""
Block diagonalize the qubit-qubit subspace matrix and get the computational subspace block matrix
:param mat: Qubit-Qubit subspace matrix
:param blockDim: dimension of the computational subspace matrix (default: 4)
... |
Block diagonalize the qubit-qubit subspace matrix and get the computational subspace block matrix
:param mat: Qubit-Qubit subspace matrix
:param blockDim: dimension of the computational subspace matrix (default: 4)
:return: the block diagonalized matrix and transformation unitary
| Block diagonalize the qubit-qubit subspace matrix and get the computational subspace block matrix | [
"Block",
"diagonalize",
"the",
"qubit",
"-",
"qubit",
"subspace",
"matrix",
"and",
"get",
"the",
"computational",
"subspace",
"block",
"matrix"
] | def computeBlockDiagonalize(mat: ndarray, blockDim: int = 4) -> [ndarray, ndarray]:
matCache = copy.deepcopy(mat)
eigenVals, eigenVecs = eigenSystem(matCache)
subVecList = createBasis(mat.shape[0], blockDim)
indexList = findIndex(eigenVecs, subVecList)
if len(indexList) == 4:
if indexList[0]... | [
"def",
"computeBlockDiagonalize",
"(",
"mat",
":",
"ndarray",
",",
"blockDim",
":",
"int",
"=",
"4",
")",
"->",
"[",
"ndarray",
",",
"ndarray",
"]",
":",
"matCache",
"=",
"copy",
".",
"deepcopy",
"(",
"mat",
")",
"eigenVals",
",",
"eigenVecs",
"=",
"ei... | Block diagonalize the qubit-qubit subspace matrix and get the computational subspace block matrix | [
"Block",
"diagonalize",
"the",
"qubit",
"-",
"qubit",
"subspace",
"matrix",
"and",
"get",
"the",
"computational",
"subspace",
"block",
"matrix"
] | [
"\"\"\"\n Block diagonalize the qubit-qubit subspace matrix and get the computational subspace block matrix\n\n :param mat: Qubit-Qubit subspace matrix\n :param blockDim: dimension of the computational subspace matrix (default: 4)\n\n :return: the block diagonalized matrix and transformation unitary\n ... | [
{
"param": "mat",
"type": "ndarray"
},
{
"param": "blockDim",
"type": "int"
}
] | {
"returns": [
{
"docstring": "the block diagonalized matrix and transformation unitary",
"docstring_tokens": [
"the",
"block",
"diagonalized",
"matrix",
"and",
"transformation",
"unitary"
],
"type": null
}
],
"raises": [],
... |
f25ab96a766d3f5010ddce75d39b9e382844fc52 | baidu/Quanlse | Quanlse/QPlatform/Utilities.py | [
"Apache-2.0"
] | Python | numpyMatrixToDictMatrix | Dict | def numpyMatrixToDictMatrix(numpyMatrix: numpy.ndarray) -> Dict:
"""
Convert numpy matrix to a dictionary. Must be C-contiguous.
:param numpyMatrix: numpy matrix
:return: returned dictionary
"""
if not numpyMatrix.flags["C_CONTIGUOUS"]:
raise Error.ArgumentError('Matrix must C-contiguo... |
Convert numpy matrix to a dictionary. Must be C-contiguous.
:param numpyMatrix: numpy matrix
:return: returned dictionary
| Convert numpy matrix to a dictionary. Must be C-contiguous. | [
"Convert",
"numpy",
"matrix",
"to",
"a",
"dictionary",
".",
"Must",
"be",
"C",
"-",
"contiguous",
"."
] | def numpyMatrixToDictMatrix(numpyMatrix: numpy.ndarray) -> Dict:
if not numpyMatrix.flags["C_CONTIGUOUS"]:
raise Error.ArgumentError('Matrix must C-contiguous!')
if numpyMatrix.size == 0:
return {}
array = []
dictMatrix = {
'shape': list(numpyMatrix.shape),
'array': array... | [
"def",
"numpyMatrixToDictMatrix",
"(",
"numpyMatrix",
":",
"numpy",
".",
"ndarray",
")",
"->",
"Dict",
":",
"if",
"not",
"numpyMatrix",
".",
"flags",
"[",
"\"C_CONTIGUOUS\"",
"]",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
"'Matrix must C-contiguous!'",
"... | Convert numpy matrix to a dictionary. | [
"Convert",
"numpy",
"matrix",
"to",
"a",
"dictionary",
"."
] | [
"\"\"\"\n Convert numpy matrix to a dictionary. Must be C-contiguous.\n\n :param numpyMatrix: numpy matrix\n :return: returned dictionary\n \"\"\""
] | [
{
"param": "numpyMatrix",
"type": "numpy.ndarray"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "numpyMatrix",
"type": "numpy.ndarray",
"docstring": null,
"docstring_tokens": [
"None"
],
"defa... |
f25ab96a766d3f5010ddce75d39b9e382844fc52 | baidu/Quanlse | Quanlse/QPlatform/Utilities.py | [
"Apache-2.0"
] | Python | dictMatrixToNumpyMatrix | numpy.ndarray | def dictMatrixToNumpyMatrix(dictMatrix: Dict, valueType: Union[Type[complex], Type[float]]) -> numpy.ndarray:
"""
Convert numpy matrix to a dictionary. Must be C-contiguous.
:param dictMatrix: dictionary consisting the matrix
:param valueType: select value type
:return: returned numpy matrix
""... |
Convert numpy matrix to a dictionary. Must be C-contiguous.
:param dictMatrix: dictionary consisting the matrix
:param valueType: select value type
:return: returned numpy matrix
| Convert numpy matrix to a dictionary. Must be C-contiguous. | [
"Convert",
"numpy",
"matrix",
"to",
"a",
"dictionary",
".",
"Must",
"be",
"C",
"-",
"contiguous",
"."
] | def dictMatrixToNumpyMatrix(dictMatrix: Dict, valueType: Union[Type[complex], Type[float]]) -> numpy.ndarray:
if len(dictMatrix) == 0:
return numpy.empty(0, valueType)
if valueType == complex:
complexArray = [complex(complexValue['real'], complexValue['imag']) for complexValue in dictMatrix['arr... | [
"def",
"dictMatrixToNumpyMatrix",
"(",
"dictMatrix",
":",
"Dict",
",",
"valueType",
":",
"Union",
"[",
"Type",
"[",
"complex",
"]",
",",
"Type",
"[",
"float",
"]",
"]",
")",
"->",
"numpy",
".",
"ndarray",
":",
"if",
"len",
"(",
"dictMatrix",
")",
"==",... | Convert numpy matrix to a dictionary. | [
"Convert",
"numpy",
"matrix",
"to",
"a",
"dictionary",
"."
] | [
"\"\"\"\n Convert numpy matrix to a dictionary. Must be C-contiguous.\n\n :param dictMatrix: dictionary consisting the matrix\n :param valueType: select value type\n :return: returned numpy matrix\n \"\"\""
] | [
{
"param": "dictMatrix",
"type": "Dict"
},
{
"param": "valueType",
"type": "Union[Type[complex], Type[float]]"
}
] | {
"returns": [
{
"docstring": "returned numpy matrix",
"docstring_tokens": [
"returned",
"numpy",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dictMatrix",
"type": "Dict",
"docstring": "dictionary consistin... |
f25ab96a766d3f5010ddce75d39b9e382844fc52 | baidu/Quanlse | Quanlse/QPlatform/Utilities.py | [
"Apache-2.0"
] | Python | circuitLineDump | str | def circuitLineDump(cirLine: Union[CircuitLine, List[CircuitLine]]) -> str:
"""
Convert CircuitLine Object (or the list of that) into a string.
:param cirLine: a CircuitLine Object
:return: returned string object
"""
byteStr = pickle.dumps(cirLine)
base64str = base64.b64encode(byteStr)
... |
Convert CircuitLine Object (or the list of that) into a string.
:param cirLine: a CircuitLine Object
:return: returned string object
| Convert CircuitLine Object (or the list of that) into a string. | [
"Convert",
"CircuitLine",
"Object",
"(",
"or",
"the",
"list",
"of",
"that",
")",
"into",
"a",
"string",
"."
] | def circuitLineDump(cirLine: Union[CircuitLine, List[CircuitLine]]) -> str:
byteStr = pickle.dumps(cirLine)
base64str = base64.b64encode(byteStr)
return base64str.decode() | [
"def",
"circuitLineDump",
"(",
"cirLine",
":",
"Union",
"[",
"CircuitLine",
",",
"List",
"[",
"CircuitLine",
"]",
"]",
")",
"->",
"str",
":",
"byteStr",
"=",
"pickle",
".",
"dumps",
"(",
"cirLine",
")",
"base64str",
"=",
"base64",
".",
"b64encode",
"(",
... | Convert CircuitLine Object (or the list of that) into a string. | [
"Convert",
"CircuitLine",
"Object",
"(",
"or",
"the",
"list",
"of",
"that",
")",
"into",
"a",
"string",
"."
] | [
"\"\"\"\n Convert CircuitLine Object (or the list of that) into a string.\n\n :param cirLine: a CircuitLine Object\n :return: returned string object\n \"\"\""
] | [
{
"param": "cirLine",
"type": "Union[CircuitLine, List[CircuitLine]]"
}
] | {
"returns": [
{
"docstring": "returned string object",
"docstring_tokens": [
"returned",
"string",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cirLine",
"type": "Union[CircuitLine, List[CircuitLine]]",
"d... |
f25ab96a766d3f5010ddce75d39b9e382844fc52 | baidu/Quanlse | Quanlse/QPlatform/Utilities.py | [
"Apache-2.0"
] | Python | circuitLineLoad | Union[CircuitLine, List[CircuitLine]] | def circuitLineLoad(base64str: str) -> Union[CircuitLine, List[CircuitLine]]:
"""
Convert base64 string into CircuitLine objects.
:param base64str: input base64 string
:return: returned CircuitLine object
"""
byteStr = base64.b64decode(base64str.encode())
obj = pickle.loads(byteStr) # ... |
Convert base64 string into CircuitLine objects.
:param base64str: input base64 string
:return: returned CircuitLine object
| Convert base64 string into CircuitLine objects. | [
"Convert",
"base64",
"string",
"into",
"CircuitLine",
"objects",
"."
] | def circuitLineLoad(base64str: str) -> Union[CircuitLine, List[CircuitLine]]:
byteStr = base64.b64decode(base64str.encode())
obj = pickle.loads(byteStr)
return obj | [
"def",
"circuitLineLoad",
"(",
"base64str",
":",
"str",
")",
"->",
"Union",
"[",
"CircuitLine",
",",
"List",
"[",
"CircuitLine",
"]",
"]",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pic... | Convert base64 string into CircuitLine objects. | [
"Convert",
"base64",
"string",
"into",
"CircuitLine",
"objects",
"."
] | [
"\"\"\"\n Convert base64 string into CircuitLine objects.\n \n :param base64str: input base64 string\n :return: returned CircuitLine object\n \"\"\"",
"# type: Union[CircuitLine, List[CircuitLine]]"
] | [
{
"param": "base64str",
"type": "str"
}
] | {
"returns": [
{
"docstring": "returned CircuitLine object",
"docstring_tokens": [
"returned",
"CircuitLine",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64str",
"type": "str",
"docstring": "input base... |
cf711d72003c84944c9fce935f6a57570af3777a | baidu/Quanlse | Quanlse/remoteZNE.py | [
"Apache-2.0"
] | Python | remoteZNEMitigation | Tuple[float, List[float], List[float]] | def remoteZNEMitigation(rho: np.ndarray,
circuit: List[CircuitLine] = None,
A: np.ndarray = None,
ham: QHam = None,
order: int = 1) -> Tuple[float, List[float], List[float]]:
r"""
Use the extrapolation method to miti... | r"""
Use the extrapolation method to mitigate the expectation value:
:math:`{\rm Tr}[A C_n\cdots C_1 \rho C_1^\dagger \cdots C_n^\dagger]`
under the assumption that the implementation of :math:`C_i` suffer from noise.
More specifically, the hamiltonian designed to implement the
quantum circuit :ma... | r"""
Use the extrapolation method to mitigate the expectation value. | [
"r",
"\"",
"\"",
"\"",
"Use",
"the",
"extrapolation",
"method",
"to",
"mitigate",
"the",
"expectation",
"value",
"."
] | def remoteZNEMitigation(rho: np.ndarray,
circuit: List[CircuitLine] = None,
A: np.ndarray = None,
ham: QHam = None,
order: int = 1) -> Tuple[float, List[float], List[float]]:
args = [
numpyMatrixToDictMatrix(rho)... | [
"def",
"remoteZNEMitigation",
"(",
"rho",
":",
"np",
".",
"ndarray",
",",
"circuit",
":",
"List",
"[",
"CircuitLine",
"]",
"=",
"None",
",",
"A",
":",
"np",
".",
"ndarray",
"=",
"None",
",",
"ham",
":",
"QHam",
"=",
"None",
",",
"order",
":",
"int"... | r"""
Use the extrapolation method to mitigate the expectation value: | [
"r",
"\"",
"\"",
"\"",
"Use",
"the",
"extrapolation",
"method",
"to",
"mitigate",
"the",
"expectation",
"value",
":"
] | [
"r\"\"\"\n Use the extrapolation method to mitigate the expectation value:\n\n :math:`{\\rm Tr}[A C_n\\cdots C_1 \\rho C_1^\\dagger \\cdots C_n^\\dagger]`\n\n under the assumption that the implementation of :math:`C_i` suffer from noise.\n More specifically, the hamiltonian designed to implement the\n ... | [
{
"param": "rho",
"type": "np.ndarray"
},
{
"param": "circuit",
"type": "List[CircuitLine]"
},
{
"param": "A",
"type": "np.ndarray"
},
{
"param": "ham",
"type": "QHam"
},
{
"param": "order",
"type": "int"
}
] | {
"returns": [
{
"docstring": "The error mitigated expectation value and possibly\na list of coefficients and noisy expectation values.",
"docstring_tokens": [
"The",
"error",
"mitigated",
"expectation",
"value",
"and",
"possibly",
"a",
... |
efb18fde6eb0d44b4828a444d769a90f2867dce1 | baidu/Quanlse | Quanlse/Utils/Benchmark.py | [
"Apache-2.0"
] | Python | evolution | Dict[str, Any] | def evolution(ham: QHamiltonian, stateInitial: ndarray = None, matrix: ndarray = None) -> Dict[str, Any]:
"""
Return the expectation value of the given matrix for given initial states. The input can be a list
containing all the matrices and states that the users want to calculate.
:param ham: Hamiltoni... |
Return the expectation value of the given matrix for given initial states. The input can be a list
containing all the matrices and states that the users want to calculate.
:param ham: Hamiltonian Dictionary
:param stateInitial: the list of numpy.ndarray that represents an initial state in the Hilbert ... | Return the expectation value of the given matrix for given initial states. The input can be a list
containing all the matrices and states that the users want to calculate. | [
"Return",
"the",
"expectation",
"value",
"of",
"the",
"given",
"matrix",
"for",
"given",
"initial",
"states",
".",
"The",
"input",
"can",
"be",
"a",
"list",
"containing",
"all",
"the",
"matrices",
"and",
"states",
"that",
"the",
"users",
"want",
"to",
"cal... | def evolution(ham: QHamiltonian, stateInitial: ndarray = None, matrix: ndarray = None) -> Dict[str, Any]:
if type(matrix) is ndarray:
matrixList = [matrix]
else:
matrixList = matrix
if type(stateInitial) is ndarray:
stateInitial = [stateInitial]
result = ham.simulate(recordEvolut... | [
"def",
"evolution",
"(",
"ham",
":",
"QHamiltonian",
",",
"stateInitial",
":",
"ndarray",
"=",
"None",
",",
"matrix",
":",
"ndarray",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"type",
"(",
"matrix",
")",
"is",
"ndarray",... | Return the expectation value of the given matrix for given initial states. | [
"Return",
"the",
"expectation",
"value",
"of",
"the",
"given",
"matrix",
"for",
"given",
"initial",
"states",
"."
] | [
"\"\"\"\n Return the expectation value of the given matrix for given initial states. The input can be a list\n containing all the matrices and states that the users want to calculate.\n\n :param ham: Hamiltonian Dictionary\n :param stateInitial: the list of numpy.ndarray that represents an initial state... | [
{
"param": "ham",
"type": "QHamiltonian"
},
{
"param": "stateInitial",
"type": "ndarray"
},
{
"param": "matrix",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "the dictionary that contains all the expectation values for all initial states",
"docstring_tokens": [
"the",
"dictionary",
"that",
"contains",
"all",
"the",
"expectation",
"values",
"for",
"... |
efb18fde6eb0d44b4828a444d769a90f2867dce1 | baidu/Quanlse | Quanlse/Utils/Benchmark.py | [
"Apache-2.0"
] | Python | evolutionList | list | def evolutionList(state: ndarray, unitaryList: List) -> list:
"""
Return the intermediate states with given initial states and the list of unitary matrices.
:param state: the numpy.ndarray representing the initial state
:param unitaryList: the list containing different unitary matrices at different tim... |
Return the intermediate states with given initial states and the list of unitary matrices.
:param state: the numpy.ndarray representing the initial state
:param unitaryList: the list containing different unitary matrices at different times
:return stateList: the list of intermediate states for the giv... | Return the intermediate states with given initial states and the list of unitary matrices. | [
"Return",
"the",
"intermediate",
"states",
"with",
"given",
"initial",
"states",
"and",
"the",
"list",
"of",
"unitary",
"matrices",
"."
] | def evolutionList(state: ndarray, unitaryList: List) -> list:
stateList = []
for unitaryItem in unitaryList:
stateList.append(dot(unitaryItem, state))
return stateList | [
"def",
"evolutionList",
"(",
"state",
":",
"ndarray",
",",
"unitaryList",
":",
"List",
")",
"->",
"list",
":",
"stateList",
"=",
"[",
"]",
"for",
"unitaryItem",
"in",
"unitaryList",
":",
"stateList",
".",
"append",
"(",
"dot",
"(",
"unitaryItem",
",",
"s... | Return the intermediate states with given initial states and the list of unitary matrices. | [
"Return",
"the",
"intermediate",
"states",
"with",
"given",
"initial",
"states",
"and",
"the",
"list",
"of",
"unitary",
"matrices",
"."
] | [
"\"\"\"\n Return the intermediate states with given initial states and the list of unitary matrices.\n\n :param state: the numpy.ndarray representing the initial state\n :param unitaryList: the list containing different unitary matrices at different times\n :return stateList: the list of intermediate st... | [
{
"param": "state",
"type": "ndarray"
},
{
"param": "unitaryList",
"type": "List"
}
] | {
"returns": [
{
"docstring": "the list of intermediate states for the given unitary matrices",
"docstring_tokens": [
"the",
"list",
"of",
"intermediate",
"states",
"for",
"the",
"given",
"unitary",
"matrices"
],
... |
efb18fde6eb0d44b4828a444d769a90f2867dce1 | baidu/Quanlse | Quanlse/Utils/Benchmark.py | [
"Apache-2.0"
] | Python | stateTruthTable | ndarray | def stateTruthTable(unitary, qubitNum, sysLevel, initialBasisList=None, finalBasisList=None) -> ndarray:
"""
Generate the truth table of a quantum gate contains the probability of the system being in each
possible basis states at the end of an operation for each possible initial state.
:param unitary: ... |
Generate the truth table of a quantum gate contains the probability of the system being in each
possible basis states at the end of an operation for each possible initial state.
:param unitary: the unitary matrix
:param qubitNum: the number of qubits
:param sysLevel: the energy level of the system... | Generate the truth table of a quantum gate contains the probability of the system being in each
possible basis states at the end of an operation for each possible initial state. | [
"Generate",
"the",
"truth",
"table",
"of",
"a",
"quantum",
"gate",
"contains",
"the",
"probability",
"of",
"the",
"system",
"being",
"in",
"each",
"possible",
"basis",
"states",
"at",
"the",
"end",
"of",
"an",
"operation",
"for",
"each",
"possible",
"initial... | def stateTruthTable(unitary, qubitNum, sysLevel, initialBasisList=None, finalBasisList=None) -> ndarray:
if not isinstance(sysLevel, int):
raise ArgumentError('This function currently only supports an integer system level as input.')
resultMatrix = []
if initialBasisList is None:
initialBasi... | [
"def",
"stateTruthTable",
"(",
"unitary",
",",
"qubitNum",
",",
"sysLevel",
",",
"initialBasisList",
"=",
"None",
",",
"finalBasisList",
"=",
"None",
")",
"->",
"ndarray",
":",
"if",
"not",
"isinstance",
"(",
"sysLevel",
",",
"int",
")",
":",
"raise",
"Arg... | Generate the truth table of a quantum gate contains the probability of the system being in each
possible basis states at the end of an operation for each possible initial state. | [
"Generate",
"the",
"truth",
"table",
"of",
"a",
"quantum",
"gate",
"contains",
"the",
"probability",
"of",
"the",
"system",
"being",
"in",
"each",
"possible",
"basis",
"states",
"at",
"the",
"end",
"of",
"an",
"operation",
"for",
"each",
"possible",
"initial... | [
"\"\"\"\n Generate the truth table of a quantum gate contains the probability of the system being in each\n possible basis states at the end of an operation for each possible initial state.\n\n :param unitary: the unitary matrix\n :param qubitNum: the number of qubits\n :param sysLevel: the energy le... | [
{
"param": "unitary",
"type": null
},
{
"param": "qubitNum",
"type": null
},
{
"param": "sysLevel",
"type": null
},
{
"param": "initialBasisList",
"type": null
},
{
"param": "finalBasisList",
"type": null
}
] | {
"returns": [
{
"docstring": "the population matrix",
"docstring_tokens": [
"the",
"population",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "unitary",
"type": null,
"docstring": "the unitary matrix",
... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotBarGraph | None | def plotBarGraph(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
color: str = 'blue', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
-> None:
"""
Plot bar graphs with given X labels and Y values lists, this function also supports... |
Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below.
:param x: a list of X labels for the graphs
:param y: a list of Y coordinates for the bar graphs
:param title: overall title of the graph
:param xLabel: label on X axis... | Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below. | [
"Plot",
"bar",
"graphs",
"with",
"given",
"X",
"labels",
"and",
"Y",
"values",
"lists",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | def plotBarGraph(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
color: str = 'blue', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
-> None:
cMap = colorMap()
xList = numpy.arange(len(y))
plt.figure(1, (15, 10))
plt.rcPa... | [
"def",
"plotBarGraph",
"(",
"x",
":",
"List",
"[",
"Any",
"]",
",",
"y",
":",
"List",
"[",
"float",
"]",
",",
"title",
":",
"str",
"=",
"\"\"",
",",
"xLabel",
":",
"str",
"=",
"\"\"",
",",
"yLabel",
":",
"str",
"=",
"\"\"",
",",
"color",
":",
... | Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below. | [
"Plot",
"bar",
"graphs",
"with",
"given",
"X",
"labels",
"and",
"Y",
"values",
"lists",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | [
"\"\"\"\n Plot bar graphs with given X labels and Y values lists, this function also supports other optional\n parameters as shown below.\n\n :param x: a list of X labels for the graphs\n :param y: a list of Y coordinates for the bar graphs\n :param title: overall title of the graph\n :param xLabe... | [
{
"param": "x",
"type": "List[Any]"
},
{
"param": "y",
"type": "List[float]"
},
{
"param": "title",
"type": "str"
},
{
"param": "xLabel",
"type": "str"
},
{
"param": "yLabel",
"type": "str"
},
{
"param": "color",
"type": "str"
},
{
"param":... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "x",
"type": "List[Any]",
"docstring": "a list of X labels for the graphs",
"docstring_tokens": [
"a",
... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotLineGraph | None | def plotLineGraph(x: Union[List[List[float]], List[float]], y: Union[List[List[float]], List[float]], title: str = "",
xLabel: str = "", yLabel: str = "",
legends: List[str] = None, color: List[str] = None,
lineWidth: float = 2.0,
fontSize: float =... |
Plot line graph, with the given 2-dimensional lists of X and Y values,
this function also supports other optional parameters as shown below.
:param x: a 2-dim list of X coordinates for the line graphs
:param y: a 2-dim list of Y coordinates for the line graphs
:param title: overall title of the gr... | Plot line graph, with the given 2-dimensional lists of X and Y values,
this function also supports other optional parameters as shown below. | [
"Plot",
"line",
"graph",
"with",
"the",
"given",
"2",
"-",
"dimensional",
"lists",
"of",
"X",
"and",
"Y",
"values",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | def plotLineGraph(x: Union[List[List[float]], List[float]], y: Union[List[List[float]], List[float]], title: str = "",
xLabel: str = "", yLabel: str = "",
legends: List[str] = None, color: List[str] = None,
lineWidth: float = 2.0,
fontSize: float =... | [
"def",
"plotLineGraph",
"(",
"x",
":",
"Union",
"[",
"List",
"[",
"List",
"[",
"float",
"]",
"]",
",",
"List",
"[",
"float",
"]",
"]",
",",
"y",
":",
"Union",
"[",
"List",
"[",
"List",
"[",
"float",
"]",
"]",
",",
"List",
"[",
"float",
"]",
"... | Plot line graph, with the given 2-dimensional lists of X and Y values,
this function also supports other optional parameters as shown below. | [
"Plot",
"line",
"graph",
"with",
"the",
"given",
"2",
"-",
"dimensional",
"lists",
"of",
"X",
"and",
"Y",
"values",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | [
"\"\"\"\n Plot line graph, with the given 2-dimensional lists of X and Y values,\n this function also supports other optional parameters as shown below.\n\n :param x: a 2-dim list of X coordinates for the line graphs\n :param y: a 2-dim list of Y coordinates for the line graphs\n :param title: overal... | [
{
"param": "x",
"type": "Union[List[List[float]], List[float]]"
},
{
"param": "y",
"type": "Union[List[List[float]], List[float]]"
},
{
"param": "title",
"type": "str"
},
{
"param": "xLabel",
"type": "str"
},
{
"param": "yLabel",
"type": "str"
},
{
"pa... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "x",
"type": "Union[List[List[float]], List[float]]",
"docstring": "a 2-dim list of X coordinates for the line graphs",
... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotProcess | None | def plotProcess(chi: Dict[str, Any]) -> None:
"""
Generate the Process Tomography Plot in 3D. This function takes a mandatory dictionary Chi,
which is directly generated from processTomography.
:param chi: Chi Dictionary that is obtained from processTomography
:return: None
"""
# setup the... |
Generate the Process Tomography Plot in 3D. This function takes a mandatory dictionary Chi,
which is directly generated from processTomography.
:param chi: Chi Dictionary that is obtained from processTomography
:return: None
| Generate the Process Tomography Plot in 3D. This function takes a mandatory dictionary Chi,
which is directly generated from processTomography. | [
"Generate",
"the",
"Process",
"Tomography",
"Plot",
"in",
"3D",
".",
"This",
"function",
"takes",
"a",
"mandatory",
"dictionary",
"Chi",
"which",
"is",
"directly",
"generated",
"from",
"processTomography",
"."
] | def plotProcess(chi: Dict[str, Any]) -> None:
fig = plt.figure(figsize=(12, 6))
ax2 = fig.add_subplot(121, projection='3d')
ax1 = fig.add_subplot(122, projection='3d')
numX = len(chi['XLabel'])
numY = len(chi['YLabel'])
_x = numpy.arange(numX)
_y = numpy.arange(numY)
_xx, _yy = numpy.mes... | [
"def",
"plotProcess",
"(",
"chi",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"12",
",",
"6",
")",
")",
"ax2",
"=",
"fig",
".",
"add_subplot",
"(",
"121",
",",
... | Generate the Process Tomography Plot in 3D. | [
"Generate",
"the",
"Process",
"Tomography",
"Plot",
"in",
"3D",
"."
] | [
"\"\"\"\n Generate the Process Tomography Plot in 3D. This function takes a mandatory dictionary Chi,\n which is directly generated from processTomography.\n\n :param chi: Chi Dictionary that is obtained from processTomography\n :return: None\n \"\"\"",
"# setup the figure and axes",
"# fake data... | [
{
"param": "chi",
"type": "Dict[str, Any]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "chi",
"type": "Dict[str, Any]",
"docstring": "Chi Dictionary that is obtained from processTomography",
"docstring_t... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotHeatMap | None | def plotHeatMap(matrix: numpy.ndarray, xTicks: List = None, yTicks: List = None, xLabel: str = "", yLabel: str = "",
useLog: bool = False, cMap: str = "cividis") -> None:
"""
Plot a 2D heat map.
:param matrix: the values of each square
:param xTicks: ticks on X axis
:param yTicks: t... |
Plot a 2D heat map.
:param matrix: the values of each square
:param xTicks: ticks on X axis
:param yTicks: ticks on Y axis
:param xLabel: label on X axis
:param yLabel: label on Y axis
:param useLog: format ticks on a log scale
:param cMap: indicate color_map
:return: None
| Plot a 2D heat map. | [
"Plot",
"a",
"2D",
"heat",
"map",
"."
] | def plotHeatMap(matrix: numpy.ndarray, xTicks: List = None, yTicks: List = None, xLabel: str = "", yLabel: str = "",
useLog: bool = False, cMap: str = "cividis") -> None:
ax = plt.gca()
if useLog:
_matrix = numpy.log10(matrix)
im = ax.imshow(_matrix, cmap=cMap, vmin=-10, vmax=0)
... | [
"def",
"plotHeatMap",
"(",
"matrix",
":",
"numpy",
".",
"ndarray",
",",
"xTicks",
":",
"List",
"=",
"None",
",",
"yTicks",
":",
"List",
"=",
"None",
",",
"xLabel",
":",
"str",
"=",
"\"\"",
",",
"yLabel",
":",
"str",
"=",
"\"\"",
",",
"useLog",
":",... | Plot a 2D heat map. | [
"Plot",
"a",
"2D",
"heat",
"map",
"."
] | [
"\"\"\"\n Plot a 2D heat map.\n\n :param matrix: the values of each square\n :param xTicks: ticks on X axis\n :param yTicks: ticks on Y axis\n :param xLabel: label on X axis\n :param yLabel: label on Y axis\n :param useLog: format ticks on a log scale\n :param cMap: indicate color_map\n :... | [
{
"param": "matrix",
"type": "numpy.ndarray"
},
{
"param": "xTicks",
"type": "List"
},
{
"param": "yTicks",
"type": "List"
},
{
"param": "xLabel",
"type": "str"
},
{
"param": "yLabel",
"type": "str"
},
{
"param": "useLog",
"type": "bool"
},
{
... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "matrix",
"type": "numpy.ndarray",
"docstring": "the values of each square",
"docstring_tokens": [
"the",
... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotIonPosition | None | def plotIonPosition(ionPos: List[Any]) -> None:
"""
Plot the position of the ion in the equilibrium.
:param ionPos: the positions of the ions.
:return: None
"""
plt.figure()
plt.scatter(numpy.array(ionPos), numpy.zeros(numpy.size(ionPos)), s=100)
plt.title('Ions equilibrium position', f... |
Plot the position of the ion in the equilibrium.
:param ionPos: the positions of the ions.
:return: None
| Plot the position of the ion in the equilibrium. | [
"Plot",
"the",
"position",
"of",
"the",
"ion",
"in",
"the",
"equilibrium",
"."
] | def plotIonPosition(ionPos: List[Any]) -> None:
plt.figure()
plt.scatter(numpy.array(ionPos), numpy.zeros(numpy.size(ionPos)), s=100)
plt.title('Ions equilibrium position', fontsize='large', fontweight='bold')
font2 = {'family': 'Times New Roman',
'weight': 'bold',
'size': 15,
... | [
"def",
"plotIonPosition",
"(",
"ionPos",
":",
"List",
"[",
"Any",
"]",
")",
"->",
"None",
":",
"plt",
".",
"figure",
"(",
")",
"plt",
".",
"scatter",
"(",
"numpy",
".",
"array",
"(",
"ionPos",
")",
",",
"numpy",
".",
"zeros",
"(",
"numpy",
".",
"... | Plot the position of the ion in the equilibrium. | [
"Plot",
"the",
"position",
"of",
"the",
"ion",
"in",
"the",
"equilibrium",
"."
] | [
"\"\"\"\n Plot the position of the ion in the equilibrium.\n\n :param ionPos: the positions of the ions.\n :return: None\n \"\"\""
] | [
{
"param": "ionPos",
"type": "List[Any]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "ionPos",
"type": "List[Any]",
"docstring": "the positions of the ions.",
"docstring_tokens": [
"the",
... |
2cf3599a41cebc0e608b915fec5a942bb52352b9 | baidu/Quanlse | Quanlse/Utils/Plot.py | [
"Apache-2.0"
] | Python | plotPop | None | def plotPop(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
color: str = 'purple', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
-> None:
"""
Plot bar graphs with given X labels and Y values lists, this function also supports ot... |
Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below.
:param x: a list of X labels for the graphs
:param y: a list of Y coordinates for the bar graphs
:param title: overall title of the graph
:param xLabel: label on X axis... | Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below. | [
"Plot",
"bar",
"graphs",
"with",
"given",
"X",
"labels",
"and",
"Y",
"values",
"lists",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | def plotPop(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
color: str = 'purple', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
-> None:
cMap = colorMap()
xList = numpy.arange(len(y))
plt.figure(1, (15, 10))
plt.rcParam... | [
"def",
"plotPop",
"(",
"x",
":",
"List",
"[",
"Any",
"]",
",",
"y",
":",
"List",
"[",
"float",
"]",
",",
"title",
":",
"str",
"=",
"\"\"",
",",
"xLabel",
":",
"str",
"=",
"\"\"",
",",
"yLabel",
":",
"str",
"=",
"\"\"",
",",
"color",
":",
"str... | Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below. | [
"Plot",
"bar",
"graphs",
"with",
"given",
"X",
"labels",
"and",
"Y",
"values",
"lists",
"this",
"function",
"also",
"supports",
"other",
"optional",
"parameters",
"as",
"shown",
"below",
"."
] | [
"\"\"\"\n Plot bar graphs with given X labels and Y values lists, this function also supports other optional\n parameters as shown below.\n\n :param x: a list of X labels for the graphs\n :param y: a list of Y coordinates for the bar graphs\n :param title: overall title of the graph\n :param xLabe... | [
{
"param": "x",
"type": "List[Any]"
},
{
"param": "y",
"type": "List[float]"
},
{
"param": "title",
"type": "str"
},
{
"param": "xLabel",
"type": "str"
},
{
"param": "yLabel",
"type": "str"
},
{
"param": "color",
"type": "str"
},
{
"param":... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "x",
"type": "List[Any]",
"docstring": "a list of X labels for the graphs",
"docstring_tokens": [
"a",
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteOptimize1Qubit | Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]] | def remoteOptimize1Qubit(ham: QHam, uGoal: Union[ndarray, List[ndarray]], targetInfid, depth=3) \
-> Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]]:
"""
Optimize an arbitrary superconducting single-qubit gate by Quanlse cloud service.
:param ham: the QHamiltonian object.
:param uGoal... |
Optimize an arbitrary superconducting single-qubit gate by Quanlse cloud service.
:param ham: the QHamiltonian object.
:param uGoal: the goal unitary matrices for optimization.
:param depth: maximum circuit depth (pulse number).
:param targetInfid: target infidelity.
:return: a tuple containin... | Optimize an arbitrary superconducting single-qubit gate by Quanlse cloud service. | [
"Optimize",
"an",
"arbitrary",
"superconducting",
"single",
"-",
"qubit",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | def remoteOptimize1Qubit(ham: QHam, uGoal: Union[ndarray, List[ndarray]], targetInfid, depth=3) \
-> Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]]:
args = [ham.dump(), numpyMatrixToDictMatrix(uGoal)]
kwargs = {"targetInfid": targetInfid, "depth": depth}
origin = rpcCall("1Qubit", args, k... | [
"def",
"remoteOptimize1Qubit",
"(",
"ham",
":",
"QHam",
",",
"uGoal",
":",
"Union",
"[",
"ndarray",
",",
"List",
"[",
"ndarray",
"]",
"]",
",",
"targetInfid",
",",
"depth",
"=",
"3",
")",
"->",
"Union",
"[",
"Tuple",
"[",
"QJob",
",",
"float",
"]",
... | Optimize an arbitrary superconducting single-qubit gate by Quanlse cloud service. | [
"Optimize",
"an",
"arbitrary",
"superconducting",
"single",
"-",
"qubit",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | [
"\"\"\"\n Optimize an arbitrary superconducting single-qubit gate by Quanlse cloud service.\n\n :param ham: the QHamiltonian object.\n :param uGoal: the goal unitary matrices for optimization.\n :param depth: maximum circuit depth (pulse number).\n :param targetInfid: target infidelity.\n :return:... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "uGoal",
"type": "Union[ndarray, List[ndarray]]"
},
{
"param": "targetInfid",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [
{
"docstring": "a tuple containing the QJob list and infidelity list.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"QJob",
"list",
"and",
"infidelity",
"list",
"."
],
"type": null
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.