This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FloquetCircuits | |
import Base: Matrix | |
using LinearAlgebra: I | |
using TensorOperations: tensorcontract | |
export Gate, FloquetCircuit, Matrix | |
"Quantum gate acting on some number of qubits." | |
struct Gate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def rotation(v1, v2): | |
""" | |
Compute a matrix R that rotates v1 to align with v2. | |
v1 and v2 must be length-3 1d numpy arrays. | |
""" | |
# unit vectors | |
u = v1 / np.linalg.norm(v1) | |
Ru = v2 / np.linalg.norm(v2) |