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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteOptimize1QubitGRAPE | Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]] | def remoteOptimize1QubitGRAPE(ham: QHam, uGoal: Union[ndarray, List[ndarray]], tg: int = 20, iterate: int = 150,
xyzPulses: List[int] = None) -> Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]]:
"""
Optimize a single-qubit gate using Gradient Ascent Pulse Engineering.
... |
Optimize a single-qubit gate using Gradient Ascent Pulse Engineering.
:param ham: the QHamiltonian object.
:param uGoal: the target unitary.
:param tg: gate time.
:param iterate: max number of iteration.
:param xyzPulses: a list of three integers indicating the numbers of
... | Optimize a single-qubit gate using Gradient Ascent Pulse Engineering. | [
"Optimize",
"a",
"single",
"-",
"qubit",
"gate",
"using",
"Gradient",
"Ascent",
"Pulse",
"Engineering",
"."
] | def remoteOptimize1QubitGRAPE(ham: QHam, uGoal: Union[ndarray, List[ndarray]], tg: int = 20, iterate: int = 150,
xyzPulses: List[int] = None) -> Union[Tuple[QJob, float], Tuple[List[QJob], List[float]]]:
args = [ham.dump(), numpyMatrixToDictMatrix(uGoal)]
kwargs = {
"tg": t... | [
"def",
"remoteOptimize1QubitGRAPE",
"(",
"ham",
":",
"QHam",
",",
"uGoal",
":",
"Union",
"[",
"ndarray",
",",
"List",
"[",
"ndarray",
"]",
"]",
",",
"tg",
":",
"int",
"=",
"20",
",",
"iterate",
":",
"int",
"=",
"150",
",",
"xyzPulses",
":",
"List",
... | Optimize a single-qubit gate using Gradient Ascent Pulse Engineering. | [
"Optimize",
"a",
"single",
"-",
"qubit",
"gate",
"using",
"Gradient",
"Ascent",
"Pulse",
"Engineering",
"."
] | [
"\"\"\"\n Optimize a single-qubit gate using Gradient Ascent Pulse Engineering.\n\n :param ham: the QHamiltonian object.\n :param uGoal: the target unitary.\n :param tg: gate time.\n :param iterate: max number of iteration.\n :param xyzPulses: a list of three integers indicating the numbers of\n ... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "uGoal",
"type": "Union[ndarray, List[ndarray]]"
},
{
"param": "tg",
"type": "int"
},
{
"param": "iterate",
"type": "int"
},
{
"param": "xyzPulses",
"type": "List[int]"
}
] | {
"returns": [
{
"docstring": "a tuple containing the QJob list and infidelity list.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"QJob",
"list",
"and",
"infidelity",
"list",
"."
],
"type": null
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteOptimizeCr | Tuple[QJob, float] | def remoteOptimizeCr(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
"""
Optimize a superconducting Cross-Resonance gate by Quanlse Cloud Service.
:param ham: the QHamiltonian object.
:param aB... |
Optimize a superconducting Cross-Resonance gate by Quanlse Cloud Service.
:param ham: the QHamiltonian object.
:param aBound: the optimization bound of pulse amplitude.
:param tg: gate time.
:param maxIter: max number of iteration.
:param targetInfidelity: the target infidelity.
:return: a... | Optimize a superconducting Cross-Resonance gate by Quanlse Cloud Service. | [
"Optimize",
"a",
"superconducting",
"Cross",
"-",
"Resonance",
"gate",
"by",
"Quanlse",
"Cloud",
"Service",
"."
] | def remoteOptimizeCr(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
args = [ham.dump()]
kwargs = {
"aBound": aBound,
"tg": tg,
"maxIter": maxIter,
"targetInfidelity": ta... | [
"def",
"remoteOptimizeCr",
"(",
"ham",
":",
"QHam",
",",
"aBound",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
"=",
"None",
",",
"tg",
":",
"float",
"=",
"200",
",",
"maxIter",
":",
"int",
"=",
"5",
",",
"targetInfidelity",
":",
"float",
"=",
"0... | Optimize a superconducting Cross-Resonance gate by Quanlse Cloud Service. | [
"Optimize",
"a",
"superconducting",
"Cross",
"-",
"Resonance",
"gate",
"by",
"Quanlse",
"Cloud",
"Service",
"."
] | [
"\"\"\"\n Optimize a superconducting Cross-Resonance gate by Quanlse Cloud Service.\n\n :param ham: the QHamiltonian object.\n :param aBound: the optimization bound of pulse amplitude.\n :param tg: gate time.\n :param maxIter: max number of iteration.\n :param targetInfidelity: the target infideli... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "aBound",
"type": "Tuple[float, float]"
},
{
"param": "tg",
"type": "float"
},
{
"param": "maxIter",
"type": "int"
},
{
"param": "targetInfidelity",
"type": "float"
}
] | {
"returns": [
{
"docstring": "a tuple containing the return Hamiltonian and infidelity.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"return",
"Hamiltonian",
"and",
"infidelity",
"."
],
"type": null
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteOptimizeCz | Tuple[QJob, float] | def remoteOptimizeCz(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
"""
Optimize a superconducting Controlled-Z gate by Quanlse Cloud Service.
:param ham: the QHamiltonian object.
:param aBoun... |
Optimize a superconducting Controlled-Z gate by Quanlse Cloud Service.
:param ham: the QHamiltonian object.
:param aBound: the optimization bound of pulse amplitude.
:param tg: gate time.
:param maxIter: max number of iteration.
:param targetInfidelity: the target infidelity.
:return: a tu... | Optimize a superconducting Controlled-Z gate by Quanlse Cloud Service. | [
"Optimize",
"a",
"superconducting",
"Controlled",
"-",
"Z",
"gate",
"by",
"Quanlse",
"Cloud",
"Service",
"."
] | def remoteOptimizeCz(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
args = [ham.dump()]
kwargs = {
"aBound": aBound,
"tg": tg,
"maxIter": maxIter,
"targetInfidelity": ta... | [
"def",
"remoteOptimizeCz",
"(",
"ham",
":",
"QHam",
",",
"aBound",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
"=",
"None",
",",
"tg",
":",
"float",
"=",
"200",
",",
"maxIter",
":",
"int",
"=",
"5",
",",
"targetInfidelity",
":",
"float",
"=",
"0... | Optimize a superconducting Controlled-Z gate by Quanlse Cloud Service. | [
"Optimize",
"a",
"superconducting",
"Controlled",
"-",
"Z",
"gate",
"by",
"Quanlse",
"Cloud",
"Service",
"."
] | [
"\"\"\"\n Optimize a superconducting Controlled-Z gate by Quanlse Cloud Service.\n\n :param ham: the QHamiltonian object.\n :param aBound: the optimization bound of pulse amplitude.\n :param tg: gate time.\n :param maxIter: max number of iteration.\n :param targetInfidelity: the target infidelity.... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "aBound",
"type": "Tuple[float, float]"
},
{
"param": "tg",
"type": "float"
},
{
"param": "maxIter",
"type": "int"
},
{
"param": "targetInfidelity",
"type": "float"
}
] | {
"returns": [
{
"docstring": "a tuple containing the return Hamiltonian and infidelity.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"return",
"Hamiltonian",
"and",
"infidelity",
"."
],
"type": null
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteOptimizeISWAP | Tuple[QJob, float] | def remoteOptimizeISWAP(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
"""
Optimize a superconducting iSWAP gate by Quanlse cloud service.
:param ham: the QHamiltonian object.
:param aBound... |
Optimize a superconducting iSWAP gate by Quanlse cloud service.
:param ham: the QHamiltonian object.
:param aBound: the optimization bound of pulse amplitude.
:param tg: gate time.
:param maxIter: max number of iteration.
:param targetInfidelity: the target infidelity.
:return: a tuple con... | Optimize a superconducting iSWAP gate by Quanlse cloud service. | [
"Optimize",
"a",
"superconducting",
"iSWAP",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | def remoteOptimizeISWAP(ham: QHam, aBound: Tuple[float, float] = None, tg: float = 200, maxIter: int = 5,
targetInfidelity: float = 0.01) -> Tuple[QJob, float]:
args = [ham.dump()]
kwargs = {
"aBound": aBound,
"tg": tg,
"maxIter": maxIter,
"targetInfidelit... | [
"def",
"remoteOptimizeISWAP",
"(",
"ham",
":",
"QHam",
",",
"aBound",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
"=",
"None",
",",
"tg",
":",
"float",
"=",
"200",
",",
"maxIter",
":",
"int",
"=",
"5",
",",
"targetInfidelity",
":",
"float",
"=",
... | Optimize a superconducting iSWAP gate by Quanlse cloud service. | [
"Optimize",
"a",
"superconducting",
"iSWAP",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | [
"\"\"\"\n Optimize a superconducting iSWAP gate by Quanlse cloud service.\n\n :param ham: the QHamiltonian object.\n :param aBound: the optimization bound of pulse amplitude.\n :param tg: gate time.\n :param maxIter: max number of iteration.\n :param targetInfidelity: the target infidelity.\n :... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "aBound",
"type": "Tuple[float, float]"
},
{
"param": "tg",
"type": "float"
},
{
"param": "maxIter",
"type": "int"
},
{
"param": "targetInfidelity",
"type": "float"
}
] | {
"returns": [
{
"docstring": "a tuple containing the return Hamiltonian and infidelity.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"return",
"Hamiltonian",
"and",
"infidelity",
"."
],
"type": null
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteIonOptimize1Qubit | Tuple[float, float, ndarray] | def remoteIonOptimize1Qubit(axial: str, theta: float, tg: float) -> Tuple[float, float, ndarray]:
"""
Optimize a superconducting iSWAP gate by Quanlse cloud service.
:param axial: the rotating axial, 'ionRx' or 'ionRy'.
:param theta: the angle of the rotation operation.
:param tg: gate time.
:r... |
Optimize a superconducting iSWAP gate by Quanlse cloud service.
:param axial: the rotating axial, 'ionRx' or 'ionRy'.
:param theta: the angle of the rotation operation.
:param tg: gate time.
:return: a tuple containing the return Hamiltonian and infidelity.
| Optimize a superconducting iSWAP gate by Quanlse cloud service. | [
"Optimize",
"a",
"superconducting",
"iSWAP",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | def remoteIonOptimize1Qubit(axial: str, theta: float, tg: float) -> Tuple[float, float, ndarray]:
args = [axial, theta, tg]
kwargs = {}
origin = rpcCall("Ion1Qubit", args, kwargs)
return origin["a"], origin["b"], dictMatrixToNumpyMatrix(origin["qam"], complex) | [
"def",
"remoteIonOptimize1Qubit",
"(",
"axial",
":",
"str",
",",
"theta",
":",
"float",
",",
"tg",
":",
"float",
")",
"->",
"Tuple",
"[",
"float",
",",
"float",
",",
"ndarray",
"]",
":",
"args",
"=",
"[",
"axial",
",",
"theta",
",",
"tg",
"]",
"kwa... | Optimize a superconducting iSWAP gate by Quanlse cloud service. | [
"Optimize",
"a",
"superconducting",
"iSWAP",
"gate",
"by",
"Quanlse",
"cloud",
"service",
"."
] | [
"\"\"\"\n Optimize a superconducting iSWAP gate by Quanlse cloud service.\n\n :param axial: the rotating axial, 'ionRx' or 'ionRy'.\n :param theta: the angle of the rotation operation.\n :param tg: gate time.\n :return: a tuple containing the return Hamiltonian and infidelity.\n \"\"\""
] | [
{
"param": "axial",
"type": "str"
},
{
"param": "theta",
"type": "float"
},
{
"param": "tg",
"type": "float"
}
] | {
"returns": [
{
"docstring": "a tuple containing the return Hamiltonian and infidelity.",
"docstring_tokens": [
"a",
"tuple",
"containing",
"the",
"return",
"Hamiltonian",
"and",
"infidelity",
"."
],
"type": null
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteIonMS | Tuple[Any, Any] | def remoteIonMS(ionNumber: int, atomMass: int, tg: float, omega: Tuple[float, float], ionIndex: Tuple[int, int],
phononMode: str = 'axial', pulseWave: str = 'squareWave') -> Tuple[Any, Any]:
"""
Generate the Molmer-Sorensen gate in trapped ion
:param ionNumber: the number of ions.
:para... |
Generate the Molmer-Sorensen gate in trapped ion
:param ionNumber: the number of ions.
:param atomMass: the atomic mass of the ion.
:param tg: gate time.
:param omega: 1-dimensional angular frequency of the potential trap.
:param ionIndex: the index of the two ions.
:param phononMode: the ... | Generate the Molmer-Sorensen gate in trapped ion | [
"Generate",
"the",
"Molmer",
"-",
"Sorensen",
"gate",
"in",
"trapped",
"ion"
] | def remoteIonMS(ionNumber: int, atomMass: int, tg: float, omega: Tuple[float, float], ionIndex: Tuple[int, int],
phononMode: str = 'axial', pulseWave: str = 'squareWave') -> Tuple[Any, Any]:
args = [ionNumber, atomMass, tg, omega, ionIndex]
kwargs = {
"phononMode": phononMode,
"p... | [
"def",
"remoteIonMS",
"(",
"ionNumber",
":",
"int",
",",
"atomMass",
":",
"int",
",",
"tg",
":",
"float",
",",
"omega",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
",",
"ionIndex",
":",
"Tuple",
"[",
"int",
",",
"int",
"]",
",",
"phononMode",
":... | Generate the Molmer-Sorensen gate in trapped ion | [
"Generate",
"the",
"Molmer",
"-",
"Sorensen",
"gate",
"in",
"trapped",
"ion"
] | [
"\"\"\"\n Generate the Molmer-Sorensen gate in trapped ion\n\n :param ionNumber: the number of ions.\n :param atomMass: the atomic mass of the ion.\n :param tg: gate time.\n :param omega: 1-dimensional angular frequency of the potential trap.\n :param ionIndex: the index of the two ions.\n :par... | [
{
"param": "ionNumber",
"type": "int"
},
{
"param": "atomMass",
"type": "int"
},
{
"param": "tg",
"type": "float"
},
{
"param": "omega",
"type": "Tuple[float, float]"
},
{
"param": "ionIndex",
"type": "Tuple[int, int]"
},
{
"param": "phononMode",
"... | {
"returns": [
{
"docstring": "dict type result and ndarray type unitary.",
"docstring_tokens": [
"dict",
"type",
"result",
"and",
"ndarray",
"type",
"unitary",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
fea727eb36c7086d269d7ae000c2362dfa892df5 | baidu/Quanlse | Quanlse/remoteOptimizer.py | [
"Apache-2.0"
] | Python | remoteIonGeneralMS | Tuple[Dict[str, Any], ndarray] | def remoteIonGeneralMS(gatePair: List[List[int]], args1: Tuple[int, int, float, float, str],
args2: Tuple[int, float, float]) -> Tuple[Dict[str, Any], ndarray]:
"""
Generate general Molmer-Sorensen gate and GHZ state in trapped ion
:param gatePair: the gate pair in ion chain.
:pa... |
Generate general Molmer-Sorensen gate and GHZ state in trapped ion
:param gatePair: the gate pair in ion chain.
:param args1:
args1[0]: the number of ions;
args1[1]: the atom mass or atom specie;
args1[2]: the XY trapped potential frequency;
args1[3]: the Z trapped potential frequency;... | Generate general Molmer-Sorensen gate and GHZ state in trapped ion | [
"Generate",
"general",
"Molmer",
"-",
"Sorensen",
"gate",
"and",
"GHZ",
"state",
"in",
"trapped",
"ion"
] | def remoteIonGeneralMS(gatePair: List[List[int]], args1: Tuple[int, int, float, float, str],
args2: Tuple[int, float, float]) -> Tuple[Dict[str, Any], ndarray]:
args = [gatePair, args1, args2]
kwargs = {}
origin = rpcCall("IonGeneralMS", args, kwargs)
return origin['result'], dict... | [
"def",
"remoteIonGeneralMS",
"(",
"gatePair",
":",
"List",
"[",
"List",
"[",
"int",
"]",
"]",
",",
"args1",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"float",
",",
"float",
",",
"str",
"]",
",",
"args2",
":",
"Tuple",
"[",
"int",
",",
"float",
"... | Generate general Molmer-Sorensen gate and GHZ state in trapped ion | [
"Generate",
"general",
"Molmer",
"-",
"Sorensen",
"gate",
"and",
"GHZ",
"state",
"in",
"trapped",
"ion"
] | [
"\"\"\"\n Generate general Molmer-Sorensen gate and GHZ state in trapped ion\n\n :param gatePair: the gate pair in ion chain.\n :param args1:\n args1[0]: the number of ions;\n args1[1]: the atom mass or atom specie;\n args1[2]: the XY trapped potential frequency;\n args1[3]: the Z trapped p... | [
{
"param": "gatePair",
"type": "List[List[int]]"
},
{
"param": "args1",
"type": "Tuple[int, int, float, float, str]"
},
{
"param": "args2",
"type": "Tuple[int, float, float]"
}
] | {
"returns": [
{
"docstring": "dict type result and ndarray type unitary.",
"docstring_tokens": [
"dict",
"type",
"result",
"and",
"ndarray",
"type",
"unitary",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
b6328962b069ad388c64ff90fcc2e95c0bda0e5f | baidu/Quanlse | Quanlse/ErrorMitigation/Utils/Visualization.py | [
"Apache-2.0"
] | Python | polarVectorToState | np.ndarray | def polarVectorToState(vec) -> np.ndarray:
"""
From the polar vector representation to the state representation.
:param vec: polar vector, array_like, (3,)
:return: density matrix: ndarray, (2, 2)
"""
ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
return (... |
From the polar vector representation to the state representation.
:param vec: polar vector, array_like, (3,)
:return: density matrix: ndarray, (2, 2)
| From the polar vector representation to the state representation. | [
"From",
"the",
"polar",
"vector",
"representation",
"to",
"the",
"state",
"representation",
"."
] | def polarVectorToState(vec) -> np.ndarray:
ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
return (np.identity(2) + vec[0] * ops[0] + vec[1] * ops[1] + vec[2] * ops[2]) / 2 | [
"def",
"polarVectorToState",
"(",
"vec",
")",
"->",
"np",
".",
"ndarray",
":",
"ops",
"=",
"[",
"FixedGate",
".",
"X",
".",
"getMatrix",
"(",
")",
",",
"FixedGate",
".",
"Y",
".",
"getMatrix",
"(",
")",
",",
"FixedGate",
".",
"Z",
".",
"getMatrix",
... | From the polar vector representation to the state representation. | [
"From",
"the",
"polar",
"vector",
"representation",
"to",
"the",
"state",
"representation",
"."
] | [
"\"\"\"\n From the polar vector representation to the state representation.\n\n :param vec: polar vector, array_like, (3,)\n :return: density matrix: ndarray, (2, 2)\n \"\"\""
] | [
{
"param": "vec",
"type": null
}
] | {
"returns": [
{
"docstring": "density matrix: ndarray, (2, 2)",
"docstring_tokens": [
"density",
"matrix",
":",
"ndarray",
"(",
"2",
"2",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": ... |
b6328962b069ad388c64ff90fcc2e95c0bda0e5f | baidu/Quanlse | Quanlse/ErrorMitigation/Utils/Visualization.py | [
"Apache-2.0"
] | Python | stateToPolarVector | List | def stateToPolarVector(state) -> List:
"""
From the state representation to the polar vector representation.
:param state: state vector or density matrix
:return: polar vector
"""
ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
return [expect(ops[i], state)... |
From the state representation to the polar vector representation.
:param state: state vector or density matrix
:return: polar vector
| From the state representation to the polar vector representation. | [
"From",
"the",
"state",
"representation",
"to",
"the",
"polar",
"vector",
"representation",
"."
] | def stateToPolarVector(state) -> List:
ops = [FixedGate.X.getMatrix(), FixedGate.Y.getMatrix(), FixedGate.Z.getMatrix()]
return [expect(ops[i], state) for i in range(3)] | [
"def",
"stateToPolarVector",
"(",
"state",
")",
"->",
"List",
":",
"ops",
"=",
"[",
"FixedGate",
".",
"X",
".",
"getMatrix",
"(",
")",
",",
"FixedGate",
".",
"Y",
".",
"getMatrix",
"(",
")",
",",
"FixedGate",
".",
"Z",
".",
"getMatrix",
"(",
")",
"... | From the state representation to the polar vector representation. | [
"From",
"the",
"state",
"representation",
"to",
"the",
"polar",
"vector",
"representation",
"."
] | [
"\"\"\"\n From the state representation to the polar vector representation.\n\n :param state: state vector or density matrix\n :return: polar vector\n \"\"\""
] | [
{
"param": "state",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "state",
"type": null,
"docstring": "state vector or density matrix",
"docstring_tokens": [
"state",
... |
b6328962b069ad388c64ff90fcc2e95c0bda0e5f | baidu/Quanlse | Quanlse/ErrorMitigation/Utils/Visualization.py | [
"Apache-2.0"
] | Python | plotZNESequences | null | def plotZNESequences(expectationsRescaled: List[List], expectationsExtrapolated: List[List], expectationsIdeal: List,
fileName: str = None):
"""
Plot a figure that shows the extrapolated results and noise-rescaling results, with the X-axis
representing the size of quantum gate sequences... |
Plot a figure that shows the extrapolated results and noise-rescaling results, with the X-axis
representing the size of quantum gate sequences and the Y-axis representing the expectation
values of the given mechanical quantity.
:param expectationsRescaled: a series of noise-rescaling expectation value... | Plot a figure that shows the extrapolated results and noise-rescaling results, with the X-axis
representing the size of quantum gate sequences and the Y-axis representing the expectation
values of the given mechanical quantity. | [
"Plot",
"a",
"figure",
"that",
"shows",
"the",
"extrapolated",
"results",
"and",
"noise",
"-",
"rescaling",
"results",
"with",
"the",
"X",
"-",
"axis",
"representing",
"the",
"size",
"of",
"quantum",
"gate",
"sequences",
"and",
"the",
"Y",
"-",
"axis",
"re... | def plotZNESequences(expectationsRescaled: List[List], expectationsExtrapolated: List[List], expectationsIdeal: List,
fileName: str = None):
expectationsRescaled = np.array(expectationsRescaled).transpose()
expectationsExtrapolated = np.array(expectationsExtrapolated).transpose()
numSeq... | [
"def",
"plotZNESequences",
"(",
"expectationsRescaled",
":",
"List",
"[",
"List",
"]",
",",
"expectationsExtrapolated",
":",
"List",
"[",
"List",
"]",
",",
"expectationsIdeal",
":",
"List",
",",
"fileName",
":",
"str",
"=",
"None",
")",
":",
"expectationsResca... | Plot a figure that shows the extrapolated results and noise-rescaling results, with the X-axis
representing the size of quantum gate sequences and the Y-axis representing the expectation
values of the given mechanical quantity. | [
"Plot",
"a",
"figure",
"that",
"shows",
"the",
"extrapolated",
"results",
"and",
"noise",
"-",
"rescaling",
"results",
"with",
"the",
"X",
"-",
"axis",
"representing",
"the",
"size",
"of",
"quantum",
"gate",
"sequences",
"and",
"the",
"Y",
"-",
"axis",
"re... | [
"\"\"\"\n Plot a figure that shows the extrapolated results and noise-rescaling results, with the X-axis\n representing the size of quantum gate sequences and the Y-axis representing the expectation\n values of the given mechanical quantity.\n\n :param expectationsRescaled: a series of noise-rescaling e... | [
{
"param": "expectationsRescaled",
"type": "List[List]"
},
{
"param": "expectationsExtrapolated",
"type": "List[List]"
},
{
"param": "expectationsIdeal",
"type": "List"
},
{
"param": "fileName",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "expectationsRescaled",
"type": "List[List]",
"docstring": "a series of noise-rescaling expectation values with shape [n, ... |
b6328962b069ad388c64ff90fcc2e95c0bda0e5f | baidu/Quanlse | Quanlse/ErrorMitigation/Utils/Visualization.py | [
"Apache-2.0"
] | Python | plotRescaleHamiltonianPulse | <not_specific> | def plotRescaleHamiltonianPulse(rescaleCoes: List[float], hamList: List[QHamiltonian], numChannel: int,
figsize: tuple = (12, 6), title=None):
"""
Plot each pulse channel of a series of time-rescaling Hamiltonians. Suppose len(rescaleCoes)=r and numChannel=n,
this function wi... |
Plot each pulse channel of a series of time-rescaling Hamiltonians. Suppose len(rescaleCoes)=r and numChannel=n,
this function will show a figure including r*c subfigures which are
arranged in "r" rows and "c" columns.
:param rescaleCoes: rescaling coefficients
:param hamList: Hamiltonian list who... | Plot each pulse channel of a series of time-rescaling Hamiltonians. Suppose len(rescaleCoes)=r and numChannel=n,
this function will show a figure including r*c subfigures which are
arranged in "r" rows and "c" columns. | [
"Plot",
"each",
"pulse",
"channel",
"of",
"a",
"series",
"of",
"time",
"-",
"rescaling",
"Hamiltonians",
".",
"Suppose",
"len",
"(",
"rescaleCoes",
")",
"=",
"r",
"and",
"numChannel",
"=",
"n",
"this",
"function",
"will",
"show",
"a",
"figure",
"including"... | def plotRescaleHamiltonianPulse(rescaleCoes: List[float], hamList: List[QHamiltonian], numChannel: int,
figsize: tuple = (12, 6), title=None):
fig = plt.figure(figsize=figsize)
axes = []
colorList = plt.rcParams['axes.prop_cycle'].by_key()['color']
if len(rescaleCoes) != ... | [
"def",
"plotRescaleHamiltonianPulse",
"(",
"rescaleCoes",
":",
"List",
"[",
"float",
"]",
",",
"hamList",
":",
"List",
"[",
"QHamiltonian",
"]",
",",
"numChannel",
":",
"int",
",",
"figsize",
":",
"tuple",
"=",
"(",
"12",
",",
"6",
")",
",",
"title",
"... | Plot each pulse channel of a series of time-rescaling Hamiltonians. | [
"Plot",
"each",
"pulse",
"channel",
"of",
"a",
"series",
"of",
"time",
"-",
"rescaling",
"Hamiltonians",
"."
] | [
"\"\"\"\n Plot each pulse channel of a series of time-rescaling Hamiltonians. Suppose len(rescaleCoes)=r and numChannel=n,\n this function will show a figure including r*c subfigures which are\n arranged in \"r\" rows and \"c\" columns.\n\n :param rescaleCoes: rescaling coefficients\n :param hamList:... | [
{
"param": "rescaleCoes",
"type": "List[float]"
},
{
"param": "hamList",
"type": "List[QHamiltonian]"
},
{
"param": "numChannel",
"type": "int"
},
{
"param": "figsize",
"type": "tuple"
},
{
"param": "title",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "rescaleCoes",
"type": "List[float]",
"docstring": null,
"docstring_tokens": [
"None"
],
"defaul... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | dim | int | def dim(self) -> int:
"""
Return the dimension of the Hilbert space.
"""
_dim = 1
if isinstance(self.sysLevel, int):
_dim = self.sysLevel ** self.subSysNum
elif isinstance(self.sysLevel, list):
_dim = 1
for level in self.sysLevel:
... |
Return the dimension of the Hilbert space.
| Return the dimension of the Hilbert space. | [
"Return",
"the",
"dimension",
"of",
"the",
"Hilbert",
"space",
"."
] | def dim(self) -> int:
_dim = 1
if isinstance(self.sysLevel, int):
_dim = self.sysLevel ** self.subSysNum
elif isinstance(self.sysLevel, list):
_dim = 1
for level in self.sysLevel:
_dim = _dim * level
return _dim | [
"def",
"dim",
"(",
"self",
")",
"->",
"int",
":",
"_dim",
"=",
"1",
"if",
"isinstance",
"(",
"self",
".",
"sysLevel",
",",
"int",
")",
":",
"_dim",
"=",
"self",
".",
"sysLevel",
"**",
"self",
".",
"subSysNum",
"elif",
"isinstance",
"(",
"self",
"."... | Return the dimension of the Hilbert space. | [
"Return",
"the",
"dimension",
"of",
"the",
"Hilbert",
"space",
"."
] | [
"\"\"\"\n Return the dimension of the Hilbert space.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | qubitFreq | Dict[int, Union[int, float]] | def qubitFreq(self) -> Dict[int, Union[int, float]]:
"""
Return the eigenfrequency of each qubit in the system.
"""
return self._qubitFreq |
Return the eigenfrequency of each qubit in the system.
| Return the eigenfrequency of each qubit in the system. | [
"Return",
"the",
"eigenfrequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | def qubitFreq(self) -> Dict[int, Union[int, float]]:
return self._qubitFreq | [
"def",
"qubitFreq",
"(",
"self",
")",
"->",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
":",
"return",
"self",
".",
"_qubitFreq"
] | Return the eigenfrequency of each qubit in the system. | [
"Return",
"the",
"eigenfrequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | [
"\"\"\"\n Return the eigenfrequency of each qubit in the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | qubitFreq | null | def qubitFreq(self, value: Dict[int, Union[int, float]]):
"""
Return the eigen frequency of each qubit in the system, in 2 * pi * GHz.
"""
if len(value) != self.subSysNum:
raise Error.ArgumentError("The number of the frequencies and the number of qubits are not the same.")
... |
Return the eigen frequency of each qubit in the system, in 2 * pi * GHz.
| Return the eigen frequency of each qubit in the system, in 2 * pi * GHz. | [
"Return",
"the",
"eigen",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"in",
"2",
"*",
"pi",
"*",
"GHz",
"."
] | def qubitFreq(self, value: Dict[int, Union[int, float]]):
if len(value) != self.subSysNum:
raise Error.ArgumentError("The number of the frequencies and the number of qubits are not the same.")
self._qubitFreq = value
self.createQHamiltonian(frameMode=self.frameMode) | [
"def",
"qubitFreq",
"(",
"self",
",",
"value",
":",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
")",
":",
"if",
"len",
"(",
"value",
")",
"!=",
"self",
".",
"subSysNum",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
... | Return the eigen frequency of each qubit in the system, in 2 * pi * GHz. | [
"Return",
"the",
"eigen",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"in",
"2",
"*",
"pi",
"*",
"GHz",
"."
] | [
"\"\"\"\n Return the eigen frequency of each qubit in the system, in 2 * pi * GHz.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Dict[int, Union[int, float]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Dict[int, Union[int, float]]",
"docstring": null,
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | driveFreq | Dict[int, Union[int, float]] | def driveFreq(self) -> Dict[int, Union[int, float]]:
"""
Return the drive frequency of each qubit in the system.
"""
return self._qubitFreq |
Return the drive frequency of each qubit in the system.
| Return the drive frequency of each qubit in the system. | [
"Return",
"the",
"drive",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | def driveFreq(self) -> Dict[int, Union[int, float]]:
return self._qubitFreq | [
"def",
"driveFreq",
"(",
"self",
")",
"->",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
":",
"return",
"self",
".",
"_qubitFreq"
] | Return the drive frequency of each qubit in the system. | [
"Return",
"the",
"drive",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | [
"\"\"\"\n Return the drive frequency of each qubit in the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | driveFreq | null | def driveFreq(self, value: Dict[int, Union[int, float]]):
"""
Return the drive frequency of each qubit in the system, in 2 * pi * GHz.
"""
if len(value) != self.subSysNum:
raise Error.ArgumentError("The number of the frequencies and the number of qubits are not the same.")
... |
Return the drive frequency of each qubit in the system, in 2 * pi * GHz.
| Return the drive frequency of each qubit in the system, in 2 * pi * GHz. | [
"Return",
"the",
"drive",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"in",
"2",
"*",
"pi",
"*",
"GHz",
"."
] | def driveFreq(self, value: Dict[int, Union[int, float]]):
if len(value) != self.subSysNum:
raise Error.ArgumentError("The number of the frequencies and the number of qubits are not the same.")
self._driveFreq = value
self.createQHamiltonian(frameMode=self.frameMode) | [
"def",
"driveFreq",
"(",
"self",
",",
"value",
":",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
")",
":",
"if",
"len",
"(",
"value",
")",
"!=",
"self",
".",
"subSysNum",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
... | Return the drive frequency of each qubit in the system, in 2 * pi * GHz. | [
"Return",
"the",
"drive",
"frequency",
"of",
"each",
"qubit",
"in",
"the",
"system",
"in",
"2",
"*",
"pi",
"*",
"GHz",
"."
] | [
"\"\"\"\n Return the drive frequency of each qubit in the system, in 2 * pi * GHz.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Dict[int, Union[int, float]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Dict[int, Union[int, float]]",
"docstring": null,
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | qubitAnharm | Dict[int, Union[int, float]] | def qubitAnharm(self) -> Dict[int, Union[int, float]]:
"""
Return the anharmonicity of each qubit in the system.
"""
return self._qubitAnharm |
Return the anharmonicity of each qubit in the system.
| Return the anharmonicity of each qubit in the system. | [
"Return",
"the",
"anharmonicity",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | def qubitAnharm(self) -> Dict[int, Union[int, float]]:
return self._qubitAnharm | [
"def",
"qubitAnharm",
"(",
"self",
")",
"->",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
":",
"return",
"self",
".",
"_qubitAnharm"
] | Return the anharmonicity of each qubit in the system. | [
"Return",
"the",
"anharmonicity",
"of",
"each",
"qubit",
"in",
"the",
"system",
"."
] | [
"\"\"\"\n Return the anharmonicity of each qubit in the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | couplingMap | null | def couplingMap(self, value: Optional[Dict[Tuple, Union[int, float]]]):
"""
Return the coupling structure of the system.
"""
if self.couplingMap is not None:
indexList = [index for pair in value for index in pair]
for index in indexList:
if index n... |
Return the coupling structure of the system.
| Return the coupling structure of the system. | [
"Return",
"the",
"coupling",
"structure",
"of",
"the",
"system",
"."
] | def couplingMap(self, value: Optional[Dict[Tuple, Union[int, float]]]):
if self.couplingMap is not None:
indexList = [index for pair in value for index in pair]
for index in indexList:
if index not in range(self.subSysNum+1):
raise Error.ArgumentError(... | [
"def",
"couplingMap",
"(",
"self",
",",
"value",
":",
"Optional",
"[",
"Dict",
"[",
"Tuple",
",",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
"]",
")",
":",
"if",
"self",
".",
"couplingMap",
"is",
"not",
"None",
":",
"indexList",
"=",
"[",
"index"... | Return the coupling structure of the system. | [
"Return",
"the",
"coupling",
"structure",
"of",
"the",
"system",
"."
] | [
"\"\"\"\n Return the coupling structure of the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Optional[Dict[Tuple, Union[int, float]]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Optional[Dict[Tuple, Union[int, float]]]",
"docstr... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | T1 | Optional[Dict[int, Union[int, float, None]]] | def T1(self) -> Optional[Dict[int, Union[int, float, None]]]:
"""
Return the relaxation time T1 for each qubit.
"""
return self._T1 |
Return the relaxation time T1 for each qubit.
| Return the relaxation time T1 for each qubit. | [
"Return",
"the",
"relaxation",
"time",
"T1",
"for",
"each",
"qubit",
"."
] | def T1(self) -> Optional[Dict[int, Union[int, float, None]]]:
return self._T1 | [
"def",
"T1",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
",",
"None",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_T1"
] | Return the relaxation time T1 for each qubit. | [
"Return",
"the",
"relaxation",
"time",
"T1",
"for",
"each",
"qubit",
"."
] | [
"\"\"\"\n Return the relaxation time T1 for each qubit.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | T1 | null | def T1(self, value: Optional[Dict[int, Union[int, float, None]]]):
"""
Setter for the relaxation time T1 for each qubit.
"""
if value is not None:
for index, t1 in value.items():
if t1 < 0:
raise Error.ArgumentError("The value of T1 should ... |
Setter for the relaxation time T1 for each qubit.
| Setter for the relaxation time T1 for each qubit. | [
"Setter",
"for",
"the",
"relaxation",
"time",
"T1",
"for",
"each",
"qubit",
"."
] | def T1(self, value: Optional[Dict[int, Union[int, float, None]]]):
if value is not None:
for index, t1 in value.items():
if t1 < 0:
raise Error.ArgumentError("The value of T1 should be a positive real number.")
if index not in range(self.subSysNum)... | [
"def",
"T1",
"(",
"self",
",",
"value",
":",
"Optional",
"[",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
",",
"None",
"]",
"]",
"]",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"for",
"index",
",",
"t1",
"in",
"value",
... | Setter for the relaxation time T1 for each qubit. | [
"Setter",
"for",
"the",
"relaxation",
"time",
"T1",
"for",
"each",
"qubit",
"."
] | [
"\"\"\"\n Setter for the relaxation time T1 for each qubit.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Optional[Dict[int, Union[int, float, None]]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Optional[Dict[int, Union[int, float, None]]]",
"do... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | T2 | Optional[Dict[int, Union[int, float, None]]] | def T2(self) -> Optional[Dict[int, Union[int, float, None]]]:
"""
Return the relaxation time T2 for each qubit.
"""
return self._T2 |
Return the relaxation time T2 for each qubit.
| Return the relaxation time T2 for each qubit. | [
"Return",
"the",
"relaxation",
"time",
"T2",
"for",
"each",
"qubit",
"."
] | def T2(self) -> Optional[Dict[int, Union[int, float, None]]]:
return self._T2 | [
"def",
"T2",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
",",
"None",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_T2"
] | Return the relaxation time T2 for each qubit. | [
"Return",
"the",
"relaxation",
"time",
"T2",
"for",
"each",
"qubit",
"."
] | [
"\"\"\"\n Return the relaxation time T2 for each qubit.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | T2 | null | def T2(self, value: Optional[Dict[int, Union[int, float, None]]]):
"""
Setter for the relaxation time T2 for each qubit.
"""
if value is not None:
for index, t2 in value.items():
if t2 < 0:
raise Error.ArgumentError("The value of T1 should ... |
Setter for the relaxation time T2 for each qubit.
| Setter for the relaxation time T2 for each qubit. | [
"Setter",
"for",
"the",
"relaxation",
"time",
"T2",
"for",
"each",
"qubit",
"."
] | def T2(self, value: Optional[Dict[int, Union[int, float, None]]]):
if value is not None:
for index, t2 in value.items():
if t2 < 0:
raise Error.ArgumentError("The value of T1 should be a positive real number.")
if index not in range(self.subSysNum)... | [
"def",
"T2",
"(",
"self",
",",
"value",
":",
"Optional",
"[",
"Dict",
"[",
"int",
",",
"Union",
"[",
"int",
",",
"float",
",",
"None",
"]",
"]",
"]",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"for",
"index",
",",
"t2",
"in",
"value",
... | Setter for the relaxation time T2 for each qubit. | [
"Setter",
"for",
"the",
"relaxation",
"time",
"T2",
"for",
"each",
"qubit",
"."
] | [
"\"\"\"\n Setter for the relaxation time T2 for each qubit.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Optional[Dict[int, Union[int, float, None]]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Optional[Dict[int, Union[int, float, None]]]",
"do... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | diagMat | ndarray | def diagMat(self) -> ndarray:
"""
Return the diagonal matrix of the Hamiltonian.
:return: a diagonal matrix
"""
levelList = []
identityList = []
# Define the list of different identity matrix for each subsystem
if isinstance(self.sysLevel, int):
... |
Return the diagonal matrix of the Hamiltonian.
:return: a diagonal matrix
| Return the diagonal matrix of the Hamiltonian. | [
"Return",
"the",
"diagonal",
"matrix",
"of",
"the",
"Hamiltonian",
"."
] | def diagMat(self) -> ndarray:
levelList = []
identityList = []
if isinstance(self.sysLevel, int):
levelList = [self.sysLevel for _ in range(self.subSysNum)]
identityList = [identity(self.sysLevel) for _ in range(self.subSysNum)]
elif isinstance(self.sysLevel, list... | [
"def",
"diagMat",
"(",
"self",
")",
"->",
"ndarray",
":",
"levelList",
"=",
"[",
"]",
"identityList",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"sysLevel",
",",
"int",
")",
":",
"levelList",
"=",
"[",
"self",
".",
"sysLevel",
"for",
"_",
... | Return the diagonal matrix of the Hamiltonian. | [
"Return",
"the",
"diagonal",
"matrix",
"of",
"the",
"Hamiltonian",
"."
] | [
"\"\"\"\n Return the diagonal matrix of the Hamiltonian.\n\n :return: a diagonal matrix\n \"\"\"",
"# Define the list of different identity matrix for each subsystem",
"# Initialize the diagonal term",
"# Add drift terms to the diagonal term"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "a diagonal matrix",
"docstring_tokens": [
"a",
"diagonal",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _generateTimeIndepCoupTerm | None | def _generateTimeIndepCoupTerm(self, ham: QHamiltonian) -> None:
r"""
Generate time-independent coupling terms for ith qubit and jth qubit.
:math:`H_{coup} = a_{i} a_{j}^\dagger + a_{i}^\dagger a_j`
:param ham: The QHamiltonian object.
:return: None
"""
# Generat... | r"""
Generate time-independent coupling terms for ith qubit and jth qubit.
:math:`H_{coup} = a_{i} a_{j}^\dagger + a_{i}^\dagger a_j`
:param ham: The QHamiltonian object.
:return: None
| r"""
Generate time-independent coupling terms for ith qubit and jth qubit. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"time",
"-",
"independent",
"coupling",
"terms",
"for",
"ith",
"qubit",
"and",
"jth",
"qubit",
"."
] | def _generateTimeIndepCoupTerm(self, ham: QHamiltonian) -> None:
for index, value in self.couplingMap.items():
ham.addCoupling(onSubSys=[index[0], index[1]], g=value) | [
"def",
"_generateTimeIndepCoupTerm",
"(",
"self",
",",
"ham",
":",
"QHamiltonian",
")",
"->",
"None",
":",
"for",
"index",
",",
"value",
"in",
"self",
".",
"couplingMap",
".",
"items",
"(",
")",
":",
"ham",
".",
"addCoupling",
"(",
"onSubSys",
"=",
"[",
... | r"""
Generate time-independent coupling terms for ith qubit and jth qubit. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"time",
"-",
"independent",
"coupling",
"terms",
"for",
"ith",
"qubit",
"and",
"jth",
"qubit",
"."
] | [
"r\"\"\"\n Generate time-independent coupling terms for ith qubit and jth qubit.\n :math:`H_{coup} = a_{i} a_{j}^\\dagger + a_{i}^\\dagger a_j`\n\n :param ham: The QHamiltonian object.\n :return: None\n \"\"\"",
"# Generate the time independent coupling terms"
] | [
{
"param": "self",
"type": null
},
{
"param": "ham",
"type": "QHamiltonian"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _generateCoupTerm | None | def _generateCoupTerm(self, ham: QHamiltonian) -> None:
r"""
Return the time-dependent coupling terms of ith qubit and jth qubit.
:math:`H_{coup} = (a_i^\dagger a_j + a_i a_j^\dagger) \cos(\omega_{qi} - \omega_{qj})t
+ (a_i^\dagger a_j - a_i a_j^\dagger) i \sin(\omega_{qi} - \omega_... | r"""
Return the time-dependent coupling terms of ith qubit and jth qubit.
:math:`H_{coup} = (a_i^\dagger a_j + a_i a_j^\dagger) \cos(\omega_{qi} - \omega_{qj})t
+ (a_i^\dagger a_j - a_i a_j^\dagger) i \sin(\omega_{qi} - \omega_{qj})t`
:param ham: a QHamiltonian object.
:ret... | r"""
Return the time-dependent coupling terms of ith qubit and jth qubit. | [
"r",
"\"",
"\"",
"\"",
"Return",
"the",
"time",
"-",
"dependent",
"coupling",
"terms",
"of",
"ith",
"qubit",
"and",
"jth",
"qubit",
"."
] | def _generateCoupTerm(self, ham: QHamiltonian) -> None:
for index, value in self.couplingMap.items():
deltaOmega = self.qubitFreq[index[0]] - self.qubitFreq[index[1]]
ai = QOperator('ai')
aj = QOperator('aj')
adagi = QOperator('adagi')
adagj = QOperato... | [
"def",
"_generateCoupTerm",
"(",
"self",
",",
"ham",
":",
"QHamiltonian",
")",
"->",
"None",
":",
"for",
"index",
",",
"value",
"in",
"self",
".",
"couplingMap",
".",
"items",
"(",
")",
":",
"deltaOmega",
"=",
"self",
".",
"qubitFreq",
"[",
"index",
"[... | r"""
Return the time-dependent coupling terms of ith qubit and jth qubit. | [
"r",
"\"",
"\"",
"\"",
"Return",
"the",
"time",
"-",
"dependent",
"coupling",
"terms",
"of",
"ith",
"qubit",
"and",
"jth",
"qubit",
"."
] | [
"r\"\"\"\n Return the time-dependent coupling terms of ith qubit and jth qubit.\n\n :math:`H_{coup} = (a_i^\\dagger a_j + a_i a_j^\\dagger) \\cos(\\omega_{qi} - \\omega_{qj})t\n + (a_i^\\dagger a_j - a_i a_j^\\dagger) i \\sin(\\omega_{qi} - \\omega_{qj})t`\n\n :param ham: a QHamilton... | [
{
"param": "self",
"type": null
},
{
"param": "ham",
"type": "QHamiltonian"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _setDecoherence | None | def _setDecoherence(self, ham: QHamiltonian) -> None:
r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution.
:math:`C_{\rm relaxation} = \frac{1}{\sqrt{T1}} a`
:math:`C_{\rm dephasing} = \frac{1}{\... | r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution.
:math:`C_{\rm relaxation} = \frac{1}{\sqrt{T1}} a`
:math:`C_{\rm dephasing} = \frac{1}{\sqrt{T2}} a^\dagger a`
:param ham: The QHamiltonian o... | r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution. | [
"r",
"\"",
"\"",
"\"",
"Define",
"the",
"collapse",
"operators",
"accounts",
"for",
"the",
"decoherence",
"noise",
"for",
"solving",
"Lindblad",
"master",
"equation",
"of",
"the",
"open",
"system",
"evolution",
"."
] | def _setDecoherence(self, ham: QHamiltonian) -> None:
levelList = []
if isinstance(self.sysLevel, list):
levelList = self.sysLevel
elif isinstance(self.sysLevel, int):
levelList = [self.sysLevel for _ in range(self.subSysNum)]
if self.T1 is None and self.T2 is Non... | [
"def",
"_setDecoherence",
"(",
"self",
",",
"ham",
":",
"QHamiltonian",
")",
"->",
"None",
":",
"levelList",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"sysLevel",
",",
"list",
")",
":",
"levelList",
"=",
"self",
".",
"sysLevel",
"elif",
"isi... | r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution. | [
"r",
"\"",
"\"",
"\"",
"Define",
"the",
"collapse",
"operators",
"accounts",
"for",
"the",
"decoherence",
"noise",
"for",
"solving",
"Lindblad",
"master",
"equation",
"of",
"the",
"open",
"system",
"evolution",
"."
] | [
"r\"\"\"\n Define the collapse operators accounts for the decoherence noise\n for solving Lindblad master equation of the open system evolution.\n\n :math:`C_{\\rm relaxation} = \\frac{1}{\\sqrt{T1}} a`\n :math:`C_{\\rm dephasing} = \\frac{1}{\\sqrt{T2}} a^\\dagger a`\n\n :param h... | [
{
"param": "self",
"type": null
},
{
"param": "ham",
"type": "QHamiltonian"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | createQHamiltonian | QHamiltonian | def createQHamiltonian(self, frameMode: str = "rot") -> QHamiltonian:
r"""
Generate a QHamiltonian object based on the physics model and a QJob object.
:param frameMode: the rotating frame we choose. The default setting is rotating frame being in the qubits
frequencies.
:ret... | r"""
Generate a QHamiltonian object based on the physics model and a QJob object.
:param frameMode: the rotating frame we choose. The default setting is rotating frame being in the qubits
frequencies.
:return: a QHamiltonian object.
| r"""
Generate a QHamiltonian object based on the physics model and a QJob object. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"a",
"QHamiltonian",
"object",
"based",
"on",
"the",
"physics",
"model",
"and",
"a",
"QJob",
"object",
"."
] | def createQHamiltonian(self, frameMode: str = "rot") -> QHamiltonian:
ham = QHamiltonian(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
if frameMode == "lab":
self._generateDrift(ham, frameMode='lab')
if self.couplingMap is not None:
self._generateT... | [
"def",
"createQHamiltonian",
"(",
"self",
",",
"frameMode",
":",
"str",
"=",
"\"rot\"",
")",
"->",
"QHamiltonian",
":",
"ham",
"=",
"QHamiltonian",
"(",
"subSysNum",
"=",
"self",
".",
"subSysNum",
",",
"sysLevel",
"=",
"self",
".",
"sysLevel",
",",
"dt",
... | r"""
Generate a QHamiltonian object based on the physics model and a QJob object. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"a",
"QHamiltonian",
"object",
"based",
"on",
"the",
"physics",
"model",
"and",
"a",
"QJob",
"object",
"."
] | [
"r\"\"\"\n Generate a QHamiltonian object based on the physics model and a QJob object.\n\n :param frameMode: the rotating frame we choose. The default setting is rotating frame being in the qubits\n frequencies.\n :return: a QHamiltonian object.\n \"\"\"",
"# Initialize the... | [
{
"param": "self",
"type": null
},
{
"param": "frameMode",
"type": "str"
}
] | {
"returns": [
{
"docstring": "a QHamiltonian object.",
"docstring_tokens": [
"a",
"QHamiltonian",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"do... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | simulate | QResult | def simulate(self, job: QJob = None, state0: ndarray = None, jobList: QJobList = None,
measure: List[int] = None, shot: int = None, options: Any = None) -> QResult:
"""
Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and ... |
Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing.
:param job: the QJob object to simulate.
:param state0: the initial state vector. If None is given, this function will return the time-ordered
... | Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing. | [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
".",
"This",
"function",
"supports",
"both",
"single",
"-",
"job",
"and",
"batch",
"-",
"job",
"processing",
"."
] | def simulate(self, job: QJob = None, state0: ndarray = None, jobList: QJobList = None,
measure: List[int] = None, shot: int = None, options: Any = None) -> QResult:
if self.frameMode == 'lab':
if state0 is None:
state0 = basis(self.dim, 0)
if shot is None... | [
"def",
"simulate",
"(",
"self",
",",
"job",
":",
"QJob",
"=",
"None",
",",
"state0",
":",
"ndarray",
"=",
"None",
",",
"jobList",
":",
"QJobList",
"=",
"None",
",",
"measure",
":",
"List",
"[",
"int",
"]",
"=",
"None",
",",
"shot",
":",
"int",
"=... | Calculate the unitary evolution operator with a given Hamiltonian. | [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
"."
] | [
"\"\"\"\n Calculate the unitary evolution operator with a given Hamiltonian. This function supports\n both single-job and batch-job processing.\n\n :param job: the QJob object to simulate.\n :param state0: the initial state vector. If None is given, this function will return the time-ord... | [
{
"param": "self",
"type": null
},
{
"param": "job",
"type": "QJob"
},
{
"param": "state0",
"type": "ndarray"
},
{
"param": "jobList",
"type": "QJobList"
},
{
"param": "measure",
"type": "List[int]"
},
{
"param": "shot",
"type": "int"
},
{
... | {
"returns": [
{
"docstring": "result dictionary (or a list of result dictionaries when ``jobList`` is provided)\nThis function does provide the option of simulating on local devices. However, Quanlse also provides\ncloud computing services which are significantly faster.\n\nExample 1** (single-job processi... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | driveStrength | Dict[int, Any] | def driveStrength(self) -> Dict[int, Any]:
"""
Drive strength of readout pulse.
"""
return self._driveStrength |
Drive strength of readout pulse.
| Drive strength of readout pulse. | [
"Drive",
"strength",
"of",
"readout",
"pulse",
"."
] | def driveStrength(self) -> Dict[int, Any]:
return self._driveStrength | [
"def",
"driveStrength",
"(",
"self",
")",
"->",
"Dict",
"[",
"int",
",",
"Any",
"]",
":",
"return",
"self",
".",
"_driveStrength"
] | Drive strength of readout pulse. | [
"Drive",
"strength",
"of",
"readout",
"pulse",
"."
] | [
"\"\"\"\n Drive strength of readout pulse.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | driveStrength | null | def driveStrength(self, value: Dict[int, Any]):
"""
Define the drive strength of readout pulse.
"""
self._driveStrength = value |
Define the drive strength of readout pulse.
| Define the drive strength of readout pulse. | [
"Define",
"the",
"drive",
"strength",
"of",
"readout",
"pulse",
"."
] | def driveStrength(self, value: Dict[int, Any]):
self._driveStrength = value | [
"def",
"driveStrength",
"(",
"self",
",",
"value",
":",
"Dict",
"[",
"int",
",",
"Any",
"]",
")",
":",
"self",
".",
"_driveStrength",
"=",
"value"
] | Define the drive strength of readout pulse. | [
"Define",
"the",
"drive",
"strength",
"of",
"readout",
"pulse",
"."
] | [
"\"\"\"\n Define the drive strength of readout pulse.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Dict[int, Any]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Dict[int, Any]",
"docstring": null,
"docstri... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | driveFreq | null | def driveFreq(self, value: Dict[int, float]):
"""
Define the drive frequencies of readout pulse.
"""
self._driveFreq = value |
Define the drive frequencies of readout pulse.
| Define the drive frequencies of readout pulse. | [
"Define",
"the",
"drive",
"frequencies",
"of",
"readout",
"pulse",
"."
] | def driveFreq(self, value: Dict[int, float]):
self._driveFreq = value | [
"def",
"driveFreq",
"(",
"self",
",",
"value",
":",
"Dict",
"[",
"int",
",",
"float",
"]",
")",
":",
"self",
".",
"_driveFreq",
"=",
"value"
] | Define the drive frequencies of readout pulse. | [
"Define",
"the",
"drive",
"frequencies",
"of",
"readout",
"pulse",
"."
] | [
"\"\"\"\n Define the drive frequencies of readout pulse.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "Dict[int, float]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "Dict[int, float]",
"docstring": null,
"docst... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | loFreq | <not_specific> | def loFreq(self):
"""
Carrier frequency generated by the local oscillator of signal demodulation.
"""
return self._loFreq |
Carrier frequency generated by the local oscillator of signal demodulation.
| Carrier frequency generated by the local oscillator of signal demodulation. | [
"Carrier",
"frequency",
"generated",
"by",
"the",
"local",
"oscillator",
"of",
"signal",
"demodulation",
"."
] | def loFreq(self):
return self._loFreq | [
"def",
"loFreq",
"(",
"self",
")",
":",
"return",
"self",
".",
"_loFreq"
] | Carrier frequency generated by the local oscillator of signal demodulation. | [
"Carrier",
"frequency",
"generated",
"by",
"the",
"local",
"oscillator",
"of",
"signal",
"demodulation",
"."
] | [
"\"\"\"\n Carrier frequency generated by the local oscillator of signal demodulation.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | loFreq | null | def loFreq(self, value: float):
"""
Set the carrier frequency generated by the local oscillator for signal demodulation.
"""
self._loFreq = value |
Set the carrier frequency generated by the local oscillator for signal demodulation.
| Set the carrier frequency generated by the local oscillator for signal demodulation. | [
"Set",
"the",
"carrier",
"frequency",
"generated",
"by",
"the",
"local",
"oscillator",
"for",
"signal",
"demodulation",
"."
] | def loFreq(self, value: float):
self._loFreq = value | [
"def",
"loFreq",
"(",
"self",
",",
"value",
":",
"float",
")",
":",
"self",
".",
"_loFreq",
"=",
"value"
] | Set the carrier frequency generated by the local oscillator for signal demodulation. | [
"Set",
"the",
"carrier",
"frequency",
"generated",
"by",
"the",
"local",
"oscillator",
"for",
"signal",
"demodulation",
"."
] | [
"\"\"\"\n Set the carrier frequency generated by the local oscillator for signal demodulation.\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... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | readoutPulse | ReadoutPulse | def readoutPulse(self) -> ReadoutPulse:
"""
The multiplexing pulse data for qubit readout.
"""
return self._readoutPulse |
The multiplexing pulse data for qubit readout.
| The multiplexing pulse data for qubit readout. | [
"The",
"multiplexing",
"pulse",
"data",
"for",
"qubit",
"readout",
"."
] | def readoutPulse(self) -> ReadoutPulse:
return self._readoutPulse | [
"def",
"readoutPulse",
"(",
"self",
")",
"->",
"ReadoutPulse",
":",
"return",
"self",
".",
"_readoutPulse"
] | The multiplexing pulse data for qubit readout. | [
"The",
"multiplexing",
"pulse",
"data",
"for",
"qubit",
"readout",
"."
] | [
"\"\"\"\n The multiplexing pulse data for qubit readout.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | readoutPulse | null | def readoutPulse(self, value: ReadoutPulse):
"""
Set the measure channel for the readout
"""
self._readoutPulse = value |
Set the measure channel for the readout
| Set the measure channel for the readout | [
"Set",
"the",
"measure",
"channel",
"for",
"the",
"readout"
] | def readoutPulse(self, value: ReadoutPulse):
self._readoutPulse = value | [
"def",
"readoutPulse",
"(",
"self",
",",
"value",
":",
"ReadoutPulse",
")",
":",
"self",
".",
"_readoutPulse",
"=",
"value"
] | Set the measure channel for the readout | [
"Set",
"the",
"measure",
"channel",
"for",
"the",
"readout"
] | [
"\"\"\"\n Set the measure channel for the readout\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "ReadoutPulse"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "ReadoutPulse",
"docstring": null,
"docstring... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _createHam | QHamiltonian | def _createHam(self, idx: int, driveFreq: Union[int, float]) -> QHamiltonian:
"""
Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.
:param idx: index of the qubit.
:param driveFreq: drive frequency.
:return: QHamiltonian i... |
Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.
:param idx: index of the qubit.
:param driveFreq: drive frequency.
:return: QHamiltonian in the rotating frame.
| Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency. | [
"Return",
"the",
"hamiltonian",
"of",
"qubit",
"-",
"resonator",
"circuit",
"model",
"according",
"to",
"the",
"qubit",
"index",
"and",
"drive",
"frequency",
"."
] | def _createHam(self, idx: int, driveFreq: Union[int, float]) -> QHamiltonian:
qubitFreq = self.pulseModel.qubitFreq
qubitAnharm = self.pulseModel.qubitAnharm
resonatorFreq = self.resonatorFreq
qubitLevel = self.pulseModel.sysLevel
cList = {1: [sqrt(self.dissipation) * a(self.leve... | [
"def",
"_createHam",
"(",
"self",
",",
"idx",
":",
"int",
",",
"driveFreq",
":",
"Union",
"[",
"int",
",",
"float",
"]",
")",
"->",
"QHamiltonian",
":",
"qubitFreq",
"=",
"self",
".",
"pulseModel",
".",
"qubitFreq",
"qubitAnharm",
"=",
"self",
".",
"pu... | Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency. | [
"Return",
"the",
"hamiltonian",
"of",
"qubit",
"-",
"resonator",
"circuit",
"model",
"according",
"to",
"the",
"qubit",
"index",
"and",
"drive",
"frequency",
"."
] | [
"\"\"\"\n Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.\n\n :param idx: index of the qubit.\n :param driveFreq: drive frequency.\n\n :return: QHamiltonian in the rotating frame.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "idx",
"type": "int"
},
{
"param": "driveFreq",
"type": "Union[int, float]"
}
] | {
"returns": [
{
"docstring": "QHamiltonian in the rotating frame.",
"docstring_tokens": [
"QHamiltonian",
"in",
"the",
"rotating",
"frame",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _createHamLab | QHamiltonian | def _createHamLab(self, idx: int) -> QHamiltonian:
"""
Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.
:param idx: index of the qubit.
:return: QHamiltonian in the lab frame.
"""
# Extract information from Pulse... |
Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.
:param idx: index of the qubit.
:return: QHamiltonian in the lab frame.
| Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency. | [
"Return",
"the",
"hamiltonian",
"of",
"qubit",
"-",
"resonator",
"circuit",
"model",
"according",
"to",
"the",
"qubit",
"index",
"and",
"drive",
"frequency",
"."
] | def _createHamLab(self, idx: int) -> QHamiltonian:
qubitFreq = self.pulseModel.qubitFreq
qubitAnharm = self.pulseModel.qubitAnharm
resonatorFreq = self.resonatorFreq
qubitLevel = self.pulseModel.sysLevel
cList = {1: [sqrt(self.dissipation) * a(self.level)]}
ham = QHamilto... | [
"def",
"_createHamLab",
"(",
"self",
",",
"idx",
":",
"int",
")",
"->",
"QHamiltonian",
":",
"qubitFreq",
"=",
"self",
".",
"pulseModel",
".",
"qubitFreq",
"qubitAnharm",
"=",
"self",
".",
"pulseModel",
".",
"qubitAnharm",
"resonatorFreq",
"=",
"self",
".",
... | Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency. | [
"Return",
"the",
"hamiltonian",
"of",
"qubit",
"-",
"resonator",
"circuit",
"model",
"according",
"to",
"the",
"qubit",
"index",
"and",
"drive",
"frequency",
"."
] | [
"\"\"\"\n Return the hamiltonian of qubit-resonator circuit model according to the qubit index and drive frequency.\n\n :param idx: index of the qubit.\n\n :return: QHamiltonian in the lab frame.\n \"\"\"",
"# Extract information from PulseModel object",
"# Create lab frame QHamilton... | [
{
"param": "self",
"type": null
},
{
"param": "idx",
"type": "int"
}
] | {
"returns": [
{
"docstring": "QHamiltonian in the lab frame.",
"docstring_tokens": [
"QHamiltonian",
"in",
"the",
"lab",
"frame",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nu... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | _readoutJob | QJob | def _readoutJob(self, amp: Union[int, float], duration: Union[int, float]) -> QJob:
"""
Return readout pulse in rotating frame at driving frequency.
:param amp: amplitude of the readout job.
:param duration: the duration of the pulse.
:return: QJob.
"""
qubitLev... |
Return readout pulse in rotating frame at driving frequency.
:param amp: amplitude of the readout job.
:param duration: the duration of the pulse.
:return: QJob.
| Return readout pulse in rotating frame at driving frequency. | [
"Return",
"readout",
"pulse",
"in",
"rotating",
"frame",
"at",
"driving",
"frequency",
"."
] | def _readoutJob(self, amp: Union[int, float], duration: Union[int, float]) -> QJob:
qubitLevel = self.pulseModel.sysLevel
job = QJob(subSysNum=2, sysLevel=[qubitLevel, self.level], dt=self.dt)
wave = square(t=duration, a=amp)
job.addWave(operators=driveX, onSubSys=1, waves=wave, t0=0.)
... | [
"def",
"_readoutJob",
"(",
"self",
",",
"amp",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"duration",
":",
"Union",
"[",
"int",
",",
"float",
"]",
")",
"->",
"QJob",
":",
"qubitLevel",
"=",
"self",
".",
"pulseModel",
".",
"sysLevel",
"job",
... | Return readout pulse in rotating frame at driving frequency. | [
"Return",
"readout",
"pulse",
"in",
"rotating",
"frame",
"at",
"driving",
"frequency",
"."
] | [
"\"\"\"\n Return readout pulse in rotating frame at driving frequency.\n\n :param amp: amplitude of the readout job.\n :param duration: the duration of the pulse.\n\n :return: QJob.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "amp",
"type": "Union[int, float]"
},
{
"param": "duration",
"type": "Union[int, float]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
18c9d5c0881de60689cb0d4dcf0e74418d41f043 | baidu/Quanlse | Quanlse/Simulator/__init__.py | [
"Apache-2.0"
] | Python | simulate | Dict | def simulate(self, duration: Union[int, float], resIdx: Optional[List[int]] = None,
state: 'str' = 'ground') -> Dict:
"""
Simulate the state evolution of the qubit-resonator system using Jaynes-Cumming model.
:param duration: pulse duration of the measurement.
:param re... |
Simulate the state evolution of the qubit-resonator system using Jaynes-Cumming model.
:param duration: pulse duration of the measurement.
:param resIdx: indexes of the resonator the pulse acted on.
:param state: qubit state prepared in ground state or in excited state, Optional parame... | Simulate the state evolution of the qubit-resonator system using Jaynes-Cumming model. | [
"Simulate",
"the",
"state",
"evolution",
"of",
"the",
"qubit",
"-",
"resonator",
"system",
"using",
"Jaynes",
"-",
"Cumming",
"model",
"."
] | def simulate(self, duration: Union[int, float], resIdx: Optional[List[int]] = None,
state: 'str' = 'ground') -> Dict:
if self._readoutPulse is None:
raise Error.ArgumentError("You need to define object of class: ReadoutPulse")
k = self.conversionLoss
kappa = self.dis... | [
"def",
"simulate",
"(",
"self",
",",
"duration",
":",
"Union",
"[",
"int",
",",
"float",
"]",
",",
"resIdx",
":",
"Optional",
"[",
"List",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"state",
":",
"'str'",
"=",
"'ground'",
")",
"->",
"Dict",
":",
"if... | Simulate the state evolution of the qubit-resonator system using Jaynes-Cumming model. | [
"Simulate",
"the",
"state",
"evolution",
"of",
"the",
"qubit",
"-",
"resonator",
"system",
"using",
"Jaynes",
"-",
"Cumming",
"model",
"."
] | [
"\"\"\"\n Simulate the state evolution of the qubit-resonator system using Jaynes-Cumming model.\n\n :param duration: pulse duration of the measurement.\n :param resIdx: indexes of the resonator the pulse acted on.\n :param state: qubit state prepared in ground state or in excited state,... | [
{
"param": "self",
"type": null
},
{
"param": "duration",
"type": "Union[int, float]"
},
{
"param": "resIdx",
"type": "Optional[List[int]]"
},
{
"param": "state",
"type": "'str'"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f63c8add1e51320a2ccf4e51a96545cf900c9ffa | baidu/Quanlse | Quanlse/Scheduler/Ion/DefaultPulseGenerator.py | [
"Apache-2.0"
] | Python | generateIon1Qubit | QJob | def generateIon1Qubit(cirLine: CircuitLine = None, scheduler: 'SchedulerIon' = None) -> QJob:
"""
Default generator for ion single-qubit gates.
:param cirLine: input circuit line object
:param scheduler: input scheduler object
:return: a returned QJob object
"""
job = QJob(subSysNum=schedul... |
Default generator for ion single-qubit gates.
:param cirLine: input circuit line object
:param scheduler: input scheduler object
:return: a returned QJob object
| Default generator for ion single-qubit gates. | [
"Default",
"generator",
"for",
"ion",
"single",
"-",
"qubit",
"gates",
"."
] | def generateIon1Qubit(cirLine: CircuitLine = None, scheduler: 'SchedulerIon' = None) -> QJob:
job = QJob(subSysNum=scheduler.subSysNum, sysLevel=2, dt=scheduler.dt)
qLabel = cirLine.qRegIndexList
matrixNumber = cirLine.data.getMatrix()
theta = arccos(matrixNumber[0][0])
theta = theta.real
if cir... | [
"def",
"generateIon1Qubit",
"(",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerIon'",
"=",
"None",
")",
"->",
"QJob",
":",
"job",
"=",
"QJob",
"(",
"subSysNum",
"=",
"scheduler",
".",
"subSysNum",
",",
"sysLevel",
"=",
"2",
... | Default generator for ion single-qubit gates. | [
"Default",
"generator",
"for",
"ion",
"single",
"-",
"qubit",
"gates",
"."
] | [
"\"\"\"\n Default generator for ion single-qubit gates.\n\n :param cirLine: input circuit line object\n :param scheduler: input scheduler object\n :return: a returned QJob object\n \"\"\""
] | [
{
"param": "cirLine",
"type": "CircuitLine"
},
{
"param": "scheduler",
"type": "'SchedulerIon'"
}
] | {
"returns": [
{
"docstring": "a returned QJob object",
"docstring_tokens": [
"a",
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cirLine",
"type": "CircuitLine",
"docstring": "inp... |
f63c8add1e51320a2ccf4e51a96545cf900c9ffa | baidu/Quanlse | Quanlse/Scheduler/Ion/DefaultPulseGenerator.py | [
"Apache-2.0"
] | Python | generateMS | QJob | def generateMS(cirLine: CircuitLine = None, scheduler: 'SchedulerIon' = None) -> QJob:
"""
Default generator for M-S gate.
:param cirLine: input circuit line object
:param scheduler: input scheduler object
:return: a returned QJob object
"""
if 5 < scheduler.dt < 15:
job = QJob(subS... |
Default generator for M-S gate.
:param cirLine: input circuit line object
:param scheduler: input scheduler object
:return: a returned QJob object
| Default generator for M-S gate. | [
"Default",
"generator",
"for",
"M",
"-",
"S",
"gate",
"."
] | def generateMS(cirLine: CircuitLine = None, scheduler: 'SchedulerIon' = None) -> QJob:
if 5 < scheduler.dt < 15:
job = QJob(subSysNum=scheduler.subSysNum, sysLevel=2, dt=scheduler.dt)
qLabel = cirLine.qRegIndexList
gatePair = [[qLabel[0], qLabel[1]]]
args1 = (scheduler.subSysNum, 171... | [
"def",
"generateMS",
"(",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerIon'",
"=",
"None",
")",
"->",
"QJob",
":",
"if",
"5",
"<",
"scheduler",
".",
"dt",
"<",
"15",
":",
"job",
"=",
"QJob",
"(",
"subSysNum",
"=",
"sc... | Default generator for M-S gate. | [
"Default",
"generator",
"for",
"M",
"-",
"S",
"gate",
"."
] | [
"\"\"\"\n Default generator for M-S gate.\n\n :param cirLine: input circuit line object\n :param scheduler: input scheduler object\n :return: a returned QJob object\n \"\"\"",
"\"\"\"\n For parameter args1, scheduler.subSysNum is the total ion in chain.\n And simply, we fix the trappe... | [
{
"param": "cirLine",
"type": "CircuitLine"
},
{
"param": "scheduler",
"type": "'SchedulerIon'"
}
] | {
"returns": [
{
"docstring": "a returned QJob object",
"docstring_tokens": [
"a",
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cirLine",
"type": "CircuitLine",
"docstring": "inp... |
f63c8add1e51320a2ccf4e51a96545cf900c9ffa | baidu/Quanlse | Quanlse/Scheduler/Ion/DefaultPulseGenerator.py | [
"Apache-2.0"
] | Python | defaultPulseGenerator | SchedulerPulseGenerator | def defaultPulseGenerator() -> SchedulerPulseGenerator:
"""
Default pulse generator for ion-trap qubit
:return: returned generator object
"""
generator = SchedulerPulseGenerator()
# Add the generator for single qubit gates
gateList1q = ['X', 'Y', 'RX', 'RY']
generator.addGenerator(gate... |
Default pulse generator for ion-trap qubit
:return: returned generator object
| Default pulse generator for ion-trap qubit | [
"Default",
"pulse",
"generator",
"for",
"ion",
"-",
"trap",
"qubit"
] | def defaultPulseGenerator() -> SchedulerPulseGenerator:
generator = SchedulerPulseGenerator()
gateList1q = ['X', 'Y', 'RX', 'RY']
generator.addGenerator(gateList1q, generateIon1Qubit)
generator.addGenerator(['MS'], generateMS)
return generator | [
"def",
"defaultPulseGenerator",
"(",
")",
"->",
"SchedulerPulseGenerator",
":",
"generator",
"=",
"SchedulerPulseGenerator",
"(",
")",
"gateList1q",
"=",
"[",
"'X'",
",",
"'Y'",
",",
"'RX'",
",",
"'RY'",
"]",
"generator",
".",
"addGenerator",
"(",
"gateList1q",
... | Default pulse generator for ion-trap qubit | [
"Default",
"pulse",
"generator",
"for",
"ion",
"-",
"trap",
"qubit"
] | [
"\"\"\"\n Default pulse generator for ion-trap qubit\n\n :return: returned generator object\n \"\"\"",
"# Add the generator for single qubit gates",
"# Add the generator for MS gates"
] | [] | {
"returns": [
{
"docstring": "returned generator object",
"docstring_tokens": [
"returned",
"generator",
"object"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | name | null | def name(self, name: str):
"""
Modify the name of the operator.
:param name: name to be changed to
"""
if not isinstance(name, str):
raise Error.ArgumentError("name must be a str!")
self._name = name |
Modify the name of the operator.
:param name: name to be changed to
| Modify the name of the operator. | [
"Modify",
"the",
"name",
"of",
"the",
"operator",
"."
] | def name(self, name: str):
if not isinstance(name, str):
raise Error.ArgumentError("name must be a str!")
self._name = name | [
"def",
"name",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"raise",
"Error",
".",
"ArgumentError",
"(",
"\"name must be a str!\"",
")",
"self",
".",
"_name",
"=",
"name"
] | Modify the name of the operator. | [
"Modify",
"the",
"name",
"of",
"the",
"operator",
"."
] | [
"\"\"\"\n Modify the name of the operator.\n\n :param name: name to be changed to\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "str",
"docstring": "name to be changed to",
"... |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | onSubSys | <not_specific> | def onSubSys(self):
"""
Return the corresponding subsystem number of the operator.
"""
return self._onSubSys |
Return the corresponding subsystem number of the operator.
| Return the corresponding subsystem number of the operator. | [
"Return",
"the",
"corresponding",
"subsystem",
"number",
"of",
"the",
"operator",
"."
] | def onSubSys(self):
return self._onSubSys | [
"def",
"onSubSys",
"(",
"self",
")",
":",
"return",
"self",
".",
"_onSubSys"
] | Return the corresponding subsystem number of the operator. | [
"Return",
"the",
"corresponding",
"subsystem",
"number",
"of",
"the",
"operator",
"."
] | [
"\"\"\"\n Return the corresponding subsystem number of the operator.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | onSubSys | null | def onSubSys(self, onSubSys: int):
"""
Modify the corresponding subsystem of the operator.
:param onSubSys: subsystem to be changed to
"""
if onSubSys is None:
self._onSubSys = None
else:
if not isinstance(onSubSys, int):
raise Err... |
Modify the corresponding subsystem of the operator.
:param onSubSys: subsystem to be changed to
| Modify the corresponding subsystem of the operator. | [
"Modify",
"the",
"corresponding",
"subsystem",
"of",
"the",
"operator",
"."
] | def onSubSys(self, onSubSys: int):
if onSubSys is None:
self._onSubSys = None
else:
if not isinstance(onSubSys, int):
raise Error.ArgumentError(f"onSubSys must be an integer, instead of {type(onSubSys)}!")
self._onSubSys = onSubSys | [
"def",
"onSubSys",
"(",
"self",
",",
"onSubSys",
":",
"int",
")",
":",
"if",
"onSubSys",
"is",
"None",
":",
"self",
".",
"_onSubSys",
"=",
"None",
"else",
":",
"if",
"not",
"isinstance",
"(",
"onSubSys",
",",
"int",
")",
":",
"raise",
"Error",
".",
... | Modify the corresponding subsystem of the operator. | [
"Modify",
"the",
"corresponding",
"subsystem",
"of",
"the",
"operator",
"."
] | [
"\"\"\"\n Modify the corresponding subsystem of the operator.\n\n :param onSubSys: subsystem to be changed to\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "onSubSys",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "onSubSys",
"type": "int",
"docstring": "subsystem to be changed to"... |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | coef | null | def coef(self, coef: Union[float, complex] = 1.0):
"""
Setter for the coefficient
:param: coefficient to be set to
"""
if coef is None:
self._coef = 1.0
else:
if not (isinstance(coef, float) or isinstance(coef, complex)):
raise Err... |
Setter for the coefficient
:param: coefficient to be set to
| Setter for the coefficient
:param: coefficient to be set to | [
"Setter",
"for",
"the",
"coefficient",
":",
"param",
":",
"coefficient",
"to",
"be",
"set",
"to"
] | def coef(self, coef: Union[float, complex] = 1.0):
if coef is None:
self._coef = 1.0
else:
if not (isinstance(coef, float) or isinstance(coef, complex)):
raise Error.ArgumentError(f"coef must be a float or complex, instead of {type(coef)}!")
self._coef... | [
"def",
"coef",
"(",
"self",
",",
"coef",
":",
"Union",
"[",
"float",
",",
"complex",
"]",
"=",
"1.0",
")",
":",
"if",
"coef",
"is",
"None",
":",
"self",
".",
"_coef",
"=",
"1.0",
"else",
":",
"if",
"not",
"(",
"isinstance",
"(",
"coef",
",",
"f... | Setter for the coefficient
:param: coefficient to be set to | [
"Setter",
"for",
"the",
"coefficient",
":",
"param",
":",
"coefficient",
"to",
"be",
"set",
"to"
] | [
"\"\"\"\n Setter for the coefficient\n\n :param: coefficient to be set to\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coef",
"type": "Union[float, complex]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coef",
"type": "Union[float, complex]",
"docstring": null,
"d... |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | load | 'QOperator' | def load(base64Str: str) -> 'QOperator':
"""
Create object from base64 encoded string.
:return: a QOperator object
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QOperator
return obj |
Create object from base64 encoded string.
:return: a QOperator object
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QOperator':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
return obj | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QOperator'",
":",
"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 :return: a QOperator object\n \"\"\"",
"# type: QOperator"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [
{
"docstring": "a QOperator object",
"docstring_tokens": [
"a",
"QOperator",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": null,
"docstring_tokens... |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | dagger | ndarray | def dagger(matrix: ndarray) -> ndarray:
"""
Return the conjugate transpose of a given matrix.
:param matrix: the given matrix
:return: the conjugate transposed matrix
"""
return array(conjugate(transpose(matrix)), order="C") |
Return the conjugate transpose of a given matrix.
:param matrix: the given matrix
:return: the conjugate transposed matrix
| Return the conjugate transpose of a given matrix. | [
"Return",
"the",
"conjugate",
"transpose",
"of",
"a",
"given",
"matrix",
"."
] | def dagger(matrix: ndarray) -> ndarray:
return array(conjugate(transpose(matrix)), order="C") | [
"def",
"dagger",
"(",
"matrix",
":",
"ndarray",
")",
"->",
"ndarray",
":",
"return",
"array",
"(",
"conjugate",
"(",
"transpose",
"(",
"matrix",
")",
")",
",",
"order",
"=",
"\"C\"",
")"
] | Return the conjugate transpose of a given matrix. | [
"Return",
"the",
"conjugate",
"transpose",
"of",
"a",
"given",
"matrix",
"."
] | [
"\"\"\"\n Return the conjugate transpose of a given matrix.\n\n :param matrix: the given matrix\n :return: the conjugate transposed matrix\n \"\"\""
] | [
{
"param": "matrix",
"type": "ndarray"
}
] | {
"returns": [
{
"docstring": "the conjugate transposed matrix",
"docstring_tokens": [
"the",
"conjugate",
"transposed",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "matrix",
"type": "ndarray",
"doc... |
8b41f6c09e1559adb48ca222975ba46d59b49a30 | baidu/Quanlse | Quanlse/QOperator.py | [
"Apache-2.0"
] | Python | a | ndarray | def a(d: int = 2) -> ndarray:
"""
Return the numpy matrix of destroy operator.
:return: a numpy matrix
"""
mat = zeros((d, d), dtype=complex, order="C")
for i in range(0, d - 1):
mat[i, i + 1] = sqrt(i + 1) + 0 * 1j
return mat |
Return the numpy matrix of destroy operator.
:return: a numpy matrix
| Return the numpy matrix of destroy operator. | [
"Return",
"the",
"numpy",
"matrix",
"of",
"destroy",
"operator",
"."
] | def a(d: int = 2) -> ndarray:
mat = zeros((d, d), dtype=complex, order="C")
for i in range(0, d - 1):
mat[i, i + 1] = sqrt(i + 1) + 0 * 1j
return mat | [
"def",
"a",
"(",
"d",
":",
"int",
"=",
"2",
")",
"->",
"ndarray",
":",
"mat",
"=",
"zeros",
"(",
"(",
"d",
",",
"d",
")",
",",
"dtype",
"=",
"complex",
",",
"order",
"=",
"\"C\"",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"d",
"-",
"... | Return the numpy matrix of destroy operator. | [
"Return",
"the",
"numpy",
"matrix",
"of",
"destroy",
"operator",
"."
] | [
"\"\"\"\n Return the numpy matrix of destroy operator.\n\n :return: a numpy matrix\n \"\"\""
] | [
{
"param": "d",
"type": "int"
}
] | {
"returns": [
{
"docstring": "a numpy matrix",
"docstring_tokens": [
"a",
"numpy",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "d",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"de... |
719dcfb1e50c1814c3e8941e887c9ec43b8671a0 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorCloud.py | [
"Apache-2.0"
] | Python | generate1Q | QJob | def generate1Q(ham: 'QHamiltonian' = 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 inf... |
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 generate1Q(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
subHam = ham.subSystem(cirLine.qRegIndexList)
if cirLine.data.name in ['X', 'RX']:
job, inf = opt1q(subHam, cirLine.data.getMatrix(), depth=2, targetInfid=0.0001)
... | [
"def",
"generate1Q",
"(",
"ham",
":",
"'QHamiltonian'",
"=",
"None",
",",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerSuperconduct'",
"=",
"None",
")",
"->",
"QJob",
":",
"subHam",
"=",
"ham",
".",
"subSystem",
"(",
"cirLi... | 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": "'QHamiltonian'"
},
{
"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": "'QHamiltonian'",
"docstring": "QHam object contain... |
719dcfb1e50c1814c3e8941e887c9ec43b8671a0 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorCloud.py | [
"Apache-2.0"
] | Python | generateCr | QJob | def generateCr(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
"""
Default generator for Cross-resonance gate.
:param ham: QHam object containing the system information
:param cirLine: a CircuitLine object containing the gate i... |
Default generator for Cross-resonance gate.
: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 Cross-resonance gate. | [
"Default",
"generator",
"for",
"Cross",
"-",
"resonance",
"gate",
"."
] | def generateCr(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
subHam = ham.subSystem(cirLine.qRegIndexList)
job, inf = optCr(subHam, (-3.0, 3.0), maxIter=1)
print(f"Infidelity of {cirLine.data.name} on qubit {cirLine.qRegIndexList}... | [
"def",
"generateCr",
"(",
"ham",
":",
"'QHamiltonian'",
"=",
"None",
",",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerSuperconduct'",
"=",
"None",
")",
"->",
"QJob",
":",
"subHam",
"=",
"ham",
".",
"subSystem",
"(",
"cirLi... | Default generator for Cross-resonance gate. | [
"Default",
"generator",
"for",
"Cross",
"-",
"resonance",
"gate",
"."
] | [
"\"\"\"\n Default generator for Cross-resonance gate.\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": "'QHamiltonian'"
},
{
"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": "'QHamiltonian'",
"docstring": "QHam object contain... |
719dcfb1e50c1814c3e8941e887c9ec43b8671a0 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorCloud.py | [
"Apache-2.0"
] | Python | generateCz | QJob | def generateCz(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
"""
Default generator for controlled-Z gate.
:param ham: QHam object containing the system information
:param cirLine: a CircuitLine object containing the gate info... |
Default generator for controlled-Z gate.
: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 controlled-Z gate. | [
"Default",
"generator",
"for",
"controlled",
"-",
"Z",
"gate",
"."
] | def generateCz(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
subHam = ham.subSystem(cirLine.qRegIndexList)
job, inf = optCz(subHam, tg=40, targetInfidelity=0.01)
print(f"Infidelity of {cirLine.data.name} on qubit {cirLine.qRegInde... | [
"def",
"generateCz",
"(",
"ham",
":",
"'QHamiltonian'",
"=",
"None",
",",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerSuperconduct'",
"=",
"None",
")",
"->",
"QJob",
":",
"subHam",
"=",
"ham",
".",
"subSystem",
"(",
"cirLi... | Default generator for controlled-Z gate. | [
"Default",
"generator",
"for",
"controlled",
"-",
"Z",
"gate",
"."
] | [
"\"\"\"\n Default generator for controlled-Z gate.\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": "'QHamiltonian'"
},
{
"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": "'QHamiltonian'",
"docstring": "QHam object contain... |
719dcfb1e50c1814c3e8941e887c9ec43b8671a0 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorCloud.py | [
"Apache-2.0"
] | Python | generateISWAP | QJob | def generateISWAP(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
"""
Default generator for ISWAP gate.
:param ham: QHam object containing the system information
:param cirLine: a CircuitLine object containing the gate infor... |
Default generator for ISWAP gate.
: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 ISWAP gate. | [
"Default",
"generator",
"for",
"ISWAP",
"gate",
"."
] | def generateISWAP(ham: 'QHamiltonian' = None, cirLine: CircuitLine = None,
scheduler: 'SchedulerSuperconduct' = None) -> QJob:
subHam = ham.subSystem(cirLine.qRegIndexList)
job, inf = optISWAP(subHam, tg=50, targetInfidelity=0.01)
print(f"Infidelity of {cirLine.data.name} on qubit {cirLine... | [
"def",
"generateISWAP",
"(",
"ham",
":",
"'QHamiltonian'",
"=",
"None",
",",
"cirLine",
":",
"CircuitLine",
"=",
"None",
",",
"scheduler",
":",
"'SchedulerSuperconduct'",
"=",
"None",
")",
"->",
"QJob",
":",
"subHam",
"=",
"ham",
".",
"subSystem",
"(",
"ci... | Default generator for ISWAP gate. | [
"Default",
"generator",
"for",
"ISWAP",
"gate",
"."
] | [
"\"\"\"\n Default generator for ISWAP gate.\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": "'QHamiltonian'"
},
{
"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": "'QHamiltonian'",
"docstring": "QHam object contain... |
719dcfb1e50c1814c3e8941e887c9ec43b8671a0 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorCloud.py | [
"Apache-2.0"
] | Python | generatorCloud | SchedulerPulseGenerator | def generatorCloud(ham: 'QHamiltonian') -> SchedulerPulseGenerator:
"""
Return a default pulse SchedulerPulseGenerator instance for the scheduler.
:param ham: a Hamiltonian object
:return: returned generator object
"""
generator = SchedulerPulseGenerator(ham)
# Add the generator for singl... |
Return a default pulse SchedulerPulseGenerator instance for the scheduler.
:param ham: a Hamiltonian object
:return: returned generator object
| Return a default pulse SchedulerPulseGenerator instance for the scheduler. | [
"Return",
"a",
"default",
"pulse",
"SchedulerPulseGenerator",
"instance",
"for",
"the",
"scheduler",
"."
] | def generatorCloud(ham: 'QHamiltonian') -> SchedulerPulseGenerator:
generator = SchedulerPulseGenerator(ham)
gateList1q = ['X', 'Y', 'Z', 'H', 'S', 'T', 'RX', 'RY', 'RZ', 'W', 'SQRTW', 'U']
generator.addGenerator(gateList1q, generate1Q)
generator.addGenerator(['CR'], generateCr)
generator.addGenerat... | [
"def",
"generatorCloud",
"(",
"ham",
":",
"'QHamiltonian'",
")",
"->",
"SchedulerPulseGenerator",
":",
"generator",
"=",
"SchedulerPulseGenerator",
"(",
"ham",
")",
"gateList1q",
"=",
"[",
"'X'",
",",
"'Y'",
",",
"'Z'",
",",
"'H'",
",",
"'S'",
",",
"'T'",
... | Return a default pulse SchedulerPulseGenerator instance for the scheduler. | [
"Return",
"a",
"default",
"pulse",
"SchedulerPulseGenerator",
"instance",
"for",
"the",
"scheduler",
"."
] | [
"\"\"\"\n Return a default pulse SchedulerPulseGenerator instance for the scheduler.\n\n :param ham: a Hamiltonian object\n :return: returned generator object\n \"\"\"",
"# Add the generator for single qubit gates",
"# Add the generator for two-qubit gates"
] | [
{
"param": "ham",
"type": "'QHamiltonian'"
}
] | {
"returns": [
{
"docstring": "returned generator object",
"docstring_tokens": [
"returned",
"generator",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "'QHamiltonian'",
"docstring": "a Hamilto... |
5cb55272ccde412ba14a1122bdb931ad98a7d233 | baidu/Quanlse | Quanlse/QRpc.py | [
"Apache-2.0"
] | Python | _createTask | <not_specific> | def _createTask(token, circuitId, optimizer, backendParam=None, modules=[], debug=False, taskType="quanlse_optimizer"):
"""
Create a task from the code
"""
task = {
"token": token,
"circuitId": circuitId,
"taskType": taskType,
"sdkVersion": sdkVersion,
"source": ... |
Create a task from the code
| Create a task from the code | [
"Create",
"a",
"task",
"from",
"the",
"code"
] | def _createTask(token, circuitId, optimizer, backendParam=None, modules=[], debug=False, taskType="quanlse_optimizer"):
task = {
"token": token,
"circuitId": circuitId,
"taskType": taskType,
"sdkVersion": sdkVersion,
"source": taskSourceQuanlse,
"optimizer": optimizer... | [
"def",
"_createTask",
"(",
"token",
",",
"circuitId",
",",
"optimizer",
",",
"backendParam",
"=",
"None",
",",
"modules",
"=",
"[",
"]",
",",
"debug",
"=",
"False",
",",
"taskType",
"=",
"\"quanlse_optimizer\"",
")",
":",
"task",
"=",
"{",
"\"token\"",
"... | Create a task from the code | [
"Create",
"a",
"task",
"from",
"the",
"code"
] | [
"\"\"\"\n Create a task from the code\n \"\"\""
] | [
{
"param": "token",
"type": null
},
{
"param": "circuitId",
"type": null
},
{
"param": "optimizer",
"type": null
},
{
"param": "backendParam",
"type": null
},
{
"param": "modules",
"type": null
},
{
"param": "debug",
"type": null
},
{
"para... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "circuitId",
"type": null,
"docstring": null,
"docstring_toke... |
8a09f227c937d7fe10782f496c74b930baff45a4 | baidu/Quanlse | Quanlse/Scheduler/Superconduct/GeneratorPulseModel.py | [
"Apache-2.0"
] | Python | generateBasic1Q | QJob | def generateBasic1Q(ham, gate, onQubit, scheduler) -> QJob:
""" Generate the single-qubit gates """
job = ham.createJob()
# Generate the operator
if gate.name in ['X', 'RX', 'Y', 'RY']:
if "caliDataXY" not in scheduler.conf.keys():
raise ArgumentError(f"'cali... | Generate the single-qubit gates | Generate the single-qubit gates | [
"Generate",
"the",
"single",
"-",
"qubit",
"gates"
] | def generateBasic1Q(ham, gate, onQubit, scheduler) -> QJob:
job = ham.createJob()
if gate.name in ['X', 'RX', 'Y', 'RY']:
if "caliDataXY" not in scheduler.conf.keys():
raise ArgumentError(f"'caliDataXY' does not exist in scheduler.conf, "
f... | [
"def",
"generateBasic1Q",
"(",
"ham",
",",
"gate",
",",
"onQubit",
",",
"scheduler",
")",
"->",
"QJob",
":",
"job",
"=",
"ham",
".",
"createJob",
"(",
")",
"if",
"gate",
".",
"name",
"in",
"[",
"'X'",
",",
"'RX'",
",",
"'Y'",
",",
"'RY'",
"]",
":... | Generate the single-qubit gates | [
"Generate",
"the",
"single",
"-",
"qubit",
"gates"
] | [
"\"\"\" Generate the single-qubit gates \"\"\"",
"# Generate the operator",
"# Pulse Parameters",
"# Add the waveform to job",
"# Pulse Parameters",
"# Add the waveform to job"
] | [
{
"param": "ham",
"type": null
},
{
"param": "gate",
"type": null
},
{
"param": "onQubit",
"type": null
},
{
"param": "scheduler",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ham",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gate",
"type": null,
"docstring": null,
"docstring_tokens": []... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | sysLevel | null | def sysLevel(self, value: Union[int, List[int]]):
"""
Set the level of subsystems.
:param value: the number of subsystems - either an integer value or a list of integers.
"""
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sy... |
Set the level of subsystems.
:param value: the number of subsystems - either an integer value or a list of integers.
| Set the level of subsystems. | [
"Set",
"the",
"level",
"of",
"subsystems",
"."
] | def sysLevel(self, value: Union[int, List[int]]):
if not isinstance(value, int) and not isinstance(value, list):
raise Error.ArgumentError("sysLevel 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 subsystems. | [
"Set",
"the",
"level",
"of",
"subsystems",
"."
] | [
"\"\"\"\n Set the level of subsystems.\n\n :param value: the number of subsystems - either an integer value or a list of integers.\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... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | ctrlCache | Dict[str, Any] | def ctrlCache(self) -> Dict[str, Any]:
"""
Return the cache of the control terms.
"""
return self._ctrlCache |
Return the cache of the control terms.
| Return the cache of the control terms. | [
"Return",
"the",
"cache",
"of",
"the",
"control",
"terms",
"."
] | def ctrlCache(self) -> Dict[str, Any]:
return self._ctrlCache | [
"def",
"ctrlCache",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"_ctrlCache"
] | Return the cache of the control terms. | [
"Return",
"the",
"cache",
"of",
"the",
"control",
"terms",
"."
] | [
"\"\"\"\n Return the cache of the control terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | ctrlCache | null | def ctrlCache(self):
"""
Delete the cache of the control terms.
"""
del self._ctrlCache |
Delete the cache of the control terms.
| Delete the cache of the control terms. | [
"Delete",
"the",
"cache",
"of",
"the",
"control",
"terms",
"."
] | def ctrlCache(self):
del self._ctrlCache | [
"def",
"ctrlCache",
"(",
"self",
")",
":",
"del",
"self",
".",
"_ctrlCache"
] | Delete the cache of the control terms. | [
"Delete",
"the",
"cache",
"of",
"the",
"control",
"terms",
"."
] | [
"\"\"\"\n Delete the cache of the control terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | driftCache | ndarray | def driftCache(self) -> ndarray:
"""
Return the cache of the drift terms.
"""
return self._driftCache |
Return the cache of the drift terms.
| Return the cache of the drift terms. | [
"Return",
"the",
"cache",
"of",
"the",
"drift",
"terms",
"."
] | def driftCache(self) -> ndarray:
return self._driftCache | [
"def",
"driftCache",
"(",
"self",
")",
"->",
"ndarray",
":",
"return",
"self",
".",
"_driftCache"
] | Return the cache of the drift terms. | [
"Return",
"the",
"cache",
"of",
"the",
"drift",
"terms",
"."
] | [
"\"\"\"\n Return the cache of the drift terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | driftCache | null | def driftCache(self):
"""
Delete the cache of the drift terms.
"""
del self._driftCache |
Delete the cache of the drift terms.
| Delete the cache of the drift terms. | [
"Delete",
"the",
"cache",
"of",
"the",
"drift",
"terms",
"."
] | def driftCache(self):
del self._driftCache | [
"def",
"driftCache",
"(",
"self",
")",
":",
"del",
"self",
".",
"_driftCache"
] | Delete the cache of the drift terms. | [
"Delete",
"the",
"cache",
"of",
"the",
"drift",
"terms",
"."
] | [
"\"\"\"\n Delete the cache of the drift terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | waveCache | Dict[str, Any] | def waveCache(self) -> Dict[str, Any]:
"""
Return the cache of drift terms.
"""
return self._waveJob.waveCache |
Return the cache of drift terms.
| Return the cache of drift terms. | [
"Return",
"the",
"cache",
"of",
"drift",
"terms",
"."
] | def waveCache(self) -> Dict[str, Any]:
return self._waveJob.waveCache | [
"def",
"waveCache",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"_waveJob",
".",
"waveCache"
] | Return the cache of drift terms. | [
"Return",
"the",
"cache",
"of",
"drift",
"terms",
"."
] | [
"\"\"\"\n Return the cache of drift terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | driftOperators | Dict[str, Union[QOperator, List[QOperator]]] | def driftOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
"""
Return the operators of the drift terms.
"""
return self._driftOperators |
Return the operators of the drift terms.
| Return the operators of the drift terms. | [
"Return",
"the",
"operators",
"of",
"the",
"drift",
"terms",
"."
] | def driftOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
return self._driftOperators | [
"def",
"driftOperators",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_driftOperators"
] | Return the operators of the drift terms. | [
"Return",
"the",
"operators",
"of",
"the",
"drift",
"terms",
"."
] | [
"\"\"\"\n Return the operators of the drift terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | driftOperators | null | def driftOperators(self):
"""
Delete the operators of the drift terms.
"""
del self._driftOperators
self._driftOperators = {} |
Delete the operators of the drift terms.
| Delete the operators of the drift terms. | [
"Delete",
"the",
"operators",
"of",
"the",
"drift",
"terms",
"."
] | def driftOperators(self):
del self._driftOperators
self._driftOperators = {} | [
"def",
"driftOperators",
"(",
"self",
")",
":",
"del",
"self",
".",
"_driftOperators",
"self",
".",
"_driftOperators",
"=",
"{",
"}"
] | Delete the operators of the drift terms. | [
"Delete",
"the",
"operators",
"of",
"the",
"drift",
"terms",
"."
] | [
"\"\"\"\n Delete the operators of the drift terms.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | doNotClearFlagOperators | Dict[str, Union[QOperator, List[QOperator]]] | def doNotClearFlagOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
"""
Return operators with flag QWAVEFORM_FLAG_DO_NOT_CLEAR.
"""
return self._doNotClearFlagOperators |
Return operators with flag QWAVEFORM_FLAG_DO_NOT_CLEAR.
| Return operators with flag QWAVEFORM_FLAG_DO_NOT_CLEAR. | [
"Return",
"operators",
"with",
"flag",
"QWAVEFORM_FLAG_DO_NOT_CLEAR",
"."
] | def doNotClearFlagOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
return self._doNotClearFlagOperators | [
"def",
"doNotClearFlagOperators",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_doNotClearFlagOperators"
] | Return operators with flag QWAVEFORM_FLAG_DO_NOT_CLEAR. | [
"Return",
"operators",
"with",
"flag",
"QWAVEFORM_FLAG_DO_NOT_CLEAR",
"."
] | [
"\"\"\"\n Return operators with flag QWAVEFORM_FLAG_DO_NOT_CLEAR.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | ctrlOperators | Dict[str, Union[QOperator, List[QOperator]]] | def ctrlOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
"""
Return operators of the control term.
"""
return self._waveJob.ctrlOperators |
Return operators of the control term.
| Return operators of the control term. | [
"Return",
"operators",
"of",
"the",
"control",
"term",
"."
] | def ctrlOperators(self) -> Dict[str, Union[QOperator, List[QOperator]]]:
return self._waveJob.ctrlOperators | [
"def",
"ctrlOperators",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
"]",
":",
"return",
"self",
".",
"_waveJob",
".",
"ctrlOperators"
] | Return operators of the control term. | [
"Return",
"operators",
"of",
"the",
"control",
"term",
"."
] | [
"\"\"\"\n Return operators of the control term.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | collapseOperators | Optional[List[ndarray]] | def collapseOperators(self) -> Optional[List[ndarray]]:
"""
Return the list of the cache of the collapse operators for the Lindblad master equations.
"""
return self._collapseOperators |
Return the list of the cache of the collapse operators for the Lindblad master equations.
| Return the list of the cache of the collapse operators for the Lindblad master equations. | [
"Return",
"the",
"list",
"of",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"for",
"the",
"Lindblad",
"master",
"equations",
"."
] | def collapseOperators(self) -> Optional[List[ndarray]]:
return self._collapseOperators | [
"def",
"collapseOperators",
"(",
"self",
")",
"->",
"Optional",
"[",
"List",
"[",
"ndarray",
"]",
"]",
":",
"return",
"self",
".",
"_collapseOperators"
] | Return the list of the cache of the collapse operators for the Lindblad master equations. | [
"Return",
"the",
"list",
"of",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"for",
"the",
"Lindblad",
"master",
"equations",
"."
] | [
"\"\"\"\n Return the list of the cache of the collapse operators for the Lindblad master equations.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | collapseOperators | null | def collapseOperators(self):
"""
Delete the list of the cache of the collapse operators for the Lindblad master equations.
"""
del self._collapseOperators
self._collapseOperators = None |
Delete the list of the cache of the collapse operators for the Lindblad master equations.
| Delete the list of the cache of the collapse operators for the Lindblad master equations. | [
"Delete",
"the",
"list",
"of",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"for",
"the",
"Lindblad",
"master",
"equations",
"."
] | def collapseOperators(self):
del self._collapseOperators
self._collapseOperators = None | [
"def",
"collapseOperators",
"(",
"self",
")",
":",
"del",
"self",
".",
"_collapseOperators",
"self",
".",
"_collapseOperators",
"=",
"None"
] | Delete the list of the cache of the collapse operators for the Lindblad master equations. | [
"Delete",
"the",
"list",
"of",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"for",
"the",
"Lindblad",
"master",
"equations",
"."
] | [
"\"\"\"\n Delete the list of the cache of the collapse operators for the Lindblad master equations.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | dissipationSuperCache | <not_specific> | def dissipationSuperCache(self):
"""
Return the cache of dissipation super operator.
"""
return self._dissipationSuperCache |
Return the cache of dissipation super operator.
| Return the cache of dissipation super operator. | [
"Return",
"the",
"cache",
"of",
"dissipation",
"super",
"operator",
"."
] | def dissipationSuperCache(self):
return self._dissipationSuperCache | [
"def",
"dissipationSuperCache",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dissipationSuperCache"
] | Return the cache of dissipation super operator. | [
"Return",
"the",
"cache",
"of",
"dissipation",
"super",
"operator",
"."
] | [
"\"\"\"\n Return the cache of dissipation super operator.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | dissipationSuperCache | null | def dissipationSuperCache(self):
"""
Delete the cache of the dissipation super operators.
"""
del self._dissipationSuperCache |
Delete the cache of the dissipation super operators.
| Delete the cache of the dissipation super operators. | [
"Delete",
"the",
"cache",
"of",
"the",
"dissipation",
"super",
"operators",
"."
] | def dissipationSuperCache(self):
del self._dissipationSuperCache | [
"def",
"dissipationSuperCache",
"(",
"self",
")",
":",
"del",
"self",
".",
"_dissipationSuperCache"
] | Delete the cache of the dissipation super operators. | [
"Delete",
"the",
"cache",
"of",
"the",
"dissipation",
"super",
"operators",
"."
] | [
"\"\"\"\n Delete the cache of the dissipation super 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": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | job | QJob | def job(self) -> QJob:
"""
Return a QJob object. The QJob object contains all the information regarding a quantum task.
"""
return self._waveJob |
Return a QJob object. The QJob object contains all the information regarding a quantum task.
| Return a QJob object. The QJob object contains all the information regarding a quantum task. | [
"Return",
"a",
"QJob",
"object",
".",
"The",
"QJob",
"object",
"contains",
"all",
"the",
"information",
"regarding",
"a",
"quantum",
"task",
"."
] | def job(self) -> QJob:
return self._waveJob | [
"def",
"job",
"(",
"self",
")",
"->",
"QJob",
":",
"return",
"self",
".",
"_waveJob"
] | Return a QJob object. | [
"Return",
"a",
"QJob",
"object",
"."
] | [
"\"\"\"\n Return a QJob object. The QJob object contains all the information regarding a quantum task.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | copy | "QHamiltonian" | def copy(self) -> "QHamiltonian":
"""
Return a copy of current object.
"""
return copy.deepcopy(self) |
Return a copy of current object.
| Return a copy of current object. | [
"Return",
"a",
"copy",
"of",
"current",
"object",
"."
] | def copy(self) -> "QHamiltonian":
return copy.deepcopy(self) | [
"def",
"copy",
"(",
"self",
")",
"->",
"\"QHamiltonian\"",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | Return a copy of current object. | [
"Return",
"a",
"copy",
"of",
"current",
"object",
"."
] | [
"\"\"\"\n Return a copy of current 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": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | createJobList | QJobList | def createJobList(self) -> QJobList:
"""
Return an instance of a QJobList of the same system properties.
"""
newJobList = QJobList(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJobList.LO = self.job.LO
return newJobList |
Return an instance of a QJobList of the same system properties.
| Return an instance of a QJobList of the same system properties. | [
"Return",
"an",
"instance",
"of",
"a",
"QJobList",
"of",
"the",
"same",
"system",
"properties",
"."
] | def createJobList(self) -> QJobList:
newJobList = QJobList(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJobList.LO = self.job.LO
return newJobList | [
"def",
"createJobList",
"(",
"self",
")",
"->",
"QJobList",
":",
"newJobList",
"=",
"QJobList",
"(",
"subSysNum",
"=",
"self",
".",
"subSysNum",
",",
"sysLevel",
"=",
"self",
".",
"sysLevel",
",",
"dt",
"=",
"self",
".",
"dt",
")",
"newJobList",
".",
"... | Return an instance of a QJobList of the same system properties. | [
"Return",
"an",
"instance",
"of",
"a",
"QJobList",
"of",
"the",
"same",
"system",
"properties",
"."
] | [
"\"\"\"\n Return an instance of a QJobList of the same system properties.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | createJob | QJob | def createJob(self) -> QJob:
"""
Return an instance of a QJob object of the same system properties.
"""
newJob = QJob(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJob.ctrlOperators = copy.deepcopy(self.job.ctrlOperators)
newJob.LO = self.job.LO
... |
Return an instance of a QJob object of the same system properties.
| Return an instance of a QJob object of the same system properties. | [
"Return",
"an",
"instance",
"of",
"a",
"QJob",
"object",
"of",
"the",
"same",
"system",
"properties",
"."
] | def createJob(self) -> QJob:
newJob = QJob(subSysNum=self.subSysNum, sysLevel=self.sysLevel, dt=self.dt)
newJob.ctrlOperators = copy.deepcopy(self.job.ctrlOperators)
newJob.LO = self.job.LO
return newJob | [
"def",
"createJob",
"(",
"self",
")",
"->",
"QJob",
":",
"newJob",
"=",
"QJob",
"(",
"subSysNum",
"=",
"self",
".",
"subSysNum",
",",
"sysLevel",
"=",
"self",
".",
"sysLevel",
",",
"dt",
"=",
"self",
".",
"dt",
")",
"newJob",
".",
"ctrlOperators",
"=... | Return an instance of a QJob object of the same system properties. | [
"Return",
"an",
"instance",
"of",
"a",
"QJob",
"object",
"of",
"the",
"same",
"system",
"properties",
"."
] | [
"\"\"\"\n Return an instance of a QJob object of the same system properties.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.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[... | r"""
This method adds a control term to the Hamiltonian with a specified waveform.
:param operators: wave operator
:param onSubSys: what subsystem the wave is acting upon
:param waves: a QWaveform object
:param t0: start time
:param strength: wave strength
:param... | r"""
This method adds a control term to the Hamiltonian with a specified waveform. | [
"r",
"\"",
"\"",
"\"",
"This",
"method",
"adds",
"a",
"control",
"term",
"to",
"the",
"Hamiltonian",
"with",
"a",
"specified",
"waveform",
"."
] | 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",
"[",
... | r"""
This method adds a control term to the Hamiltonian with a specified waveform. | [
"r",
"\"",
"\"",
"\"",
"This",
"method",
"adds",
"a",
"control",
"term",
"to",
"the",
"Hamiltonian",
"with",
"a",
"specified",
"waveform",
"."
] | [
"r\"\"\"\n This method adds a control term to the Hamiltonian with a specified waveform.\n\n :param operators: wave operator\n :param onSubSys: what subsystem the wave is acting upon\n :param waves: a QWaveform object\n :param t0: start time\n :param strength: wave strength... | [
{
"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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.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:
"""
This method removes all waveforms in the specified control ... |
This method removes all waveforms in the specified control terms.
If names is None, this method will remove waveforms in all control terms.
:param operators: the corresponding operator(s)
:param onSubSys: qubit indexes that the term acts upon
:param names: the user-given name f... | This method removes all waveforms in the specified control terms.
If names is None, this method will remove waveforms in all control terms. | [
"This",
"method",
"removes",
"all",
"waveforms",
"in",
"the",
"specified",
"control",
"terms",
".",
"If",
"names",
"is",
"None",
"this",
"method",
"will",
"remove",
"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:
self.job.clearWaves(operators, onSubSys, names, tag) | [
"def",
"clearWaves",
"(",
"self",
",",
"operators",
":",
"Union",
"[",
"QOperator",
",",
"Callable",
",",
"List",
"[",
"QOperator",
"]",
",",
"List",
"[",
"Callable",
"]",
"]",
"=",
"None",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",... | This method removes all waveforms in the specified control terms. | [
"This",
"method",
"removes",
"all",
"waveforms",
"in",
"the",
"specified",
"control",
"terms",
"."
] | [
"\"\"\"\n This method removes all waveforms in the specified control terms.\n If names is None, this method will remove waveforms in all control terms.\n\n :param operators: the corresponding operator(s)\n :param onSubSys: qubit indexes that the term acts upon\n :param names: the ... | [
{
"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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | verifyWaveListObj | bool | def verifyWaveListObj(self, waveJob: QJob) -> bool:
"""
Check whether the QWaveList object is valid for this QHam object.
:param waveJob: QWaveList to be checked
:return: true of false indicating its validity
"""
for key in waveJob.ctrlOperators.keys():
if is... |
Check whether the QWaveList object is valid for this QHam object.
:param waveJob: QWaveList to be checked
:return: true of false indicating its validity
| Check whether the QWaveList object is valid for this QHam object. | [
"Check",
"whether",
"the",
"QWaveList",
"object",
"is",
"valid",
"for",
"this",
"QHam",
"object",
"."
] | def verifyWaveListObj(self, waveJob: QJob) -> bool:
for key in waveJob.ctrlOperators.keys():
if isinstance(waveJob.ctrlOperators[key], list):
ops = waveJob.ctrlOperators[key]
elif isinstance(waveJob.ctrlOperators[key], QOperator):
ops = [waveJob.ctrlOperat... | [
"def",
"verifyWaveListObj",
"(",
"self",
",",
"waveJob",
":",
"QJob",
")",
"->",
"bool",
":",
"for",
"key",
"in",
"waveJob",
".",
"ctrlOperators",
".",
"keys",
"(",
")",
":",
"if",
"isinstance",
"(",
"waveJob",
".",
"ctrlOperators",
"[",
"key",
"]",
",... | Check whether the QWaveList object is valid for this QHam object. | [
"Check",
"whether",
"the",
"QWaveList",
"object",
"is",
"valid",
"for",
"this",
"QHam",
"object",
"."
] | [
"\"\"\"\n Check whether the QWaveList object is valid for this QHam object.\n\n :param waveJob: QWaveList to be checked\n :return: true of false indicating its validity\n \"\"\"",
"# Check every operator"
] | [
{
"param": "self",
"type": null
},
{
"param": "waveJob",
"type": "QJob"
}
] | {
"returns": [
{
"docstring": "true of false indicating its validity",
"docstring_tokens": [
"true",
"of",
"false",
"indicating",
"its",
"validity"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | buildCache | None | def buildCache(self) -> None:
"""
Build Cache for waveList and operators.
:return: None
"""
self.clearCache()
self.buildOperatorCache()
self._waveJob.buildWaveCache()
if self._collapseList is not None:
self.buildCollapseCache()
sel... |
Build Cache for waveList and operators.
:return: None
| Build Cache for waveList and operators. | [
"Build",
"Cache",
"for",
"waveList",
"and",
"operators",
"."
] | def buildCache(self) -> None:
self.clearCache()
self.buildOperatorCache()
self._waveJob.buildWaveCache()
if self._collapseList is not None:
self.buildCollapseCache()
self.buildDissipationSuperCache() | [
"def",
"buildCache",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"clearCache",
"(",
")",
"self",
".",
"buildOperatorCache",
"(",
")",
"self",
".",
"_waveJob",
".",
"buildWaveCache",
"(",
")",
"if",
"self",
".",
"_collapseList",
"is",
"not",
"None",... | Build Cache for waveList and operators. | [
"Build",
"Cache",
"for",
"waveList",
"and",
"operators",
"."
] | [
"\"\"\"\n Build Cache for waveList and operators.\n\n :return: None\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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | buildOperatorCache | None | def buildOperatorCache(self) -> None:
r"""
Save the drift/coupling/control terms in a more efficient way for further usage.
Note that this function will recursively process all the terms added to drift/coupling/control terms and
save them to cache.
:return: None
"""
... | r"""
Save the drift/coupling/control terms in a more efficient way for further usage.
Note that this function will recursively process all the terms added to drift/coupling/control terms and
save them to cache.
:return: None
| r"""
Save the drift/coupling/control terms in a more efficient way for further usage.
Note that this function will recursively process all the terms added to drift/coupling/control terms and
save them to cache. | [
"r",
"\"",
"\"",
"\"",
"Save",
"the",
"drift",
"/",
"coupling",
"/",
"control",
"terms",
"in",
"a",
"more",
"efficient",
"way",
"for",
"further",
"usage",
".",
"Note",
"that",
"this",
"function",
"will",
"recursively",
"process",
"all",
"the",
"terms",
"... | def buildOperatorCache(self) -> None:
sysLevel = self.sysLevel
subSysNum = self.subSysNum
driftMatList = []
for key in self._driftOperators.keys():
if isinstance(self._driftOperators[key], list):
mat = self._driftOperators[key][0].coef * self._generateOperator... | [
"def",
"buildOperatorCache",
"(",
"self",
")",
"->",
"None",
":",
"sysLevel",
"=",
"self",
".",
"sysLevel",
"subSysNum",
"=",
"self",
".",
"subSysNum",
"driftMatList",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"_driftOperators",
".",
"keys",
"(",
"... | r"""
Save the drift/coupling/control terms in a more efficient way for further usage. | [
"r",
"\"",
"\"",
"\"",
"Save",
"the",
"drift",
"/",
"coupling",
"/",
"control",
"terms",
"in",
"a",
"more",
"efficient",
"way",
"for",
"further",
"usage",
"."
] | [
"r\"\"\"\n Save the drift/coupling/control terms in a more efficient way for further usage.\n Note that this function will recursively process all the terms added to drift/coupling/control terms and\n save them to cache.\n\n :return: None\n \"\"\"",
"# Generator the operator for... | [
{
"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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | buildCollapseCache | None | def buildCollapseCache(self) -> None:
r"""
Generate and save the cache of the collapse operators.
:return: None
"""
levelList = []
if isinstance(self.sysLevel, list):
levelList = self.sysLevel
elif isinstance(self.sysLevel, int):
levelL... | r"""
Generate and save the cache of the collapse operators.
:return: None
| r"""
Generate and save the cache of the collapse operators. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"and",
"save",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"."
] | def buildCollapseCache(self) -> None:
levelList = []
if isinstance(self.sysLevel, list):
levelList = self.sysLevel
elif isinstance(self.sysLevel, int):
levelList = [self.sysLevel for _ in range(self.subSysNum)]
cList = self._collapseList
cacheList = []
... | [
"def",
"buildCollapseCache",
"(",
"self",
")",
"->",
"None",
":",
"levelList",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"sysLevel",
",",
"list",
")",
":",
"levelList",
"=",
"self",
".",
"sysLevel",
"elif",
"isinstance",
"(",
"self",
".",
"s... | r"""
Generate and save the cache of the collapse operators. | [
"r",
"\"",
"\"",
"\"",
"Generate",
"and",
"save",
"the",
"cache",
"of",
"the",
"collapse",
"operators",
"."
] | [
"r\"\"\"\n Generate and save the cache of the collapse operators.\n\n :return: None\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
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | buildDissipationSuperCache | None | def buildDissipationSuperCache(self) -> None:
"""
Generate the dissipation super operator in the Liouville form.
"""
cList = self._collapseOperators
dim = None
# Calculate the dimension of the Hilbert space
if isinstance(self.sysLevel, int):
dim = se... |
Generate the dissipation super operator in the Liouville form.
| Generate the dissipation super operator in the Liouville form. | [
"Generate",
"the",
"dissipation",
"super",
"operator",
"in",
"the",
"Liouville",
"form",
"."
] | def buildDissipationSuperCache(self) -> None:
cList = self._collapseOperators
dim = None
if isinstance(self.sysLevel, int):
dim = self.sysLevel ** self.subSysNum
elif isinstance(self.sysLevel, list):
dim = 1
for i in self.sysLevel:
dim ... | [
"def",
"buildDissipationSuperCache",
"(",
"self",
")",
"->",
"None",
":",
"cList",
"=",
"self",
".",
"_collapseOperators",
"dim",
"=",
"None",
"if",
"isinstance",
"(",
"self",
".",
"sysLevel",
",",
"int",
")",
":",
"dim",
"=",
"self",
".",
"sysLevel",
"*... | Generate the dissipation super operator in the Liouville form. | [
"Generate",
"the",
"dissipation",
"super",
"operator",
"in",
"the",
"Liouville",
"form",
"."
] | [
"\"\"\"\n Generate the dissipation super operator in the Liouville form.\n \"\"\"",
"# Calculate the dimension of the Hilbert space"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | _generateOperator | ndarray | def _generateOperator(self, operator: Union[QOperator, List[QOperator]]) -> ndarray:
"""
Generate the operator of the system in the complete Hilbert space by taking tensor products.
:param operator: a list of operator(s)
:return: the operator after taking the tensor products of the inpu... |
Generate the operator of the system in the complete Hilbert space by taking tensor products.
:param operator: a list of operator(s)
:return: the operator after taking the tensor products of the input operator
| Generate the operator of the system in the complete Hilbert space by taking tensor products. | [
"Generate",
"the",
"operator",
"of",
"the",
"system",
"in",
"the",
"complete",
"Hilbert",
"space",
"by",
"taking",
"tensor",
"products",
"."
] | def _generateOperator(self, operator: Union[QOperator, List[QOperator]]) -> ndarray:
sysLevel = self.sysLevel
subSysNum = self.subSysNum
if isinstance(operator, list):
matrices = []
for op in operator:
matrices.append(op.matrix)
else:
m... | [
"def",
"_generateOperator",
"(",
"self",
",",
"operator",
":",
"Union",
"[",
"QOperator",
",",
"List",
"[",
"QOperator",
"]",
"]",
")",
"->",
"ndarray",
":",
"sysLevel",
"=",
"self",
".",
"sysLevel",
"subSysNum",
"=",
"self",
".",
"subSysNum",
"if",
"isi... | Generate the operator of the system in the complete Hilbert space by taking tensor products. | [
"Generate",
"the",
"operator",
"of",
"the",
"system",
"in",
"the",
"complete",
"Hilbert",
"space",
"by",
"taking",
"tensor",
"products",
"."
] | [
"\"\"\"\n Generate the operator of the system in the complete Hilbert space by taking tensor products.\n\n :param operator: a list of operator(s)\n :return: the operator after taking the tensor products of the input operator\n \"\"\"",
"# Generate matrices",
"# Each subsystem of the ... | [
{
"param": "self",
"type": null
},
{
"param": "operator",
"type": "Union[QOperator, List[QOperator]]"
}
] | {
"returns": [
{
"docstring": "the operator after taking the tensor products of the input operator",
"docstring_tokens": [
"the",
"operator",
"after",
"taking",
"the",
"tensor",
"products",
"of",
"the",
"input",
"o... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | subSystem | 'QHamiltonian' | def subSystem(self, onSubSys: Union[int, List[int]]) -> 'QHamiltonian':
"""
This method extracts a subsystem from the target Hamiltonian.
:param onSubSys: a list of qubit indexes
:return: subsystem's QHamiltonian object
"""
subHam = copy.deepcopy(self)
subHam.cle... |
This method extracts a subsystem from the target Hamiltonian.
:param onSubSys: a list of qubit indexes
:return: subsystem's QHamiltonian object
| This method extracts a subsystem from the target Hamiltonian. | [
"This",
"method",
"extracts",
"a",
"subsystem",
"from",
"the",
"target",
"Hamiltonian",
"."
] | def subSystem(self, onSubSys: Union[int, List[int]]) -> 'QHamiltonian':
subHam = copy.deepcopy(self)
subHam.clearCache()
if isinstance(onSubSys, int):
subQubits = 1
indexMapping = {onSubSys: 0}
if onSubSys >= self._subSysNum:
raise Error.Argume... | [
"def",
"subSystem",
"(",
"self",
",",
"onSubSys",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
")",
"->",
"'QHamiltonian'",
":",
"subHam",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"subHam",
".",
"clearCache",
"(",
")",
"if",
... | This method extracts a subsystem from the target Hamiltonian. | [
"This",
"method",
"extracts",
"a",
"subsystem",
"from",
"the",
"target",
"Hamiltonian",
"."
] | [
"\"\"\"\n This method extracts a subsystem from the target Hamiltonian.\n\n :param onSubSys: a list of qubit indexes\n :return: subsystem's QHamiltonian object\n \"\"\"",
"# Information about the sub system",
"# qubit index mapping",
"# Update the sysLevel property",
"# Set the m... | [
{
"param": "self",
"type": null
},
{
"param": "onSubSys",
"type": "Union[int, List[int]]"
}
] | {
"returns": [
{
"docstring": "subsystem's QHamiltonian object",
"docstring_tokens": [
"subsystem",
"'",
"s",
"QHamiltonian",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | mapping | Union[int, List[int]] | def mapping(index: Union[int, List[int]]) -> Union[int, List[int]]:
"""
Map the `onQubits` index(es) from the original Ham to the extracted Ham.
:param index: 'onQubits' index(es) from the original Ham
:return: mapped index(es) onto the extracted Ham
"""
... |
Map the `onQubits` index(es) from the original Ham to the extracted Ham.
:param index: 'onQubits' index(es) from the original Ham
:return: mapped index(es) onto the extracted Ham
| Map the `onQubits` index(es) from the original Ham to the extracted Ham. | [
"Map",
"the",
"`",
"onQubits",
"`",
"index",
"(",
"es",
")",
"from",
"the",
"original",
"Ham",
"to",
"the",
"extracted",
"Ham",
"."
] | def mapping(index: Union[int, List[int]]) -> Union[int, List[int]]:
if isinstance(index, int):
return indexMapping[index]
else:
mappedList = []
for item in index:
mappedList.append(indexMapping[item])
return mapp... | [
"def",
"mapping",
"(",
"index",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
")",
"->",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
":",
"if",
"isinstance",
"(",
"index",
",",
"int",
")",
":",
"return",
"indexMapping",... | Map the `onQubits` index(es) from the original Ham to the extracted Ham. | [
"Map",
"the",
"`",
"onQubits",
"`",
"index",
"(",
"es",
")",
"from",
"the",
"original",
"Ham",
"to",
"the",
"extracted",
"Ham",
"."
] | [
"\"\"\"\n Map the `onQubits` index(es) from the original Ham to the extracted Ham.\n\n :param index: 'onQubits' index(es) from the original Ham\n :return: mapped index(es) onto the extracted Ham\n \"\"\""
] | [
{
"param": "index",
"type": "Union[int, List[int]]"
}
] | {
"returns": [
{
"docstring": "mapped index(es) onto the extracted Ham",
"docstring_tokens": [
"mapped",
"index",
"(",
"es",
")",
"onto",
"the",
"extracted",
"Ham"
],
"type": null
}
],
"raises": [],
"params":... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | allIn | bool | def allIn(listA: Union[int, List[int]], listB: Union[int, List[int]]) -> bool:
"""
Check whether all the items in listB are in listA.
:param listA: listA
:param listB: listB
:return: a bool value
"""
if isinstance(listA, int):
... |
Check whether all the items in listB are in listA.
:param listA: listA
:param listB: listB
:return: a bool value
| Check whether all the items in listB are in listA. | [
"Check",
"whether",
"all",
"the",
"items",
"in",
"listB",
"are",
"in",
"listA",
"."
] | def allIn(listA: Union[int, List[int]], listB: Union[int, List[int]]) -> bool:
if isinstance(listA, int):
listA = [listA]
if isinstance(listB, int):
return listB in listA
else:
for item in listB:
if item not in listA... | [
"def",
"allIn",
"(",
"listA",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
",",
"listB",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"listA",
",",
"int",
")",
"... | Check whether all the items in listB are in listA. | [
"Check",
"whether",
"all",
"the",
"items",
"in",
"listB",
"are",
"in",
"listA",
"."
] | [
"\"\"\"\n Check whether all the items in listB are in listA.\n\n :param listA: listA\n :param listB: listB\n :return: a bool value\n \"\"\""
] | [
{
"param": "listA",
"type": "Union[int, List[int]]"
},
{
"param": "listB",
"type": "Union[int, List[int]]"
}
] | {
"returns": [
{
"docstring": "a bool value",
"docstring_tokens": [
"a",
"bool",
"value"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "listA",
"type": "Union[int, List[int]]",
"docstring": null,
"docstring_toke... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | eigen | <not_specific> | def eigen(self, t: Optional[ndarray] = None):
"""
Calculate the eigenvalues and eigenvectors of the given Hamiltonian.
:param t: The time at which the Hamiltonian's eigenvectors and eigenvalues are to compute.
:return: If t is none, it returns (n, n) Hamiltonian's eigenvalues of shape (... |
Calculate the eigenvalues and eigenvectors of the given Hamiltonian.
:param t: The time at which the Hamiltonian's eigenvectors and eigenvalues are to compute.
:return: If t is none, it returns (n, n) Hamiltonian's eigenvalues of shape (n, ) in the
ascending order and the corresponding... | Calculate the eigenvalues and eigenvectors of the given Hamiltonian. | [
"Calculate",
"the",
"eigenvalues",
"and",
"eigenvectors",
"of",
"the",
"given",
"Hamiltonian",
"."
] | def eigen(self, t: Optional[ndarray] = None):
self.buildCache()
drift = self.driftCache
ctrl = self.ctrlCache
wave = self.job.waveCache
dt = self.dt
maxDt = self.job.endTimeDt
def _computeEigen(matrix):
eigenVals, eigenVecs = eig(matrix)
so... | [
"def",
"eigen",
"(",
"self",
",",
"t",
":",
"Optional",
"[",
"ndarray",
"]",
"=",
"None",
")",
":",
"self",
".",
"buildCache",
"(",
")",
"drift",
"=",
"self",
".",
"driftCache",
"ctrl",
"=",
"self",
".",
"ctrlCache",
"wave",
"=",
"self",
".",
"job"... | Calculate the eigenvalues and eigenvectors of the given Hamiltonian. | [
"Calculate",
"the",
"eigenvalues",
"and",
"eigenvectors",
"of",
"the",
"given",
"Hamiltonian",
"."
] | [
"\"\"\"\n Calculate the eigenvalues and eigenvectors of the given Hamiltonian.\n\n :param t: The time at which the Hamiltonian's eigenvectors and eigenvalues are to compute.\n :return: If t is none, it returns (n, n) Hamiltonian's eigenvalues of shape (n, ) in the\n ascending order and t... | [
{
"param": "self",
"type": null
},
{
"param": "t",
"type": "Optional[ndarray]"
}
] | {
"returns": [
{
"docstring": "If t is none, it returns (n, n) Hamiltonian's eigenvalues of shape (n, ) in the\nascending order and the corresponding eigenvectors matrix of shape (n, n); If t is an (m, ) array,\nit returns list of (m, n) eigenvalues and (m, n, n) eigenvectors.",
"docstring_tokens": [
... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | subSystemIndicesInverse | Dict[int, int] | def subSystemIndicesInverse(self) -> Dict[int, int]:
"""
In self.subSystem, users can extract a subsystem of the original system,
thus, the qubit indices will change. For example, for a system with indices [0, 1, 2, 3],
we extract the subsystem constituted by subsystems 1 and 3, then the... |
In self.subSystem, users can extract a subsystem of the original system,
thus, the qubit indices will change. For example, for a system with indices [0, 1, 2, 3],
we extract the subsystem constituted by subsystems 1 and 3, then the index of
subsystem 1 changes to 0; 3 changes to 1; the ... | In self.subSystem, users can extract a subsystem of the original system,
thus, the qubit indices will change. For example, for a system with indices [0, 1, 2, 3],
we extract the subsystem constituted by subsystems 1 and 3, then the index of
subsystem 1 changes to 0; 3 changes to 1; the mapping in self.subSystemIndexMap... | [
"In",
"self",
".",
"subSystem",
"users",
"can",
"extract",
"a",
"subsystem",
"of",
"the",
"original",
"system",
"thus",
"the",
"qubit",
"indices",
"will",
"change",
".",
"For",
"example",
"for",
"a",
"system",
"with",
"indices",
"[",
"0",
"1",
"2",
"3",
... | def subSystemIndicesInverse(self) -> Dict[int, int]:
inverseMapping = {}
for key in self.subSystemIndexMapping:
inverseMapping[self.subSystemIndexMapping[key]] = key
return inverseMapping | [
"def",
"subSystemIndicesInverse",
"(",
"self",
")",
"->",
"Dict",
"[",
"int",
",",
"int",
"]",
":",
"inverseMapping",
"=",
"{",
"}",
"for",
"key",
"in",
"self",
".",
"subSystemIndexMapping",
":",
"inverseMapping",
"[",
"self",
".",
"subSystemIndexMapping",
"... | In self.subSystem, users can extract a subsystem of the original system,
thus, the qubit indices will change. | [
"In",
"self",
".",
"subSystem",
"users",
"can",
"extract",
"a",
"subsystem",
"of",
"the",
"original",
"system",
"thus",
"the",
"qubit",
"indices",
"will",
"change",
"."
] | [
"\"\"\"\n In self.subSystem, users can extract a subsystem of the original system,\n thus, the qubit indices will change. For example, for a system with indices [0, 1, 2, 3],\n we extract the subsystem constituted by subsystems 1 and 3, then the index of\n subsystem 1 changes to 0; 3 cha... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "a dictionary containing the 'inverse mapping'",
"docstring_tokens": [
"a",
"dictionary",
"containing",
"the",
"'",
"inverse",
"mapping",
"'"
],
"type": null
}
],
"raises": [],
"params":... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | outputInverseJob | QJob | def outputInverseJob(self, subSysNum: int, sysLevel: int = None, dt: float = None) -> QJob:
"""
Return an inverse-mapped Job. (see subSystemIndicesInverse())
:param subSysNum: subsystem's size
:param sysLevel: subsystem's energy level
:param dt: time interval
:return: re... |
Return an inverse-mapped Job. (see subSystemIndicesInverse())
:param subSysNum: subsystem's size
:param sysLevel: subsystem's energy level
:param dt: time interval
:return: returned QJob object
| Return an inverse-mapped Job. | [
"Return",
"an",
"inverse",
"-",
"mapped",
"Job",
"."
] | def outputInverseJob(self, subSysNum: int, sysLevel: int = None, dt: float = None) -> QJob:
inverseMapping = self.subSystemIndicesInverse()
_sysLevel = self.sysLevel if sysLevel is None else sysLevel
_dt = self.dt if dt is None else dt
job = QJob(subSysNum, _sysLevel, _dt)
for op... | [
"def",
"outputInverseJob",
"(",
"self",
",",
"subSysNum",
":",
"int",
",",
"sysLevel",
":",
"int",
"=",
"None",
",",
"dt",
":",
"float",
"=",
"None",
")",
"->",
"QJob",
":",
"inverseMapping",
"=",
"self",
".",
"subSystemIndicesInverse",
"(",
")",
"_sysLe... | Return an inverse-mapped Job. | [
"Return",
"an",
"inverse",
"-",
"mapped",
"Job",
"."
] | [
"\"\"\"\n Return an inverse-mapped Job. (see subSystemIndicesInverse())\n\n :param subSysNum: subsystem's size\n :param sysLevel: subsystem's energy level\n :param dt: time interval\n :return: returned QJob object\n \"\"\"",
"# Get the job",
"# Add the waves into the ne... | [
{
"param": "self",
"type": null
},
{
"param": "subSysNum",
"type": "int"
},
{
"param": "sysLevel",
"type": "int"
},
{
"param": "dt",
"type": "float"
}
] | {
"returns": [
{
"docstring": "returned QJob object",
"docstring_tokens": [
"returned",
"QJob",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens":... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | simulate | QResult | def simulate(self, job: QJob = None, state0: ndarray = None, recordEvolution: bool = False, shot: int = None,
isOpen: bool = False, jobList: QJobList = None, refreshCache: bool = True, accelerate: bool = False,
adaptive: bool = False, tolerance: float = 0.01) -> QResult:
"""
... |
Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing.
To activate acceleration, please install ``Numba`` JIT compiler, please visit its official website
https://numba.pydata.org/ for more details.
:p... | Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing.
| [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
".",
"This",
"function",
"supports",
"both",
"single",
"-",
"job",
"and",
"batch",
"-",
"job",
"processing",
"."
] | def simulate(self, job: QJob = None, state0: ndarray = None, recordEvolution: bool = False, shot: int = None,
isOpen: bool = False, jobList: QJobList = None, refreshCache: bool = True, accelerate: bool = False,
adaptive: bool = False, tolerance: float = 0.01) -> QResult:
result... | [
"def",
"simulate",
"(",
"self",
",",
"job",
":",
"QJob",
"=",
"None",
",",
"state0",
":",
"ndarray",
"=",
"None",
",",
"recordEvolution",
":",
"bool",
"=",
"False",
",",
"shot",
":",
"int",
"=",
"None",
",",
"isOpen",
":",
"bool",
"=",
"False",
","... | Calculate the unitary evolution operator with a given Hamiltonian. | [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
"."
] | [
"\"\"\"\n Calculate the unitary evolution operator with a given Hamiltonian. This function supports\n both single-job and batch-job processing.\n\n To activate acceleration, please install ``Numba`` JIT compiler, please visit its official website\n https://numba.pydata.org/ for more deta... | [
{
"param": "self",
"type": null
},
{
"param": "job",
"type": "QJob"
},
{
"param": "state0",
"type": "ndarray"
},
{
"param": "recordEvolution",
"type": "bool"
},
{
"param": "shot",
"type": "int"
},
{
"param": "isOpen",
"type": "bool"
},
{
"p... | {
"returns": [
{
"docstring": "result dictionary (or a list of result dictionaries when ``jobList`` is provided)\nThis function does provide the option of simulating on local devices. However, Quanlse also provides\ncloud computing services which are significantly faster.\n\nExample 1** (single-job processi... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | doNotClearWaveFunctionsToSequences | Dict[str, List[QWaveform]] | def doNotClearWaveFunctionsToSequences(self, maxEndTime: float = None) -> Dict[str, List[QWaveform]]:
"""
Convert all functions into sequence (including the QWaveform objects) that is serializable.
:param maxEndTime: maximum ending time
:return: dictionary containing the converted funct... |
Convert all functions into sequence (including the QWaveform objects) that is serializable.
:param maxEndTime: maximum ending time
:return: dictionary containing the converted functions
| Convert all functions into sequence (including the QWaveform objects) that is serializable. | [
"Convert",
"all",
"functions",
"into",
"sequence",
"(",
"including",
"the",
"QWaveform",
"objects",
")",
"that",
"is",
"serializable",
"."
] | def doNotClearWaveFunctionsToSequences(self, maxEndTime: float = None) -> Dict[str, List[QWaveform]]:
newList = {}
for waveKey in self._doNotClearFlagWaves:
newList[waveKey] = []
for wave in self._doNotClearFlagWaves[waveKey]:
seqWave = wave.waveFunctionToSequence... | [
"def",
"doNotClearWaveFunctionsToSequences",
"(",
"self",
",",
"maxEndTime",
":",
"float",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"[",
"QWaveform",
"]",
"]",
":",
"newList",
"=",
"{",
"}",
"for",
"waveKey",
"in",
"self",
".",
"_doNotCle... | Convert all functions into sequence (including the QWaveform objects) that is serializable. | [
"Convert",
"all",
"functions",
"into",
"sequence",
"(",
"including",
"the",
"QWaveform",
"objects",
")",
"that",
"is",
"serializable",
"."
] | [
"\"\"\"\n Convert all functions into sequence (including the QWaveform objects) that is serializable.\n\n :param maxEndTime: maximum ending time\n :return: dictionary containing the converted functions\n \"\"\"",
"# Add QWaveform"
] | [
{
"param": "self",
"type": null
},
{
"param": "maxEndTime",
"type": "float"
}
] | {
"returns": [
{
"docstring": "dictionary containing the converted functions",
"docstring_tokens": [
"dictionary",
"containing",
"the",
"converted",
"functions"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self"... |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | clone | 'QHamiltonian' | def clone(self) -> 'QHamiltonian':
"""
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) -> 'QHamiltonian':
return copy.deepcopy(self) | [
"def",
"clone",
"(",
"self",
")",
"->",
"'QHamiltonian'",
":",
"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": []
} |
a0ea7aa1406ecbe5f3d196f05acbd1f4c08871c1 | baidu/Quanlse | Quanlse/QHamiltonian.py | [
"Apache-2.0"
] | Python | load | 'QHamiltonian' | def load(base64Str: str) -> 'QHamiltonian':
"""
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: QHam object
"""
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr) # type: QHamiltonian
... |
Create object from base64 encoded string.
:param base64Str: a base64 encoded string
:return: QHam object
| Create object from base64 encoded string. | [
"Create",
"object",
"from",
"base64",
"encoded",
"string",
"."
] | def load(base64Str: str) -> 'QHamiltonian':
byteStr = base64.b64decode(base64Str.encode())
obj = pickle.loads(byteStr)
if obj.job is not None:
obj.job.parent = obj
for opKey in obj.job.waves.keys():
for wave in obj.job.waves[opKey]:
i... | [
"def",
"load",
"(",
"base64Str",
":",
"str",
")",
"->",
"'QHamiltonian'",
":",
"byteStr",
"=",
"base64",
".",
"b64decode",
"(",
"base64Str",
".",
"encode",
"(",
")",
")",
"obj",
"=",
"pickle",
".",
"loads",
"(",
"byteStr",
")",
"if",
"obj",
".",
"job... | 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: QHam object\n \"\"\"",
"# type: QHamiltonian",
"# Set job's parent",
"# For compatibility with previous versions"
] | [
{
"param": "base64Str",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "base64Str",
"type": "str",
"docstring": "a base64 encoded string",
"docstring_tokens": [
"a",
"base... |
f2b4181887398f97f74aeb5a0334bb228317a535 | baidu/Quanlse | Quanlse/remoteSimulator.py | [
"Apache-2.0"
] | Python | remoteSimulatorRunHamiltonian | QResult | def remoteSimulatorRunHamiltonian(ham: QHam, state0: ndarray = None, job: QJob = None,
jobList: QJobList = None, isOpen=False) -> QResult:
"""
Simulate the Hamiltonian using the Quanlse remote simulator.
:param ham: the QHamiltonian object.
:param state0: The initial s... |
Simulate the Hamiltonian using the Quanlse remote simulator.
:param ham: the QHamiltonian object.
:param state0: The initial state.
:param job: the QJob object.
:param jobList: The QJobList object.
:param isOpen: Run the simulation of open system using Lindblad master equation if true.
:re... | Simulate the Hamiltonian using the Quanlse remote simulator. | [
"Simulate",
"the",
"Hamiltonian",
"using",
"the",
"Quanlse",
"remote",
"simulator",
"."
] | def remoteSimulatorRunHamiltonian(ham: QHam, state0: ndarray = None, job: QJob = None,
jobList: QJobList = None, isOpen=False) -> QResult:
maxEndTime = None
kwargs = {}
if state0 is not None:
kwargs["state0"] = numpyMatrixToDictMatrix(state0)
if job is not None:... | [
"def",
"remoteSimulatorRunHamiltonian",
"(",
"ham",
":",
"QHam",
",",
"state0",
":",
"ndarray",
"=",
"None",
",",
"job",
":",
"QJob",
"=",
"None",
",",
"jobList",
":",
"QJobList",
"=",
"None",
",",
"isOpen",
"=",
"False",
")",
"->",
"QResult",
":",
"ma... | Simulate the Hamiltonian using the Quanlse remote simulator. | [
"Simulate",
"the",
"Hamiltonian",
"using",
"the",
"Quanlse",
"remote",
"simulator",
"."
] | [
"\"\"\"\n Simulate the Hamiltonian using the Quanlse remote simulator.\n\n :param ham: the QHamiltonian object.\n :param state0: The initial state.\n :param job: the QJob object.\n :param jobList: The QJobList object.\n :param isOpen: Run the simulation of open system using Lindblad master equatio... | [
{
"param": "ham",
"type": "QHam"
},
{
"param": "state0",
"type": "ndarray"
},
{
"param": "job",
"type": "QJob"
},
{
"param": "jobList",
"type": "QJobList"
},
{
"param": "isOpen",
"type": null
}
] | {
"returns": [
{
"docstring": "the QResult object.",
"docstring_tokens": [
"the",
"QResult",
"object",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "ham",
"type": "QHam",
"docstring": "the QHamiltonian ob... |
c0b32108bce878d7f926a03fee3aad9f749f3d18 | baidu/Quanlse | Quanlse/QOperation/RotationGate.py | [
"Apache-2.0"
] | Python | generateMatrix | numpy.ndarray | def generateMatrix(self) -> numpy.ndarray:
"""
Generate the matrix of rotation gate.
"""
self._generateUMatrix()
return self._matrix |
Generate the matrix of rotation gate.
| Generate the matrix of rotation gate. | [
"Generate",
"the",
"matrix",
"of",
"rotation",
"gate",
"."
] | def generateMatrix(self) -> numpy.ndarray:
self._generateUMatrix()
return self._matrix | [
"def",
"generateMatrix",
"(",
"self",
")",
"->",
"numpy",
".",
"ndarray",
":",
"self",
".",
"_generateUMatrix",
"(",
")",
"return",
"self",
".",
"_matrix"
] | Generate the matrix of rotation gate. | [
"Generate",
"the",
"matrix",
"of",
"rotation",
"gate",
"."
] | [
"\"\"\"\n Generate the matrix of rotation gate.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0b32108bce878d7f926a03fee3aad9f749f3d18 | baidu/Quanlse | Quanlse/QOperation/RotationGate.py | [
"Apache-2.0"
] | Python | _u3Matrix | numpy.ndarray | def _u3Matrix(self, theta: float, phi: float, lamda: float) -> numpy.ndarray:
"""
Generate a single-qubit rotation gate with 3 angles
:param theta: angle
:param phi: angle
:param lamda: angle
:return: U3 matrix
"""
self._matrix = numpy.array([[numpy.cos(... |
Generate a single-qubit rotation gate with 3 angles
:param theta: angle
:param phi: angle
:param lamda: angle
:return: U3 matrix
| Generate a single-qubit rotation gate with 3 angles | [
"Generate",
"a",
"single",
"-",
"qubit",
"rotation",
"gate",
"with",
"3",
"angles"
] | def _u3Matrix(self, theta: float, phi: float, lamda: float) -> numpy.ndarray:
self._matrix = numpy.array([[numpy.cos(theta / 2.0), -numpy.exp(1j * lamda) * numpy.sin(theta / 2.0)],
[numpy.exp(1j * phi) * numpy.sin(theta / 2.0),
numpy.exp(1... | [
"def",
"_u3Matrix",
"(",
"self",
",",
"theta",
":",
"float",
",",
"phi",
":",
"float",
",",
"lamda",
":",
"float",
")",
"->",
"numpy",
".",
"ndarray",
":",
"self",
".",
"_matrix",
"=",
"numpy",
".",
"array",
"(",
"[",
"[",
"numpy",
".",
"cos",
"(... | Generate a single-qubit rotation gate with 3 angles | [
"Generate",
"a",
"single",
"-",
"qubit",
"rotation",
"gate",
"with",
"3",
"angles"
] | [
"\"\"\"\n Generate a single-qubit rotation gate with 3 angles\n\n :param theta: angle\n :param phi: angle\n :param lamda: angle\n :return: U3 matrix\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "theta",
"type": "float"
},
{
"param": "phi",
"type": "float"
},
{
"param": "lamda",
"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
... |
c0b32108bce878d7f926a03fee3aad9f749f3d18 | baidu/Quanlse | Quanlse/QOperation/RotationGate.py | [
"Apache-2.0"
] | Python | _u2Matrix | numpy.ndarray | def _u2Matrix(self, phi: float, lamda: float) -> numpy.ndarray:
"""
Generate a single-qubit rotation gate with 2 angles
:param phi: angle
:param lamda: angle
:return: U2 matrix
"""
self._matrix = (1 / numpy.sqrt(2)) * numpy.array([[1, -numpy.exp(1j * lamda)],
... |
Generate a single-qubit rotation gate with 2 angles
:param phi: angle
:param lamda: angle
:return: U2 matrix
| Generate a single-qubit rotation gate with 2 angles | [
"Generate",
"a",
"single",
"-",
"qubit",
"rotation",
"gate",
"with",
"2",
"angles"
] | def _u2Matrix(self, phi: float, lamda: float) -> numpy.ndarray:
self._matrix = (1 / numpy.sqrt(2)) * numpy.array([[1, -numpy.exp(1j * lamda)],
[numpy.exp(1j * phi), numpy.exp(1j * (phi + lamda))]])
return self._matrix | [
"def",
"_u2Matrix",
"(",
"self",
",",
"phi",
":",
"float",
",",
"lamda",
":",
"float",
")",
"->",
"numpy",
".",
"ndarray",
":",
"self",
".",
"_matrix",
"=",
"(",
"1",
"/",
"numpy",
".",
"sqrt",
"(",
"2",
")",
")",
"*",
"numpy",
".",
"array",
"(... | Generate a single-qubit rotation gate with 2 angles | [
"Generate",
"a",
"single",
"-",
"qubit",
"rotation",
"gate",
"with",
"2",
"angles"
] | [
"\"\"\"\n Generate a single-qubit rotation gate with 2 angles\n\n :param phi: angle\n :param lamda: angle\n :return: U2 matrix\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "phi",
"type": "float"
},
{
"param": "lamda",
"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
... |
c0b32108bce878d7f926a03fee3aad9f749f3d18 | baidu/Quanlse | Quanlse/QOperation/RotationGate.py | [
"Apache-2.0"
] | Python | U | 'OperationFunc' | def U(theta: 'RotationArgument',
phi: Optional['RotationArgument'] = None,
lamda: Optional['RotationArgument'] = None) -> 'OperationFunc':
"""
U Gate
Generate a single-qubit U1 (or U2 or U3) gate according to the number of angles.
"""
uGateArgumentList = angleList = [value for value in ... |
U Gate
Generate a single-qubit U1 (or U2 or U3) gate according to the number of angles.
| U Gate
Generate a single-qubit U1 (or U2 or U3) gate according to the number of angles. | [
"U",
"Gate",
"Generate",
"a",
"single",
"-",
"qubit",
"U1",
"(",
"or",
"U2",
"or",
"U3",
")",
"gate",
"according",
"to",
"the",
"number",
"of",
"angles",
"."
] | def U(theta: 'RotationArgument',
phi: Optional['RotationArgument'] = None,
lamda: Optional['RotationArgument'] = None) -> 'OperationFunc':
uGateArgumentList = angleList = [value for value in [theta, phi, lamda] if value is not None]
gate = RotationGateOP('U', 1, angleList, uGateArgumentList)
gat... | [
"def",
"U",
"(",
"theta",
":",
"'RotationArgument'",
",",
"phi",
":",
"Optional",
"[",
"'RotationArgument'",
"]",
"=",
"None",
",",
"lamda",
":",
"Optional",
"[",
"'RotationArgument'",
"]",
"=",
"None",
")",
"->",
"'OperationFunc'",
":",
"uGateArgumentList",
... | U Gate
Generate a single-qubit U1 (or U2 or U3) gate according to the number of angles. | [
"U",
"Gate",
"Generate",
"a",
"single",
"-",
"qubit",
"U1",
"(",
"or",
"U2",
"or",
"U3",
")",
"gate",
"according",
"to",
"the",
"number",
"of",
"angles",
"."
] | [
"\"\"\"\n U Gate\n\n Generate a single-qubit U1 (or U2 or U3) gate according to the number of angles.\n \"\"\""
] | [
{
"param": "theta",
"type": "'RotationArgument'"
},
{
"param": "phi",
"type": "Optional['RotationArgument']"
},
{
"param": "lamda",
"type": "Optional['RotationArgument']"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "theta",
"type": "'RotationArgument'",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "phi",
"type": "Optional['RotationArgument']",
"doc... |
9a741ed1cb90a7d4c4d1cdf6a2855519a4f319fd | baidu/Quanlse | Quanlse/Utils/ODESolver.py | [
"Apache-2.0"
] | Python | _cacheDictToList | <not_specific> | def _cacheDictToList(ctrlCache: Dict[str, Any], waveCache: Dict[str, Any]):
"""
Convert the dict type cache to the list type.
"""
# Initialize ctrlList and waveList
_ctrlList, _waveList = [], []
for ctrlKey in ctrlCache:
_ctrlList.append(ctrlCache[ctrlKey])
_waveList.append(array... |
Convert the dict type cache to the list type.
| Convert the dict type cache to the list type. | [
"Convert",
"the",
"dict",
"type",
"cache",
"to",
"the",
"list",
"type",
"."
] | def _cacheDictToList(ctrlCache: Dict[str, Any], waveCache: Dict[str, Any]):
_ctrlList, _waveList = [], []
for ctrlKey in ctrlCache:
_ctrlList.append(ctrlCache[ctrlKey])
_waveList.append(array(waveCache[ctrlKey]))
return _ctrlList, _waveList | [
"def",
"_cacheDictToList",
"(",
"ctrlCache",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"waveCache",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"_ctrlList",
",",
"_waveList",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"ctrlKey",
"in",
"ctrlC... | Convert the dict type cache to the list type. | [
"Convert",
"the",
"dict",
"type",
"cache",
"to",
"the",
"list",
"type",
"."
] | [
"\"\"\"\n Convert the dict type cache to the list type.\n \"\"\"",
"# Initialize ctrlList and waveList"
] | [
{
"param": "ctrlCache",
"type": "Dict[str, Any]"
},
{
"param": "waveCache",
"type": "Dict[str, Any]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctrlCache",
"type": "Dict[str, Any]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "waveCache",
"type": "Dict[str, Any]",
"docstring":... |
9a741ed1cb90a7d4c4d1cdf6a2855519a4f319fd | baidu/Quanlse | Quanlse/Utils/ODESolver.py | [
"Apache-2.0"
] | Python | solverNormal | <not_specific> | def solverNormal(ham: 'QHamiltonian', state0=None, shot=None, recordEvolution=False, accelerate=False):
"""
Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing.
:param ham: QHamiltonian object
:param state0: the initial ... |
Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing.
:param ham: QHamiltonian object
:param state0: the initial state vector. If None is given, this function will return the time-ordered
evolution operato... | Calculate the unitary evolution operator with a given Hamiltonian. This function supports
both single-job and batch-job processing. | [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
".",
"This",
"function",
"supports",
"both",
"single",
"-",
"job",
"and",
"batch",
"-",
"job",
"processing",
"."
] | def solverNormal(ham: 'QHamiltonian', state0=None, shot=None, recordEvolution=False, accelerate=False):
if accelerate:
from Quanlse.Utils.NumbaSupport import expm
else:
from scipy.linalg import expm
sysLevelLen = 1 if isinstance(ham.sysLevel, int) else len(ham.sysLevel)
sysLevel = [ham.s... | [
"def",
"solverNormal",
"(",
"ham",
":",
"'QHamiltonian'",
",",
"state0",
"=",
"None",
",",
"shot",
"=",
"None",
",",
"recordEvolution",
"=",
"False",
",",
"accelerate",
"=",
"False",
")",
":",
"if",
"accelerate",
":",
"from",
"Quanlse",
".",
"Utils",
"."... | Calculate the unitary evolution operator with a given Hamiltonian. | [
"Calculate",
"the",
"unitary",
"evolution",
"operator",
"with",
"a",
"given",
"Hamiltonian",
"."
] | [
"\"\"\"\n Calculate the unitary evolution operator with a given Hamiltonian. This function supports\n both single-job and batch-job processing.\n\n :param ham: QHamiltonian object\n :param state0: the initial state vector. If None is given, this function will return the time-ordered\n ... | [
{
"param": "ham",
"type": "'QHamiltonian'"
},
{
"param": "state0",
"type": null
},
{
"param": "shot",
"type": null
},
{
"param": "recordEvolution",
"type": null
},
{
"param": "accelerate",
"type": null
}
] | {
"returns": [
{
"docstring": "result dictionary (or a list of result dictionaries when ``jobList`` is provided)",
"docstring_tokens": [
"result",
"dictionary",
"(",
"or",
"a",
"list",
"of",
"result",
"dictionaries",
"when... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.