scaluq
Classes
Specific class of single-qubit-controlled Pauli-X gate. |
|
Specific class of single-qubit-controlled Pauli-Z gate. |
|
Quantum circuit represented as gate array |
|
Specific class of fused swap gate, which swap qubits in $[mathrm{qubit_index1},mathrm{qubit_index1}+mathrm{block_size})$ and qubits in $[mathrm{qubit_index2},mathrm{qubit_index2}+mathrm{block_size})$. |
|
General class of QuantumGate. |
|
<attribute '__doc__' of 'GateType' objects> |
|
Specific class of gate, which rotate global phase, represented as $e^{imathrm{phase}}I$. |
|
Specific class of Hadamard gate. |
|
Specific class of Pauli-I gate. |
|
Wrapper class of Kokkos's InitializationSettings. |
|
Specific class of single-qubit dense matrix gate. |
|
None |
|
Specific class of projection gate to $ket{0}$. |
|
Specific class of projection gate to $ket{1}$. |
|
Specific class of parametric multi-qubit pauli-rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}P}$. angle is given as param * pcoef. |
|
Specific class of parametric X rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}X}$. angle is given as param * pcoef. |
|
Specific class of parametric Y rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}Y}$. angle is given as param * pcoef. |
|
Specific class of parametric Z rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}Z}$. angle is given as param * pcoef. |
|
General class of parametric quantum gate. |
|
<attribute '__doc__' of 'ParamGateType' objects> |
|
Specific class of multi-qubit pauli gate, which applies single-qubit Pauli gate to each of qubit. |
|
Pauli operator as coef and tensor product of single pauli for each qubit. |
|
Specific class of multi-qubit pauli-rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}P}$. |
|
Specific class of X rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}X}$. |
|
Specific class of Y rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}Y}$. |
|
Specific class of Z rotation gate, represented as $e^{-ifrac{mathrm{angle}}{2}Z}$. |
|
Specific class of S gate, represented as $begin{bmatrix} |
|
Specific class of inverse of S gate. |
|
Specific class of sqrt(X) gate, represented as $begin{bmatrix} |
|
Specific class of inverse of sqrt(X) gate. |
|
Specific class of sqrt(Y) gate, represented as $begin{bmatrix} |
|
Specific class of inverse of sqrt(Y) gate. |
|
Vector representation of quantum state. |
|
Specific class of two-qubit swap gate. |
|
Specific class of T gate, represented as $begin{bmatrix} |
|
Specific class of inverse of T gate. |
|
Specific class of double-qubit dense matrix gate. |
|
Specific class of IBMQ's U1 Gate, which is a rotation abount Z-axis, represented as $begin{bmatrix} |
|
Specific class of IBMQ's U2 Gate, which is a rotation about X+Z-axis, represented as $frac{1}{sqrt{2}} begin{bmatrix}1 & -e^{-ilambda}\ |
|
Specific class of IBMQ's U3 Gate, which is a rotation abount 3 axis, represented as $begin{bmatrix} |
|
Specific class of Pauli-X gate. |
|
Specific class of Pauli-Y gate. |
|
Specific class of Pauli-Z gate. |
Functions
|
Generate general Gate class instance of CX. |
|
Generate general Gate class instance of CX. |
|
Generate general Gate class instance of CZ. |
|
Generate general Gate class instance of FusedSwap. |
|
Generate general Gate class instance of GlobalPhase. |
|
Generate general Gate class instance of H. |
|
Generate general Gate class instance of I. |
|
Generate general Gate class instance of P0. |
|
Generate general Gate class instance of P1. |
|
Generate general ParamGate class instance of PPauliRotation. |
|
Generate general ParamGate class instance of PRX. |
|
Generate general ParamGate class instance of PRY. |
|
Generate general ParamGate class instance of PRZ. |
|
Generate general Gate class instance of Pauli. |
|
Generate general Gate class instance of PauliRotation. |
|
Generate general Gate class instance of RX. |
|
Generate general Gate class instance of RY. |
|
Generate general Gate class instance of RZ. |
|
Generate general Gate class instance of S. |
|
Generate general Gate class instance of Sdag. |
|
Generate general Gate class instance of SqrtX. |
|
Generate general Gate class instance of SqrtXdag. |
|
Generate general Gate class instance of SqrtY. |
|
Generate general Gate class instance of SqrtYdag. |
|
Generate general Gate class instance of Swap. |
|
Generate general Gate class instance of T. |
|
Generate general Gate class instance of Tdag. |
|
Generate general Gate class instance of U1. |
|
Generate general Gate class instance of U2. |
|
Generate general Gate class instance of U3. |
|
Generate general Gate class instance of X. |
|
Generate general Gate class instance of Y. |
|
Generate general Gate class instance of Z. |
|
Terminate the Kokkos execution environment. Release the resources. |
|
You must call this before any scaluq function. Initialize the Kokkos execution environment. |
|
Return true if finalize() is already called. |
|
Return true if initialize() is already called. |
Module Contents
- scaluq.CNot(arg0: int, arg1: int, /) Gate
Generate general Gate class instance of CX. [note] CNot is an alias of CX.
- class scaluq.CXGate(arg: Gate, /)
Specific class of single-qubit-controlled Pauli-X gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- control() int
Get property control.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
Get property target.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.CZGate(arg: Gate, /)
Specific class of single-qubit-controlled Pauli-Z gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- control() int
Get property control.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
Get property target.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.Circuit(arg: int, /)
Quantum circuit represented as gate array
- add_param_gate(arg0: ParamGate, arg1: str, /) None
Add parametric gate with specifing key. Given param_gate is copied.
- calculate_depth() int
Get depth of circuit.
- gate_count() int
Get property of gate_count.
- get_key(arg: int, /) str | None
Get parameter key of i-th gate. If it is not parametric, return None.
- key_set() set[str]
Get set of keys of parameters.
- n_qubits() int
Get property of n_qubits.
- update_quantum_state(arg0: StateVector, /, **kwargs) None
Apply gate to the StateVector. StateVector in args is directly updated. If the circuit contains parametric gate, you have to give real value of parameter as “name=value” format in kwargs.
- update_quantum_state(arg0: StateVector, arg1: dict[str, float], /) None
Apply gate to the StateVector. StateVector in args is directly updated. If the circuit contains parametric gate, you have to give real value of parameter as dict[str, float] in 2nd arg.
- scaluq.FusedSwap(arg0: int, arg1: int, arg2: int, /) Gate
Generate general Gate class instance of FusedSwap.
- class scaluq.FusedSwapGate(arg: Gate, /)
Specific class of fused swap gate, which swap qubits in \([\mathrm{qubit\_index1},\mathrm{qubit\_index1}+\mathrm{block\_size})\) and qubits in \([\mathrm{qubit\_index2},\mathrm{qubit\_index2}+\mathrm{block\_size})\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- block_size() int
Get property block_size.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- qubit_index1() int
Get property qubit_index1.
- qubit_index2() int
Get property qubit_index2.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.Gate(arg: PauliRotationGate, /)
General class of QuantumGate.
Note
Downcast to requred to use gate-specific functions.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.GateType(*args, **kwds)
Bases:
enum.Enum<attribute ‘__doc__’ of ‘GateType’ objects>
- CX: Any
- CZ: Any
- FusedSwap: Any
- GlobalPhase: Any
- H: Any
- I: Any
- OneQubitMatrix: Any
- P0: Any
- P1: Any
- Pauli: Any
- PauliRotation: Any
- RX: Any
- RY: Any
- RZ: Any
- S: Any
- Sdag: Any
- SqrtX: Any
- SqrtXdag: Any
- SqrtY: Any
- SqrtYdag: Any
- Swap: Any
- T: Any
- Tdag: Any
- TwoQubitMatrix: Any
- U1: Any
- U2: Any
- U3: Any
- X: Any
- Y: Any
- Z: Any
- class scaluq.GlobalPhaseGate(arg: Gate, /)
Specific class of gate, which rotate global phase, represented as \(e^{i\mathrm{phase}}I\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- phase() float
Get phase property
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.HGate(arg: Gate, /)
Specific class of Hadamard gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.IGate(arg: Gate, /)
Specific class of Pauli-I gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.InitializationSettings
Wrapper class of Kokkos’s InitializationSettings.
Note
See details: https://kokkos.org/kokkos-core-wiki/API/core/initialize_finalize/InitializationSettings.html
- get_device_id() int
- get_disable_warnings() bool
- get_map_device_id_by() str
- get_num_threads() int
- get_print_configuration() bool
- get_tools_args() str
- get_tools_help() bool
- get_tools_libs() str
- get_tune_internals() bool
- has_device_id() bool
- has_disable_warnings() bool
- has_map_device_id_by() bool
- has_num_threads() bool
- has_print_configuration() bool
- has_tools_args() bool
- has_tools_help() bool
- has_tools_libs() bool
- has_tune_internals() bool
- set_device_id(arg: int, /) InitializationSettings
- set_disable_warnings(arg: bool, /) InitializationSettings
- set_map_device_id_by(arg: str, /) InitializationSettings
- set_num_threads(arg: int, /) InitializationSettings
- set_print_configuration(arg: bool, /) InitializationSettings
- set_tools_args(arg: str, /) InitializationSettings
- set_tools_help(arg: bool, /) InitializationSettings
- set_tools_libs(arg: str, /) InitializationSettings
- set_tune_internals(arg: bool, /) InitializationSettings
- class scaluq.OneQubitMatrixGate(arg: Gate, /)
Specific class of single-qubit dense matrix gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- matrix() list[list[complex]]
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.Operator(arg: int, /)
None
- add_operator(arg: PauliOperator, /) None
- add_random_operator(operator_count: int, seed: int | None = None) None
- apply_to_state(arg: StateVector, /) None
- get_expectation_value(arg: StateVector, /) complex
- get_transition_amplitude(arg0: StateVector, arg1: StateVector, /) complex
- is_hermitian() bool
- n_qubits() int
- optimize() None
- terms() list[PauliOperator]
- to_string() str
- class scaluq.P0Gate(arg: Gate, /)
Specific class of projection gate to \(\ket{0}\).
Note
This gate is not unitary.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.P1Gate(arg: Gate, /)
Specific class of projection gate to \(\ket{1}\).
Note
This gate is not unitary.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- scaluq.PPauliRotation(pauli: PauliOperator, coef: float = 1.0) ParamGate
Generate general ParamGate class instance of PPauliRotation.
- class scaluq.PPauliRotationGate(arg: ParamGate, /)
Specific class of parametric multi-qubit pauli-rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}P}\). angle is given as param * pcoef.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_inverse() ParamGate
Generate inverse parametric-gate as ParamGate type. If not exists, return None.
- get_matrix(arg: float, /) numpy.typing.NDArray | None
Get matrix representation of the gate with holding the parameter. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- param_gate_type() ParamGateType
Get parametric gate type as ParamGateType enum.
- update_quantum_state(arg0: StateVector, arg1: float, /) None
Apply gate to state_vector with holding the parameter. state_vector in args is directly updated.
- scaluq.PRX(target: int, coef: float = 1.0) ParamGate
Generate general ParamGate class instance of PRX.
- class scaluq.PRXGate(arg: ParamGate, /)
Specific class of parametric X rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}X}\). angle is given as param * pcoef.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_inverse() ParamGate
Generate inverse parametric-gate as ParamGate type. If not exists, return None.
- get_matrix(arg: float, /) numpy.typing.NDArray | None
Get matrix representation of the gate with holding the parameter. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- param_gate_type() ParamGateType
Get parametric gate type as ParamGateType enum.
- target() int
- update_quantum_state(arg0: StateVector, arg1: float, /) None
Apply gate to state_vector with holding the parameter. state_vector in args is directly updated.
- scaluq.PRY(target: int, coef: float = 1.0) ParamGate
Generate general ParamGate class instance of PRY.
- class scaluq.PRYGate(arg: ParamGate, /)
Specific class of parametric Y rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}Y}\). angle is given as param * pcoef.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_inverse() ParamGate
Generate inverse parametric-gate as ParamGate type. If not exists, return None.
- get_matrix(arg: float, /) numpy.typing.NDArray | None
Get matrix representation of the gate with holding the parameter. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- param_gate_type() ParamGateType
Get parametric gate type as ParamGateType enum.
- target() int
- update_quantum_state(arg0: StateVector, arg1: float, /) None
Apply gate to state_vector with holding the parameter. state_vector in args is directly updated.
- scaluq.PRZ(target: int, coef: float = 1.0) ParamGate
Generate general ParamGate class instance of PRZ.
- class scaluq.PRZGate(arg: ParamGate, /)
Specific class of parametric Z rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}Z}\). angle is given as param * pcoef.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_inverse() ParamGate
Generate inverse parametric-gate as ParamGate type. If not exists, return None.
- get_matrix(arg: float, /) numpy.typing.NDArray | None
Get matrix representation of the gate with holding the parameter. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- param_gate_type() ParamGateType
Get parametric gate type as ParamGateType enum.
- target() int
- update_quantum_state(arg0: StateVector, arg1: float, /) None
Apply gate to state_vector with holding the parameter. state_vector in args is directly updated.
- class scaluq.ParamGate(arg: PPauliRotationGate, /)
General class of parametric quantum gate.
Note
Downcast to requred to use gate-specific functions.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_inverse() ParamGate
Generate inverse parametric-gate as ParamGate type. If not exists, return None.
- get_matrix(arg: float, /) numpy.typing.NDArray | None
Get matrix representation of the gate with holding the parameter. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- param_gate_type() ParamGateType
Get parametric gate type as ParamGateType enum.
- update_quantum_state(arg0: StateVector, arg1: float, /) None
Apply gate to state_vector with holding the parameter. state_vector in args is directly updated.
- class scaluq.ParamGateType(*args, **kwds)
Bases:
enum.Enum<attribute ‘__doc__’ of ‘ParamGateType’ objects>
- PPauliRotation: Any
- PRX: Any
- PRY: Any
- PRZ: Any
- scaluq.Pauli(arg: PauliOperator, /) Gate
Generate general Gate class instance of Pauli.
- class scaluq.PauliGate(arg: Gate, /)
Specific class of multi-qubit pauli gate, which applies single-qubit Pauli gate to each of qubit.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.PauliOperator(bit_flip_mask: int, phase_flip_mask: int, coef: complex = 1.0)
Pauli operator as coef and tensor product of single pauli for each qubit.
- I: int
- X: int
- Y: int
- Z: int
- add_single_pauli(arg0: int, arg1: int, /) None
Add (apply tensor product) another single pauli. You cannot specify qubit index that has always a single pauli.
- apply_to_state(arg: StateVector, /) None
Apply pauli to state vector.
- change_coef(arg: complex, /) None
Set property coef.
- get_XZ_mask_representation() tuple[int, int]
Get single-pauli property as binary integer representation. See description of __init__(bit_flip_mask_py: int, phase_flip_mask_py: int, coef: float=1.) for details.
- get_coef() complex
Get property coef.
- get_dagger() PauliOperator
Get adjoint operator.
- get_expectation_value(arg: StateVector, /) complex
Get expectation value of measuring state vector. \(\bra{\psi}P\ket{\psi}\).
- get_pauli_id_list() list[int]
Get pauli id to be applied. The order is correspond to the result of get_target_qubit_list
- get_pauli_string() str
Get single-pauli property as string representation. See description of __init__(pauli_string: str, coef: float=1.) for details.
- get_qubit_count() int
Get num of qubits to applied with, when count from 0-th qubit. Subset of \([0, \mathrm{qubit_count})\) is the target.
- get_target_qubit_list() list[int]
Get qubits to be applied pauli.
- get_transition_amplitude(arg0: StateVector, arg1: StateVector, /) complex
Get transition amplitude of measuring state vector. \(\bra{\chi}P\ket{\psi}\).
- scaluq.PauliRotation(arg0: PauliOperator, arg1: float, /) Gate
Generate general Gate class instance of PauliRotation.
- class scaluq.PauliRotationGate(arg: Gate, /)
Specific class of multi-qubit pauli-rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}P}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.RXGate(arg: Gate, /)
Specific class of X rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}X}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- angle() float
Get angle property.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.RYGate(arg: Gate, /)
Specific class of Y rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}Y}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- angle() float
Get angle property.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.RZGate(arg: Gate, /)
Specific class of Z rotation gate, represented as \(e^{-i\frac{\mathrm{angle}}{2}Z}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- angle() float
Get angle property.
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SGate(arg: Gate, /)
Specific class of S gate, represented as \(\begin{bmatrix} 1 & 0\\ 0 & i \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SdagGate(arg: Gate, /)
Specific class of inverse of S gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SqrtXGate(arg: Gate, /)
Specific class of sqrt(X) gate, represented as \(\begin{bmatrix} 1+i & 1-i\\ 1-i & 1+i \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SqrtXdagGate(arg: Gate, /)
Specific class of inverse of sqrt(X) gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SqrtYGate(arg: Gate, /)
Specific class of sqrt(Y) gate, represented as \(\begin{bmatrix} 1+i & -1-i \\ 1+i & 1+i \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.SqrtYdagGate(arg: Gate, /)
Specific class of inverse of sqrt(Y) gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.StateVector(arg: StateVector)
Vector representation of quantum state.
Note
Qubit index is start from 0. If the amplitudes of \(\ket{b_{n-1}\dots b_0}\) is \(b_i\), the state is \(\sum_i b_i 2^i\).
- Haar_random_state(seed: int | None = None) StateVector
Constructing state vector with Haar random state. If seed is not specified, the value from random device is used.
- UNMEASURED: int
- add_state_vector(arg: StateVector, /) None
Add other state vector and make superposition. \(\ket{\mathrm{this}} \leftarrow \ket{\mathrm{this}} + \ket{\mathrm{state}}\).
- add_state_vector_with_coef(arg0: complex, arg1: StateVector, /) None
add other state vector with multiplying the coef and make superposition. \(\ket{\mathrm{this}}\leftarrow\ket{\mathrm{this}}+\mathrm{coef}\ket{\mathrm{state}}\).
- amplitudes() list[complex]
Get all amplitudes with as list[complex].
- dim() int
Get dimension of the vector (\(=2^\mathrm{n\_qubits}\)).
- get_amplitude_at_index(arg: int, /) complex
Get amplitude at one index.
Note
If you want to get all amplitudes, you should use StateVector::amplitudes().
- get_entropy() float
Get the entropy of the vector.
- get_marginal_probability(arg: list[int], /) float
Get the marginal probability to observe as specified. Specify the result as n-length list. 0 and 1 represent the qubit is observed and get the value. 2 represents the qubit is not observed.
- get_squared_norm() float
Get squared norm of the state. \(\braket{\psi|\psi}\).
- get_zero_probability(arg: int, /) float
Get the probability to observe \(\ket{0}\) at specified index.
- load(arg: list[complex], /) None
Load amplitudes of list[int] with dim length.
- multiply_coef(arg: complex, /) None
Multiply coef. \(\ket{\mathrm{this}}\leftarrow\mathrm{coef}\ket{\mathrm{this}}\).
- n_qubits() int
Get num of qubits.
- normalize() None
Normalize state (let \(\braket{\psi|\psi} = 1\) by multiplying coef).
- sampling(sampling_count: int, seed: int | None = None) list[int]
Sampling specified times. Result is list[int] with the sampling_count length.
- set_amplitude_at_index(arg0: int, arg1: complex, /) None
Manually set amplitude at one index.
- set_computational_basis(arg: int, /) None
Initialize with computational basis ket{mathrm{basis}}.
- set_zero_norm_state() None
Initialize with 0 (null vector).
- set_zero_state() None
Initialize with computational basis \(\ket{00\dots0}\).
- to_string() str
Information as str.
- class scaluq.SwapGate(arg: Gate, /)
Specific class of two-qubit swap gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target1() int
Get property target1.
- target2() int
Get property target2.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.TGate(arg: Gate, /)
Specific class of T gate, represented as \(\begin{bmatrix} 1 & 0\\ 0 & e^{i\pi/4} \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.TdagGate(arg: Gate, /)
Specific class of inverse of T gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.TwoQubitMatrixGate(arg: Gate, /)
Specific class of double-qubit dense matrix gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- matrix() None
Get property matrix.
- target1() int
Get property target1.
- target2() int
Get property target2.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.U1Gate(arg: Gate, /)
Specific class of IBMQ’s U1 Gate, which is a rotation abount Z-axis, represented as \(\begin{bmatrix} 1 & 0\\ 0 & e^{i\lambda} \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- lambda_() float
Get lambda property.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.U2Gate(arg: Gate, /)
Specific class of IBMQ’s U2 Gate, which is a rotation about X+Z-axis, represented as \(\frac{1}{\sqrt{2}} \begin{bmatrix}1 & -e^{-i\lambda}\\ e^{i\phi} & e^{i(\phi+\lambda)} \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- lambda_() float
Get lambda property.
- phi() float
Get phi property.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- scaluq.U3(arg0: int, arg1: float, arg2: float, arg3: float, /) Gate
Generate general Gate class instance of U3.
- class scaluq.U3Gate(arg: Gate, /)
Specific class of IBMQ’s U3 Gate, which is a rotation abount 3 axis, represented as \(\begin{bmatrix} \cos \frac{\theta}{2} & -e^{i\lambda}\sin\frac{\theta}{2}\\ e^{i\phi}\sin\frac{\theta}{2} & e^{i(\phi+\lambda)}\cos\frac{\theta}{2} \end{bmatrix}\).
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- lambda_() float
Get lambda property.
- phi() float
Get phi property.
- theta() float
Get theta property.
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.XGate(arg: Gate, /)
Specific class of Pauli-X gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.YGate(arg: Gate, /)
Specific class of Pauli-Y gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- class scaluq.ZGate(arg: Gate, /)
Specific class of Pauli-Z gate.
Note
Upcast is required to use gate-general functions (ex: add to Circuit).
- get_control_qubit_list() list[int]
Get control qubits as list[int].
- get_matrix() numpy.typing.NDArray | None
Get matrix representation of the gate. If cannot, None is returned.
- get_target_qubit_list() list[int]
Get target qubits as list[int]. Control qubits is not included.
- target() int
- update_quantum_state(arg: StateVector, /) None
Apply gate to state_vector. state_vector in args is directly updated.
- scaluq.finalize() None
Terminate the Kokkos execution environment. Release the resources.
- scaluq.initialize(settings: InitializationSettings = ...) None
You must call this before any scaluq function. Initialize the Kokkos execution environment.
- scaluq.is_finalized() bool
Return true if finalize() is already called.
- scaluq.is_initialized() bool
Return true if initialize() is already called.