Linalg
– Useful linear algebra functions for QM¶
-
squanch.linalg.
is_hermitian
(matrix)[source]¶ Checks if an operator is Hermitian
Parameters: matrix (np.array) – the operator to check Returns: true or false
-
squanch.linalg.
tensor_product
(state1, state2)[source]¶ Returns the Kronecker product of two states
Parameters: - state1 (np.array) – the first state
- state2 (np.array) – the second state
Returns: the tensor product
-
squanch.linalg.
tensors
(operator_list)[source]¶ Returns the iterated Kronecker product of a list of states
Parameters: operator_list ([np.array]) – list of states to tensor-product Returns: the tensor product
-
squanch.linalg.
tensor_fill_identity
(single_qubit_operator, n_qubits, qubit_index)[source]¶ Create the n-qubit operator I x I x … Operator x I x I… with operator applied to a given qubit index
Parameters: - single_qubit_operator (np.array) – the operator in the computational basis (a 2x2 matrix)
- n_qubits (int) – the number of qubits in the system to fill
- qubit_index (int) – the zero-indexed qubit to apply this operator to
Returns: the n-qubit operator