braket.circuits.quantum_operator_helpers module¶
-
braket.circuits.quantum_operator_helpers.
verify_quantum_operator_matrix_dimensions
(matrix: numpy.array) → None[source]¶ Verifies matrix is square and matrix dimensions are positive exponents of 2, raising
ValueError
otherwise.- Parameters
matrix (np.ndarray) – matrix to verify
- Raises
ValueError – If
matrix
is not a two-dimensional square matrix, or has a dimension length which is not a positive exponent of 2
-
braket.circuits.quantum_operator_helpers.
is_hermitian
(matrix: numpy.array) → bool[source]¶ Whether matrix is Hermitian
- Parameters
matrix (np.ndarray) – matrix to verify
- Returns
bool – If matrix is Hermitian
-
braket.circuits.quantum_operator_helpers.
is_square_matrix
(matrix: numpy.array) → bool[source]¶ Whether matrix is square, meaning matrix has two dimensions are both are equivalent
- Parameters
matrix (np.ndarray) – matrix to verify
- Returns
bool – If matrix is square
-
braket.circuits.quantum_operator_helpers.
is_unitary
(matrix: numpy.array) → bool[source]¶ Whether matrix is unitary
- Parameters
matrix (np.ndarray) – matrix to verify
- Returns
bool – If matrix is unitary
-
braket.circuits.quantum_operator_helpers.
get_pauli_eigenvalues
(num_qubits: int) → numpy.ndarray[source]¶ Get the eigenvalues of Pauli operators and their tensor products as an immutable Numpy array.
- Parameters
num_qubits (int) – the number of qubits the operator acts on
- Returns
np.ndarray – the eigenvalues of a Pauli product operator of the given size