|View source on GitHub|
Linear algebra methods and classes useful for quantum primitives.
Focuses on methods useful for analyzing and optimizing quantum circuits. Avoids duplicating functionality present in numpy.
combinators module: Utility methods for combining matrices.
decompositions module: Utility methods for breaking matrices into useful pieces.
diagonalize module: Utility methods for diagonalizing matrices.
operator_spaces module: Utilities for manipulating linear operators as elements of vector space.
predicates module: Utility methods for checking properties of matrices.
tolerance module: Utility for testing approximate equality of matrices and scalars within
transformations module: Utility methods for transforming matrices or vectors.
class AxisAngleDecomposition: Represents a unitary operation as an axis, angle, and global phase.
class KakDecomposition: A convenient description of an arbitrary two-qubit operation.
all_near_zero(...): Checks if the tensor's elements are all near zero.
all_near_zero_mod(...): Checks if the tensor's elements are all near multiples of the period.
allclose_up_to_global_phase(...): Determines if a ~= b * exp(i t) for some t.
apply_matrix_to_slices(...): Left-multiplies an NxN matrix onto N slices of a numpy array.
axis_angle(...): Decomposes a single-qubit unitary into axis, angle, and global phase.
bidiagonalize_real_matrix_pair_with_symmetric_products(...): Finds orthogonal matrices that diagonalize both mat1 and mat2.
bidiagonalize_unitary_with_special_orthogonals(...): Finds orthogonal matrices L, R such that L @ matrix @ R is diagonal.
block_diag(...): Concatenates blocks into a block diagonal matrix.
deconstruct_single_qubit_matrix_into_angles(...): Breaks down a 2x2 unitary into more useful ZYZ angle parameters.
density_matrix_kronecker_product(...): Merges two density matrices into a single unified density matrix.
diagonalize_real_symmetric_and_sorted_diagonal_matrices(...): Returns an orthogonal matrix that diagonalizes both given matrices.
diagonalize_real_symmetric_matrix(...): Returns an orthogonal matrix that diagonalizes the given matrix.
dot(...): Computes the dot/matrix product of a sequence of values.
expand_matrix_in_orthogonal_basis(...): Computes coefficients of expansion of m in basis.
extract_right_diag(...): Extract a diagonal unitary from a 3-CNOT two-qubit unitary.
hilbert_schmidt_inner_product(...): Computes Hilbert-Schmidt inner product of two matrices.
is_cptp(...): Determines if a channel is completely positive trace preserving (CPTP).
is_diagonal(...): Determines if a matrix is a approximately diagonal.
is_hermitian(...): Determines if a matrix is approximately Hermitian.
is_normal(...): Determines if a matrix is approximately normal.
is_orthogonal(...): Determines if a matrix is approximately orthogonal.
is_special_orthogonal(...): Determines if a matrix is approximately special orthogonal.
is_special_unitary(...): Determines if a matrix is approximately unitary with unit determinant.
is_unitary(...): Determines if a matrix is approximately unitary.
kak_canonicalize_vector(...): Canonicalizes an XX/YY/ZZ interaction by swap/negate/shift-ing axes.
kak_decomposition(...): Decomposes a 2-qubit unitary into 1-qubit ops and XX/YY/ZZ interactions.
kak_vector(...): Compute the KAK vectors of one or more two qubit unitaries.
kron(...): Computes the kronecker product of a sequence of values.
kron_bases(...): Creates tensor product of bases.
kron_factor_4x4_to_2x2s(...): Splits a 4x4 matrix U = kron(A, B) into A, B, and a global factor.
kron_with_controls(...): Computes the kronecker product of a sequence of values and control tags.
map_eigenvalues(...): Applies a function to the eigenvalues of a matrix.
match_global_phase(...): Phases the given matrices so that they agree on the phase of one entry.
matrix_commutes(...): Determines if two matrices approximately commute.
matrix_from_basis_coefficients(...): Computes linear combination of basis vectors with given coefficients.
num_cnots_required(...): Returns the min number of CNOT/CZ gates required by a two-qubit unitary.
partial_trace(...): Takes the partial trace of a given tensor.
partial_trace_of_state_vector_as_mixture(...): Returns a mixture representing a state vector with only some qubits kept.
pow_pauli_combination(...): Computes non-negative integer power of single-qubit Pauli combination.
reflection_matrix_pow(...): Raises a matrix with two opposing eigenvalues to a power.
scatter_plot_normalized_kak_interaction_coefficients(...): Plots the interaction coefficients of many two-qubit operations.
slice_for_qubits_equal_to(...): Returns an index corresponding to a desired subset of an np.ndarray.
so4_to_magic_su2s(...): Finds 2x2 special-unitaries A, B where mat = Mag.H @ kron(A, B) @ Mag.
state_vector_kronecker_product(...): Merges two state vectors into a single unified state vector.
sub_state_vector(...): Attempts to factor a state vector into two parts and return one of them.
targeted_conjugate_about(...): Conjugates the given tensor about the target tensor.
targeted_left_multiply(...): Left-multiplies the given axes of the target tensor by the given matrix.
to_special(...): Converts a unitary matrix to a special unitary matrix.
unitary_eig(...): Gives the guaranteed unitary eigendecomposition of a normal matrix.
A special indicator value for
The four Pauli matrices (including identity) keyed by character.