Python API Reference¶
qulacs¶
cppsim python interface
- class qulacs_core.CausalConeSimulator¶
Bases:
pybind11_builtins.pybind11_object
- build(self: qulacs_core.CausalConeSimulator) None ¶
Build
- get_circuit_list(self: qulacs_core.CausalConeSimulator) List[List[qulacs_core.ParametricQuantumCircuit]] ¶
Return circuit_list
- get_coef_list(self: qulacs_core.CausalConeSimulator) List[complex] ¶
Return coef_list
- get_expectation_value(self: qulacs_core.CausalConeSimulator) complex ¶
Return expectation_value
- get_pauli_operator_list(self: qulacs_core.CausalConeSimulator) List[List[qulacs_core.PauliOperator]] ¶
Return pauli_operator_list
- class qulacs_core.ClsNoisyEvolution¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsNoisyEvolution_fast¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsOneControlOneTargetGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsOneQubitGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsOneQubitRotationGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsPauliGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsPauliRotationGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsReversibleBooleanGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsStateReflectionGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.ClsTwoQubitGate¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.DensityMatrix¶
Bases:
qulacs_core.QuantumStateBase
- add_state(self: qulacs_core.DensityMatrix, state: qulacs_core.QuantumStateBase) None ¶
Add state vector to this state
- allocate_buffer(self: qulacs_core.DensityMatrix) qulacs_core.DensityMatrix ¶
Allocate buffer with the same size
- copy(self: qulacs_core.DensityMatrix) qulacs_core.DensityMatrix ¶
Create copied insntace
- get_classical_value(self: qulacs_core.DensityMatrix, index: int) int ¶
Get classical value
- get_device_name(self: qulacs_core.DensityMatrix) str ¶
Get allocated device name
- get_entropy(self: qulacs_core.DensityMatrix) float ¶
Get entropy
- get_marginal_probability(self: qulacs_core.DensityMatrix, measured_values: List[int]) float ¶
Get merginal probability for measured values
- get_matrix(self: qulacs_core.DensityMatrix) numpy.ndarray[numpy.complex128[m, n]] ¶
Get density matrix
- get_qubit_count(self: qulacs_core.DensityMatrix) int ¶
Get qubit count
- get_squared_norm(self: qulacs_core.DensityMatrix) float ¶
Get squared norm
- get_zero_probability(self: qulacs_core.DensityMatrix, index: int) float ¶
Get probability with which we obtain 0 when we measure a qubit
- load(*args, **kwargs)¶
Overloaded function.
load(self: qulacs_core.DensityMatrix, state: qulacs_core.QuantumStateBase) -> None
Load quantum state vector or density matrix
load(self: qulacs_core.DensityMatrix, state: List[complex]) -> None
load(self: qulacs_core.DensityMatrix, state: numpy.ndarray[numpy.complex128[m, n]]) -> None
- multiply_coef(self: qulacs_core.DensityMatrix, coef: complex) None ¶
Multiply coefficient to this state
- normalize(self: qulacs_core.DensityMatrix, squared_norm: float) None ¶
Normalize quantum state
- sampling(*args, **kwargs)¶
Overloaded function.
sampling(self: qulacs_core.DensityMatrix, sampling_count: int) -> List[int]
Sampling measurement results
sampling(self: qulacs_core.DensityMatrix, sampling_count: int, random_seed: int) -> List[int]
- set_Haar_random_state(*args, **kwargs)¶
Overloaded function.
set_Haar_random_state(self: qulacs_core.DensityMatrix) -> None
Set Haar random state
set_Haar_random_state(self: qulacs_core.DensityMatrix, seed: int) -> None
- set_classical_value(self: qulacs_core.DensityMatrix, index: int, value: int) None ¶
Set classical value
- set_computational_basis(self: qulacs_core.DensityMatrix, comp_basis: int) None ¶
Set state to computational basis
- set_zero_state(self: qulacs_core.DensityMatrix) None ¶
Set state to |0>
- to_string(self: qulacs_core.DensityMatrix) str ¶
to string
- class qulacs_core.GeneralQuantumOperator¶
Bases:
pybind11_builtins.pybind11_object
- add_operator(*args, **kwargs)¶
Overloaded function.
add_operator(self: qulacs_core.GeneralQuantumOperator, pauli_operator: qulacs_core.PauliOperator) -> None
Add Pauli operator
add_operator(self: qulacs_core.GeneralQuantumOperator, coef: complex, pauli_string: str) -> None
- add_operator_copy(self: qulacs_core.GeneralQuantumOperator, pauli_operator: qulacs_core.PauliOperator) None ¶
Add Pauli operator
- add_operator_move(self: qulacs_core.GeneralQuantumOperator, pauli_operator: qulacs_core.PauliOperator) None ¶
Add Pauli operator
- apply_to_state(*args, **kwargs)¶
Overloaded function.
apply_to_state(self: qulacs_core.GeneralQuantumOperator, work_state: QuantumStateBase, state_to_be_multiplied: QuantumStateBase, dst_state: QuantumStateBase) -> None
Apply observable to state_to_be_multiplied. The result is stored into dst_state.
apply_to_state(self: qulacs_core.GeneralQuantumOperator, state_to_be_multiplied: QuantumStateBase, dst_state: QuantumStateBase) -> None
- copy(self: qulacs_core.GeneralQuantumOperator) qulacs_core.GeneralQuantumOperator ¶
Create copied instance of General Quantum operator class
- get_expectation_value(self: qulacs_core.GeneralQuantumOperator, state: QuantumStateBase) complex ¶
Get expectation value
- get_expectation_value_single_thread(self: qulacs_core.GeneralQuantumOperator, state: QuantumStateBase) complex ¶
Get expectation value
- get_qubit_count(self: qulacs_core.GeneralQuantumOperator) int ¶
Get qubit count
- get_state_dim(self: qulacs_core.GeneralQuantumOperator) int ¶
Get state dimension
- get_term(self: qulacs_core.GeneralQuantumOperator, index: int) qulacs_core.PauliOperator ¶
Get Pauli term
- get_term_count(self: qulacs_core.GeneralQuantumOperator) int ¶
Get count of Pauli terms
- get_transition_amplitude(self: qulacs_core.GeneralQuantumOperator, state_bra: QuantumStateBase, state_ket: QuantumStateBase) complex ¶
Get transition amplitude
- is_hermitian(self: qulacs_core.GeneralQuantumOperator) bool ¶
Get is Herimitian
- class qulacs_core.GradCalculator¶
Bases:
pybind11_builtins.pybind11_object
- calculate_grad(*args, **kwargs)¶
Overloaded function.
calculate_grad(self: qulacs_core.GradCalculator, parametric_circuit: qulacs_core.ParametricQuantumCircuit, observable: qulacs_core.Observable) -> List[complex]
Calculate Grad
calculate_grad(self: qulacs_core.GradCalculator, parametric_circuit: qulacs_core.ParametricQuantumCircuit, observable: qulacs_core.Observable, angles_of_gates: List[float]) -> List[complex]
- class qulacs_core.NoiseSimulator¶
Bases:
pybind11_builtins.pybind11_object
- execute(self: qulacs_core.NoiseSimulator, arg0: int) List[int] ¶
Sampling & Return result [array]
- execute_and_get_result(self: qulacs_core.NoiseSimulator, arg0: int) qulacs_core.SimulationResult ¶
Simulate & Return ressult [array of (state, frequency)]
- class qulacs_core.Observable¶
Bases:
qulacs_core.GeneralQuantumOperator
- add_operator(*args, **kwargs)¶
Overloaded function.
add_operator(self: qulacs_core.Observable, pauli_operator: qulacs_core.PauliOperator) -> None
Add Pauli operator
add_operator(self: qulacs_core.Observable, coef: complex, string: str) -> None
- add_operator_copy(self: qulacs_core.Observable, pauli_operator: qulacs_core.PauliOperator) None ¶
Add Pauli operator
- add_operator_move(self: qulacs_core.Observable, pauli_operator: qulacs_core.PauliOperator) None ¶
Add Pauli operator
- add_random_operator(*args, **kwargs)¶
Overloaded function.
add_random_operator(self: qulacs_core.Observable, operator_count: int) -> None
Add random pauli operator
add_random_operator(self: qulacs_core.Observable, operator_count: int, seed: int) -> None
- apply_to_state(self: qulacs_core.Observable, work_state: QuantumStateBase, state_to_be_multiplied: QuantumStateBase, dst_state: QuantumStateBase) None ¶
Apply observable to state_to_be_multiplied. The result is stored into dst_state.
- get_expectation_value(self: qulacs_core.Observable, state: QuantumStateBase) float ¶
Get expectation value
- get_expectation_value_single_thread(self: qulacs_core.Observable, state: QuantumStateBase) float ¶
Get expectation value
- get_qubit_count(self: qulacs_core.Observable) int ¶
Get qubit count
- get_state_dim(self: qulacs_core.Observable) int ¶
Get state dimension
- get_term(self: qulacs_core.Observable, index: int) qulacs_core.PauliOperator ¶
Get Pauli term
- get_term_count(self: qulacs_core.Observable) int ¶
Get count of Pauli terms
- get_transition_amplitude(self: qulacs_core.Observable, state_bra: QuantumStateBase, state_ket: QuantumStateBase) complex ¶
Get transition amplitude
- solve_ground_state_eigenvalue_by_arnoldi_method(self: qulacs_core.Observable, state: QuantumStateBase, iter_count: int, mu: complex = 0.0) complex ¶
Compute ground state eigenvalue by arnoldi method
- solve_ground_state_eigenvalue_by_lanczos_method(self: qulacs_core.Observable, state: QuantumStateBase, iter_count: int, mu: complex = 0.0) complex ¶
Compute ground state eigenvalue by lanczos method
- solve_ground_state_eigenvalue_by_power_method(self: qulacs_core.Observable, state: QuantumStateBase, iter_count: int, mu: complex = 0.0) complex ¶
Compute ground state eigenvalue by power method
- class qulacs_core.ParametricQuantumCircuit¶
Bases:
qulacs_core.QuantumCircuit
- add_gate(*args, **kwargs)¶
Overloaded function.
add_gate(self: qulacs_core.ParametricQuantumCircuit, gate: qulacs_core.QuantumGateBase) -> None
Add gate
add_gate(self: qulacs_core.ParametricQuantumCircuit, gate: qulacs_core.QuantumGateBase, position: int) -> None
- add_parametric_RX_gate(self: qulacs_core.ParametricQuantumCircuit, index: int, angle: float) None ¶
Add parametric Pauli-X rotation gate
- add_parametric_RY_gate(self: qulacs_core.ParametricQuantumCircuit, index: int, angle: float) None ¶
Add parametric Pauli-Y rotation gate
- add_parametric_RZ_gate(self: qulacs_core.ParametricQuantumCircuit, index: int, angle: float) None ¶
Add parametric Pauli-Z rotation gate
- add_parametric_gate(*args, **kwargs)¶
Overloaded function.
add_parametric_gate(self: qulacs_core.ParametricQuantumCircuit, gate: qulacs_core.QuantumGate_SingleParameter) -> None
Add parametric gate
add_parametric_gate(self: qulacs_core.ParametricQuantumCircuit, gate: qulacs_core.QuantumGate_SingleParameter, position: int) -> None
- add_parametric_multi_Pauli_rotation_gate(self: qulacs_core.ParametricQuantumCircuit, index_list: List[int], pauli_ids: List[int], angle: float) None ¶
Add parametric multi-qubit Pauli rotation gate
- backprop(self: qulacs_core.ParametricQuantumCircuit, obs: qulacs_core.GeneralQuantumOperator) List[float] ¶
Do backprop
- backprop_inner_product(self: qulacs_core.ParametricQuantumCircuit, state: qulacs_core.QuantumState) List[float] ¶
Do backprop with innder product
- copy(self: qulacs_core.ParametricQuantumCircuit) qulacs_core.ParametricQuantumCircuit ¶
Create copied instance
- get_parameter(self: qulacs_core.ParametricQuantumCircuit, index: int) float ¶
Get parameter
- get_parameter_count(self: qulacs_core.ParametricQuantumCircuit) int ¶
Get parameter count
- get_parametric_gate_position(self: qulacs_core.ParametricQuantumCircuit, index: int) int ¶
Get parametric gate position
- merge_circuit(self: qulacs_core.ParametricQuantumCircuit, circuit: qulacs_core.ParametricQuantumCircuit) None ¶
Merge another ParametricQuantumCircuit
- remove_gate(self: qulacs_core.ParametricQuantumCircuit, position: int) None ¶
Remove gate
- set_parameter(self: qulacs_core.ParametricQuantumCircuit, index: int, parameter: float) None ¶
Set parameter
- class qulacs_core.PauliOperator¶
Bases:
pybind11_builtins.pybind11_object
- add_single_Pauli(self: qulacs_core.PauliOperator, index: int, pauli_type: int) None ¶
Add Pauli operator to this term
- change_coef(self: qulacs_core.PauliOperator, new_coef: complex) None ¶
Change coefficient
- copy(self: qulacs_core.PauliOperator) qulacs_core.PauliOperator ¶
Create copied instance of Pauli operator class
- get_coef(self: qulacs_core.PauliOperator) complex ¶
Get coefficient of Pauli term
- get_expectation_value(self: qulacs_core.PauliOperator, state: QuantumStateBase) complex ¶
Get expectation value
- get_expectation_value_single_thread(self: qulacs_core.PauliOperator, state: QuantumStateBase) complex ¶
Get expectation value
- get_index_list(self: qulacs_core.PauliOperator) List[int] ¶
Get list of target qubit indices
- get_pauli_id_list(self: qulacs_core.PauliOperator) List[int] ¶
Get list of Pauli IDs (I,X,Y,Z) = (0,1,2,3)
- get_pauli_string(self: qulacs_core.PauliOperator) str ¶
Get pauli string
- get_transition_amplitude(self: qulacs_core.PauliOperator, state_bra: QuantumStateBase, state_ket: QuantumStateBase) complex ¶
Get transition amplitude
- class qulacs_core.QuantumCircuit¶
Bases:
pybind11_builtins.pybind11_object
- add_CNOT_gate(self: qulacs_core.QuantumCircuit, control: int, target: int) None ¶
Add CNOT gate
- add_CZ_gate(self: qulacs_core.QuantumCircuit, control: int, target: int) None ¶
Add CNOT gate
- add_H_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add Hadamard gate
- add_P0_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add projection gate to |0> subspace
- add_P1_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add projection gate to |1> subspace
- add_RX_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-X rotation gate
- add_RY_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Y rotation gate
- add_RZ_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Z rotation gate
- add_RotInvX_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-X rotation gate
- add_RotInvY_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Y rotation gate
- add_RotInvZ_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Z rotation gate
- add_RotX_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-X rotation gate
- add_RotY_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Y rotation gate
- add_RotZ_gate(self: qulacs_core.QuantumCircuit, index: int, angle: float) None ¶
Add Pauli-Z rotation gate
- add_SWAP_gate(self: qulacs_core.QuantumCircuit, target1: int, target2: int) None ¶
Add SWAP gate
- add_S_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add pi/4 phase gate
- add_Sdag_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add adjoint of pi/4 phsae gate
- add_T_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add pi/8 phase gate
- add_Tdag_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add adjoint of pi/8 phase gate
- add_U1_gate(self: qulacs_core.QuantumCircuit, index: int, lambda_: float) None ¶
Add QASM U1 gate
- add_U2_gate(self: qulacs_core.QuantumCircuit, index: int, phi: float, lambda_: float) None ¶
Add QASM U2 gate
- add_U3_gate(self: qulacs_core.QuantumCircuit, index: int, theta: float, phi: float, lambda_: float) None ¶
Add QASM U3 gate
- add_X_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add Pauli-X gate
- add_Y_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add Pauli-Y gate
- add_Z_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add Pauli-Z gate
- add_dense_matrix_gate(*args, **kwargs)¶
Overloaded function.
add_dense_matrix_gate(self: qulacs_core.QuantumCircuit, index: int, matrix: numpy.ndarray[numpy.complex128[m, n]]) -> None
Add dense matrix gate
add_dense_matrix_gate(self: qulacs_core.QuantumCircuit, index_list: List[int], matrix: numpy.ndarray[numpy.complex128[m, n]]) -> None
- add_diagonal_observable_rotation_gate(self: qulacs_core.QuantumCircuit, observable: qulacs_core.Observable, angle: float) None ¶
Add diagonal observable rotation gate
- add_gate(*args, **kwargs)¶
Overloaded function.
add_gate(self: qulacs_core.QuantumCircuit, gate: qulacs_core.QuantumGateBase) -> None
Add gate with copy
add_gate(self: qulacs_core.QuantumCircuit, gate: qulacs_core.QuantumGateBase, position: int) -> None
- add_multi_Pauli_gate(*args, **kwargs)¶
Overloaded function.
add_multi_Pauli_gate(self: qulacs_core.QuantumCircuit, index_list: List[int], pauli_ids: List[int]) -> None
Add multi-qubit Pauli gate
add_multi_Pauli_gate(self: qulacs_core.QuantumCircuit, pauli: qulacs_core.PauliOperator) -> None
- add_multi_Pauli_rotation_gate(*args, **kwargs)¶
Overloaded function.
add_multi_Pauli_rotation_gate(self: qulacs_core.QuantumCircuit, index_list: List[int], pauli_ids: List[int], angle: float) -> None
Add multi-qubit Pauli rotation gate
add_multi_Pauli_rotation_gate(self: qulacs_core.QuantumCircuit, pauli: qulacs_core.PauliOperator) -> None
- add_noise_gate(self: qulacs_core.QuantumCircuit, gate: qulacs_core.QuantumGateBase, NoiseType: str, NoiseProbability: float) None ¶
Add noise gate with copy
- add_observable_rotation_gate(self: qulacs_core.QuantumCircuit, observable: qulacs_core.Observable, angle: float, repeat: int) None ¶
Add observable rotation gate
- add_random_unitary_gate(*args, **kwargs)¶
Overloaded function.
add_random_unitary_gate(self: qulacs_core.QuantumCircuit, index_list: List[int]) -> None
Add random unitary gate
add_random_unitary_gate(self: qulacs_core.QuantumCircuit, index_list: List[int], seed: int) -> None
- add_sqrtX_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add pi/4 Pauli-X rotation gate
- add_sqrtXdag_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add adjoint of pi/4 Pauli-X rotation gate
- add_sqrtY_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add pi/4 Pauli-Y rotation gate
- add_sqrtYdag_gate(self: qulacs_core.QuantumCircuit, index: int) None ¶
Add adjoint of pi/4 Pauli-Y rotation gate
- calculate_depth(self: qulacs_core.QuantumCircuit) int ¶
Calculate depth of circuit
- copy(self: qulacs_core.QuantumCircuit) qulacs_core.QuantumCircuit ¶
Create copied instance
- get_gate(self: qulacs_core.QuantumCircuit, position: int) qulacs_core.QuantumGateBase ¶
Get gate instance
- get_gate_count(self: qulacs_core.QuantumCircuit) int ¶
Get gate count
- get_inverse(self: qulacs_core.QuantumCircuit) qulacs_core.QuantumCircuit ¶
get inverse circuit
- get_qubit_count(self: qulacs_core.QuantumCircuit) int ¶
Get qubit count
- merge_circuit(self: qulacs_core.QuantumCircuit, circuit: qulacs_core.QuantumCircuit) None ¶
- remove_gate(self: qulacs_core.QuantumCircuit, position: int) None ¶
Remove gate
- to_string(self: qulacs_core.QuantumCircuit) str ¶
Get string representation
- update_quantum_state(*args, **kwargs)¶
Overloaded function.
update_quantum_state(self: qulacs_core.QuantumCircuit, state: qulacs_core.QuantumStateBase) -> None
Update quantum state
update_quantum_state(self: qulacs_core.QuantumCircuit, state: qulacs_core.QuantumStateBase, start: int, end: int) -> None
- class qulacs_core.QuantumCircuitSimulator¶
Bases:
pybind11_builtins.pybind11_object
- copy_state_from_buffer(self: qulacs_core.QuantumCircuitSimulator) None ¶
Copy buffer to state
- copy_state_to_buffer(self: qulacs_core.QuantumCircuitSimulator) None ¶
Copy state to buffer
- get_expectation_value(self: qulacs_core.QuantumCircuitSimulator, observable: qulacs_core.Observable) complex ¶
Get expectation value
- get_gate_count(self: qulacs_core.QuantumCircuitSimulator) int ¶
Get gate count
- initialize_random_state(*args, **kwargs)¶
Overloaded function.
initialize_random_state(self: qulacs_core.QuantumCircuitSimulator) -> None
Initialize state with random pure state
initialize_random_state(self: qulacs_core.QuantumCircuitSimulator, seed: int) -> None
- initialize_state(self: qulacs_core.QuantumCircuitSimulator, arg0: int) None ¶
Initialize state
- simulate(self: qulacs_core.QuantumCircuitSimulator) None ¶
Simulate circuit
- simulate_range(self: qulacs_core.QuantumCircuitSimulator, start: int, end: int) None ¶
Simulate circuit
- swap_state_and_buffer(self: qulacs_core.QuantumCircuitSimulator) None ¶
Swap state and buffer
- class qulacs_core.QuantumGateBase¶
Bases:
pybind11_builtins.pybind11_object
- copy(self: qulacs_core.QuantumGateBase) qulacs_core.QuantumGateBase ¶
Create copied instance
- get_control_index_list(self: qulacs_core.QuantumGateBase) List[int] ¶
Get control qubit index list
- get_control_index_value_list(self: qulacs_core.QuantumGateBase) List[Tuple[int, int]] ¶
Get control qubit pair index value list
- get_control_value_list(self: qulacs_core.QuantumGateBase) List[int] ¶
Get control qubit value list
- get_inverse(self: qulacs_core.QuantumGateBase) qulacs_core.QuantumGateBase ¶
get inverse gate
- get_matrix(self: qulacs_core.QuantumGateBase) numpy.ndarray[numpy.complex128[m, n]] ¶
Get gate matrix
- get_name(self: qulacs_core.QuantumGateBase) str ¶
Get gate name
- get_target_index_list(self: qulacs_core.QuantumGateBase) List[int] ¶
Get target qubit index list
- is_Clifford(self: qulacs_core.QuantumGateBase) bool ¶
Check this gate is element of Clifford group
- is_Gaussian(self: qulacs_core.QuantumGateBase) bool ¶
Check this gate is element of Gaussian group
- is_Pauli(self: qulacs_core.QuantumGateBase) bool ¶
Check this gate is element of Pauli group
- is_commute(self: qulacs_core.QuantumGateBase, gate: qulacs_core.QuantumGateBase) bool ¶
Check this gate commutes with a given gate
- is_diagonal(self: qulacs_core.QuantumGateBase) bool ¶
Check the gate matrix is diagonal
- is_parametric(self: qulacs_core.QuantumGateBase) bool ¶
Check this gate is parametric gate
- to_string(self: qulacs_core.QuantumGateBase) str ¶
to string
- update_quantum_state(self: qulacs_core.QuantumGateBase, state: qulacs_core.QuantumStateBase) None ¶
Update quantum state
- class qulacs_core.QuantumGateDiagonalMatrix¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.QuantumGateMatrix¶
Bases:
qulacs_core.QuantumGateBase
- add_control_qubit(self: qulacs_core.QuantumGateMatrix, index: int, control_value: int) None ¶
Add control qubit
- multiply_scalar(self: qulacs_core.QuantumGateMatrix, value: complex) None ¶
Multiply scalar value to gate matrix
- class qulacs_core.QuantumGateSparseMatrix¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.QuantumGate_Adaptive¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.QuantumGate_CP¶
Bases:
qulacs_core.QuantumGateBase
- class qulacs_core.QuantumGate_CPTP¶
Bases:
qulacs_core.QuantumGateBase
QuantumGate_Instrument
- class qulacs_core.QuantumGate_Probabilistic¶
Bases:
qulacs_core.QuantumGateBase
QuantumGate_ProbabilisticInstrument
- get_cumulative_distribution(self: qulacs_core.QuantumGate_Probabilistic) List[float] ¶
get_cumulative_distribution
- get_distribution(self: qulacs_core.QuantumGate_Probabilistic) List[float] ¶
get_distribution
- get_gate_list(self: qulacs_core.QuantumGate_Probabilistic) List[qulacs_core.QuantumGateBase] ¶
get_gate_list
- optimize_ProbablisticGate(self: qulacs_core.QuantumGate_Probabilistic) None ¶
optimize_ProbablisticGate
- class qulacs_core.QuantumGate_SingleParameter¶
Bases:
qulacs_core.QuantumGateBase
- copy(self: qulacs_core.QuantumGate_SingleParameter) qulacs_core.QuantumGate_SingleParameter ¶
Create copied instance
- get_parameter_value(self: qulacs_core.QuantumGate_SingleParameter) float ¶
Get parameter value
- set_parameter_value(self: qulacs_core.QuantumGate_SingleParameter, value: float) None ¶
Set parameter value
- class qulacs_core.QuantumState¶
Bases:
qulacs_core.QuantumStateBase
- add_state(self: qulacs_core.QuantumState, state: qulacs_core.QuantumStateBase) None ¶
Add state vector to this state
- allocate_buffer(self: qulacs_core.QuantumState) qulacs_core.QuantumState ¶
Allocate buffer with the same size
- copy(self: qulacs_core.QuantumState) qulacs_core.QuantumState ¶
Create copied instance
- get_amplitude(self: qulacs_core.QuantumState, comp_basis: int) complex ¶
Get Amplitude of a specified computational basis
- get_classical_value(self: qulacs_core.QuantumState, index: int) int ¶
Get classical value
- get_device_name(self: qulacs_core.QuantumState) str ¶
Get allocated device name
- get_entropy(self: qulacs_core.QuantumState) float ¶
Get entropy
- get_marginal_probability(self: qulacs_core.QuantumState, measured_values: List[int]) float ¶
Get merginal probability for measured values
- get_qubit_count(self: qulacs_core.QuantumState) int ¶
Get qubit count
- get_squared_norm(self: qulacs_core.QuantumState) float ¶
Get squared norm
- get_vector(self: qulacs_core.QuantumState) numpy.ndarray[numpy.complex128[m, 1]] ¶
Get state vector
- get_zero_probability(self: qulacs_core.QuantumState, index: int) float ¶
Get probability with which we obtain 0 when we measure a qubit
- load(*args, **kwargs)¶
Overloaded function.
load(self: qulacs_core.QuantumState, state: qulacs_core.QuantumStateBase) -> None
Load quantum state vector
load(self: qulacs_core.QuantumState, state: List[complex]) -> None
- multiply_coef(self: qulacs_core.QuantumState, coef: complex) None ¶
Multiply coefficient to this state
- multiply_elementwise_function(self: qulacs_core.QuantumState, func: Callable[[int], complex]) None ¶
Multiply elementwise function
- normalize(self: qulacs_core.QuantumState, squared_norm: float) None ¶
Normalize quantum state
- sampling(*args, **kwargs)¶
Overloaded function.
sampling(self: qulacs_core.QuantumState, sampling_count: int) -> List[int]
Sampling measurement results
sampling(self: qulacs_core.QuantumState, sampling_count: int, random_seed: int) -> List[int]
- set_Haar_random_state(*args, **kwargs)¶
Overloaded function.
set_Haar_random_state(self: qulacs_core.QuantumState) -> None
Set Haar random state
set_Haar_random_state(self: qulacs_core.QuantumState, seed: int) -> None
- set_classical_value(self: qulacs_core.QuantumState, index: int, value: int) None ¶
Set classical value
- set_computational_basis(self: qulacs_core.QuantumState, comp_basis: int) None ¶
Set state to computational basis
- set_zero_state(self: qulacs_core.QuantumState) None ¶
Set state to |0>
- to_string(self: qulacs_core.QuantumState) str ¶
to string
- class qulacs_core.QuantumStateBase¶
Bases:
pybind11_builtins.pybind11_object
- class qulacs_core.SimulationResult¶
Bases:
pybind11_builtins.pybind11_object
- get_count(self: qulacs_core.SimulationResult) int ¶
get state count
- get_frequency(self: qulacs_core.SimulationResult, arg0: int) int ¶
get state frequency
- get_state(self: qulacs_core.SimulationResult, arg0: int) qulacs_core.QuantumState ¶
get state
- qulacs_core.StateVector(arg0: int) qulacs_core.QuantumState ¶
StateVector
- qulacs_core.to_general_quantum_operator(gate: qulacs_core.QuantumGateBase, qubits: int, tol: float) qulacs_core.GeneralQuantumOperator ¶
qulacs.state¶
- qulacs_core.state.drop_qubit(state: qulacs_core.QuantumState, target: List[int], projection: List[int]) qulacs_core.QuantumState ¶
Drop qubits from state
- qulacs_core.state.inner_product(state_bra: qulacs_core.QuantumState, state_ket: qulacs_core.QuantumState) complex ¶
Get inner product
- qulacs_core.state.make_mixture(prob1: complex, state1: qulacs_core.QuantumStateBase, prob2: complex, state2: qulacs_core.QuantumStateBase) qulacs_core.DensityMatrix ¶
Create a mixed state
- qulacs_core.state.make_superposition(coef1: complex, state1: qulacs_core.QuantumState, coef2: complex, state2: qulacs_core.QuantumState) qulacs_core.QuantumState ¶
Create superposition of states
- qulacs_core.state.partial_trace(*args, **kwargs)¶
Overloaded function.
partial_trace(state: qulacs_core.QuantumState, target_traceout: List[int]) -> qulacs_core.DensityMatrix
Take partial trace
partial_trace(state: qulacs_core.DensityMatrix, target_traceout: List[int]) -> qulacs_core.DensityMatrix
- qulacs_core.state.permutate_qubit(*args, **kwargs)¶
Overloaded function.
permutate_qubit(state: qulacs_core.QuantumState, qubit_order: List[int]) -> qulacs_core.QuantumState
Permutate qubits from state
permutate_qubit(state: qulacs_core.DensityMatrix, qubit_order: List[int]) -> qulacs_core.DensityMatrix
- qulacs_core.state.tensor_product(*args, **kwargs)¶
Overloaded function.
tensor_product(state_left: qulacs_core.QuantumState, state_right: qulacs_core.QuantumState) -> qulacs_core.QuantumState
Get tensor product of states
tensor_product(state_left: qulacs_core.DensityMatrix, state_right: qulacs_core.DensityMatrix) -> qulacs_core.DensityMatrix
qulacs.gate¶
- qulacs_core.gate.Adaptive(*args, **kwargs)¶
Overloaded function.
Adaptive(gate: qulacs_core.QuantumGateBase, condition: Callable[[List[int]], bool]) -> qulacs_core.QuantumGateBase
Create adaptive gate
Adaptive(gate: qulacs_core.QuantumGateBase, condition: Callable[[List[int], int], bool], id: int) -> qulacs_core.QuantumGateBase
- qulacs_core.gate.AmplitudeDampingNoise(index: int, prob: float) qulacs_core.QuantumGate_CPTP ¶
Create amplitude damping noise
- qulacs_core.gate.BitFlipNoise(index: int, prob: float) qulacs_core.QuantumGate_Probabilistic ¶
Create bit-flip noise
- qulacs_core.gate.CNOT(control: int, target: int) qulacs_core.ClsOneControlOneTargetGate ¶
Create CNOT gate
- qulacs_core.gate.CP(kraus_list: List[qulacs_core.QuantumGateBase], state_normalize: bool, probability_normalize: bool, assign_zero_if_not_matched: bool) qulacs_core.QuantumGateBase ¶
Create completely-positive map
- qulacs_core.gate.CPTP(kraus_list: List[qulacs_core.QuantumGateBase]) qulacs_core.QuantumGateBase ¶
Create completely-positive trace preserving map
- qulacs_core.gate.CZ(control: int, target: int) qulacs_core.ClsOneControlOneTargetGate ¶
Create CZ gate
- qulacs_core.gate.DenseMatrix(*args, **kwargs)¶
Overloaded function.
DenseMatrix(index: int, matrix: numpy.ndarray[numpy.complex128[m, n]]) -> qulacs_core.QuantumGateMatrix
Create dense matrix gate
DenseMatrix(index_list: List[int], matrix: numpy.ndarray[numpy.complex128[m, n]]) -> qulacs_core.QuantumGateMatrix
- qulacs_core.gate.DephasingNoise(index: int, prob: float) qulacs_core.QuantumGate_Probabilistic ¶
Create dephasing noise
- qulacs_core.gate.DepolarizingNoise(index: int, prob: float) qulacs_core.QuantumGate_Probabilistic ¶
Create depolarizing noise
- qulacs_core.gate.DiagonalMatrix(index_list: List[int], diagonal_element: numpy.ndarray[numpy.complex128[m, 1]]) qulacs_core.QuantumGateDiagonalMatrix ¶
Create diagonal matrix gate
- qulacs_core.gate.FREDKIN(control: int, target1: int, target2: int) qulacs_core.QuantumGateMatrix ¶
Create FREDKIN gate
- qulacs_core.gate.H(index: int) qulacs_core.ClsOneQubitGate ¶
Create Hadamard gate
- qulacs_core.gate.Identity(index: int) qulacs_core.ClsOneQubitGate ¶
Create identity gate
- qulacs_core.gate.IndependentXZNoise(index: int, prob: float) qulacs_core.QuantumGate_Probabilistic ¶
Create independent XZ noise
- qulacs_core.gate.Instrument(kraus_list: List[qulacs_core.QuantumGateBase], register: int) qulacs_core.QuantumGateBase ¶
Create instruments
- qulacs_core.gate.Measurement(index: int, register: int) qulacs_core.QuantumGate_CPTP ¶
Create measurement gate
- qulacs_core.gate.NoisyEvolution(hamiltonian: qulacs_core.Observable, c_ops: List[qulacs_core.GeneralQuantumOperator], time: float, dt: float) qulacs_core.ClsNoisyEvolution ¶
Create noisy evolution
- qulacs_core.gate.NoisyEvolution_fast(hamiltonian: qulacs_core.Observable, c_ops: List[qulacs_core.GeneralQuantumOperator], time: float) qulacs_core.ClsNoisyEvolution_fast ¶
Create noisy evolution fast version
- qulacs_core.gate.P0(index: int) qulacs_core.ClsOneQubitGate ¶
Create projection gate to |0> subspace
- qulacs_core.gate.P1(index: int) qulacs_core.ClsOneQubitGate ¶
Create projection gate to |1> subspace
- qulacs_core.gate.ParametricPauliRotation(index_list: List[int], pauli_ids: List[int], angle: float) qulacs_core.QuantumGate_SingleParameter ¶
Create parametric multi-qubit Pauli rotation gate
- qulacs_core.gate.ParametricRX(index: int, angle: float) qulacs_core.QuantumGate_SingleParameter ¶
Create parametric Pauli-X rotation gate
- qulacs_core.gate.ParametricRY(index: int, angle: float) qulacs_core.QuantumGate_SingleParameter ¶
Create parametric Pauli-Y rotation gate
- qulacs_core.gate.ParametricRZ(index: int, angle: float) qulacs_core.QuantumGate_SingleParameter ¶
Create parametric Pauli-Z rotation gate
- qulacs_core.gate.Pauli(index_list: List[int], pauli_ids: List[int]) qulacs_core.ClsPauliGate ¶
Create multi-qubit Pauli gate
- qulacs_core.gate.PauliRotation(index_list: List[int], pauli_ids: List[int], angle: float) qulacs_core.ClsPauliRotationGate ¶
Create multi-qubit Pauli rotation
- qulacs_core.gate.Probabilistic(prob_list: List[float], gate_list: List[qulacs_core.QuantumGateBase]) qulacs_core.QuantumGateBase ¶
Create probabilistic gate
- qulacs_core.gate.ProbabilisticInstrument(prob_list: List[float], gate_list: List[qulacs_core.QuantumGateBase], register: int) qulacs_core.QuantumGateBase ¶
Create probabilistic instrument gate
- qulacs_core.gate.RX(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-X rotation gate
- qulacs_core.gate.RY(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Y rotation gate
- qulacs_core.gate.RZ(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Z rotation gate
- qulacs_core.gate.RandomUnitary(*args, **kwargs)¶
Overloaded function.
RandomUnitary(index_list: List[int]) -> qulacs_core.QuantumGateMatrix
Create random unitary gate
RandomUnitary(index_list: List[int], seed: int) -> qulacs_core.QuantumGateMatrix
- qulacs_core.gate.ReversibleBoolean(index_list: List[int], func: Callable[[int, int], int]) qulacs_core.ClsReversibleBooleanGate ¶
Create reversible boolean gate
- qulacs_core.gate.RotInvX(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-X rotation gate
- qulacs_core.gate.RotInvY(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Y rotation gate
- qulacs_core.gate.RotInvZ(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Z rotation gate
- qulacs_core.gate.RotX(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-X rotation gate
- qulacs_core.gate.RotY(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Y rotation gate
- qulacs_core.gate.RotZ(index: int, angle: float) qulacs_core.ClsOneQubitRotationGate ¶
Create Pauli-Z rotation gate
- qulacs_core.gate.S(index: int) qulacs_core.ClsOneQubitGate ¶
Create pi/4-phase gate
- qulacs_core.gate.SWAP(target1: int, target2: int) qulacs_core.ClsTwoQubitGate ¶
Create SWAP gate
- qulacs_core.gate.Sdag(index: int) qulacs_core.ClsOneQubitGate ¶
Create adjoint of pi/4-phase gate
- qulacs_core.gate.SparseMatrix(index_list: List[int], matrix: scipy.sparse.csc_matrix[numpy.complex128]) qulacs_core.QuantumGateSparseMatrix ¶
Create sparse matrix gate
- qulacs_core.gate.StateReflection(state: qulacs_core.QuantumState) qulacs_core.ClsStateReflectionGate ¶
Create state reflection gate
- qulacs_core.gate.T(index: int) qulacs_core.ClsOneQubitGate ¶
Create pi/8-phase gate
- qulacs_core.gate.TOFFOLI(control1: int, control2: int, target: int) qulacs_core.QuantumGateMatrix ¶
Create TOFFOLI gate
- qulacs_core.gate.Tdag(index: int) qulacs_core.ClsOneQubitGate ¶
Create adjoint of pi/8-phase gate
- qulacs_core.gate.TwoQubitDepolarizingNoise(index1: int, index2: int, prob: float) qulacs_core.QuantumGate_Probabilistic ¶
Create two-qubit depolarizing noise
- qulacs_core.gate.U1(index: int, lambda_: float) qulacs_core.QuantumGateMatrix ¶
Create QASM U1 gate
- qulacs_core.gate.U2(index: int, phi: float, lambda_: float) qulacs_core.QuantumGateMatrix ¶
Create QASM U2 gate
- qulacs_core.gate.U3(index: int, theta: float, phi: float, lambda_: float) qulacs_core.QuantumGateMatrix ¶
Create QASM U3 gate
- qulacs_core.gate.X(index: int) qulacs_core.ClsOneQubitGate ¶
Create Pauli-X gate
- qulacs_core.gate.Y(index: int) qulacs_core.ClsOneQubitGate ¶
Create Pauli-Y gate
- qulacs_core.gate.Z(index: int) qulacs_core.ClsOneQubitGate ¶
Create Pauli-Z gate
- qulacs_core.gate.add(*args, **kwargs)¶
Overloaded function.
add(gate1: qulacs_core.QuantumGateBase, gate2: qulacs_core.QuantumGateBase) -> qulacs_core.QuantumGateMatrix
Add quantum gate matrices
add(gate_list: List[qulacs_core.QuantumGateBase]) -> qulacs_core.QuantumGateMatrix
Add quantum gate matrices
- qulacs_core.gate.merge(*args, **kwargs)¶
Overloaded function.
merge(gate1: qulacs_core.QuantumGateBase, gate2: qulacs_core.QuantumGateBase) -> qulacs_core.QuantumGateMatrix
Merge two quantum gate or gate list
merge(gate_list: List[qulacs_core.QuantumGateBase]) -> qulacs_core.QuantumGateMatrix
- qulacs_core.gate.sqrtX(index: int) qulacs_core.ClsOneQubitGate ¶
Create pi/4 Pauli-X rotation gate
- qulacs_core.gate.sqrtXdag(index: int) qulacs_core.ClsOneQubitGate ¶
Create adjoint of pi/4 Pauli-X rotation gate
- qulacs_core.gate.sqrtY(index: int) qulacs_core.ClsOneQubitGate ¶
Create pi/4 Pauli-Y rotation gate
- qulacs_core.gate.sqrtYdag(index: int) qulacs_core.ClsOneQubitGate ¶
Create adjoint of pi/4 Pauli-Y rotation gate
- qulacs_core.gate.to_matrix_gate(gate: qulacs_core.QuantumGateBase) qulacs_core.QuantumGateMatrix ¶
Convert named gate to matrix gate
qulacs.observable¶
- qulacs_core.observable.create_observable_from_openfermion_file(file_path: str) qulacs_core.Observable ¶
Create GeneralQuantumOperator from openfermion file
- qulacs_core.observable.create_observable_from_openfermion_text(text: str) qulacs_core.Observable ¶
Create GeneralQuantumOperator from openfermion text
- qulacs_core.observable.create_split_observable(arg0: str) Tuple[qulacs_core.Observable, qulacs_core.Observable] ¶
qulacs.quantum_operator¶
- qulacs_core.quantum_operator.create_quantum_operator_from_openfermion_file(arg0: str) qulacs_core.GeneralQuantumOperator ¶
- qulacs_core.quantum_operator.create_quantum_operator_from_openfermion_text(arg0: str) qulacs_core.GeneralQuantumOperator ¶
- qulacs_core.quantum_operator.create_split_quantum_operator(arg0: str) Tuple[qulacs_core.GeneralQuantumOperator, qulacs_core.GeneralQuantumOperator] ¶
qulacs.circuit¶
- class qulacs_core.circuit.QuantumCircuitOptimizer¶
Bases:
pybind11_builtins.pybind11_object
- merge_all(self: qulacs_core.circuit.QuantumCircuitOptimizer, circuit: qulacs_core.QuantumCircuit) qulacs_core.QuantumGateMatrix ¶
- optimize(self: qulacs_core.circuit.QuantumCircuitOptimizer, circuit: qulacs_core.QuantumCircuit, block_size: int) None ¶
Optimize quantum circuit
- optimize_light(self: qulacs_core.circuit.QuantumCircuitOptimizer, circuit: qulacs_core.QuantumCircuit) None ¶
Optimize quantum circuit with light method