Toolkit
Utility functions for constructing quantum operators and states.
Module Reference
Convieniance functions for use in user-defined Initial State and Observables functions.
- quop_mpi.toolkit.I(n_qubits: int) csr_matrix
Generate a sparse identity matrix of size
2 ** n_qubits.- Parameters:
- n_qubits: int
generate the identity operator for
n_qubits
- Returns:
- csr_matrix
the identity operator for
n_qubits
- quop_mpi.toolkit.X(index: int, n_qubits: int) csr_matrix
Generate the Pauli X operator acting on qubit
indexin a system ofn_qubits.- Parameters:
- indexint
index of the qubit to which the X operator is applied
- n_qubitsint
total number of qubits in the system
- Returns:
- csr_matrix
the Pauli X operator acting on qubit
indexin a system ofn_qubits
- quop_mpi.toolkit.Y(index: int, n_qubits: int) csr_matrix
Generate the Pauli Y operator acting on qubit
indexin a system ofn_qubits.- Parameters:
- indexint
index of the qubit to which the Y operator is applied
- n_qubitsint
total number of qubits in the system
- Returns:
- csr_matrix
the Pauli Y operator acting on qubit
indexin a system ofn_qubits
- quop_mpi.toolkit.Z(index: int, n_qubits: int)
Generate the Pauli Z operator acting on qubit
indexin a system ofn_qubits.- Parameters:
- indexint
index of the qubit to which the Z operator is applied
- n_qubitsint
total number of qubits in the system
- Returns:
- csr_matrix
the Pauli Z operator acting on qubit
indexin a system ofn_qubits
- quop_mpi.toolkit.kron(terms: list['sparse']) csr_matrix
Compute the tensor (Kronecker) product of a sequence of sparse matrices.
- Parameters:
- termslist[sparse]
a list of scipy sparse matrices
- Returns:
- csr_matrix
the tensor product of
terms, computed from left to right
- quop_mpi.toolkit.kron_power(term: sparse, n: int) csr_matrix
Compute the tensor (Kronecker) product of
ninstances of a sparse matrix.- Parameters:
- termsparse
a scipy sparse matrix
- nint
length of the tensor product sequence
- Returns:
- csr_matrix
tensor product of
noccurences ofterm
- quop_mpi.toolkit.string(state: str) np.ndarray[np.complex128]
Generate an initial state from a bit-string representation.
- Parameters:
- statestr
a bit string state.
- Returns:
- ndarray[complex128]
the parsed quantum state
Pauli Matrices
Functions for generating Pauli operators on multi-qubit systems:
Kronecker Products
Functions for tensor products:
kron()- Kronecker product of a list of matriceskron_power()- n-fold tensor product of a matrix
State Preparation
string()- Convert bit-string to computational basis state