1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use crate::{complex, matrix, QuantumGate};
#[rustfmt::skip]
lazy_static::lazy_static! {
static ref HADAMARD: QuantumGate = matrix!([complex!(1.0, 0.0), complex!( 1.0, 0.0)];
[complex!(1.0, 0.0), complex!(-1.0, 0.0)]) *
complex!(1.0/2.0_f64.sqrt(), 0.0);
static ref PAULI_X: QuantumGate = matrix!([complex!(0.0, 0.0), complex!(1.0, 0.0)];
[complex!(1.0, 0.0), complex!(0.0, 0.0)]);
static ref PAULI_Y: QuantumGate = matrix!([complex!(0.0, 0.0), complex!(0.0, -1.0)];
[complex!(0.0, 1.0), complex!(0.0, 0.0)]);
static ref PAULI_Z: QuantumGate = matrix!([complex!(1.0, 0.0), complex!( 0.0, 0.0)];
[complex!(0.0, 0.0), complex!(-1.0, 0.0)]);
static ref CNOT: QuantumGate = matrix!([complex!(1.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0)];
[complex!(0.0, 0.0), complex!(1.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0)];
[complex!(0.0, 0.0), complex!(0.0, 0.0), complex!(0.0, 0.0), complex!(1.0, 0.0)];
[complex!(0.0, 0.0), complex!(0.0, 0.0), complex!(1.0, 0.0), complex!(0.0, 0.0)]);
}
|