Struct qcgpu::State [] [src]

pub struct State {
    pub buffer: Buffer<Complex32>,
    pub num_amps: usize,
    pub num_qubits: u32,
    pub backend: usize,
    // some fields omitted
}

Representation of a quantum register

Fields

The OpenCL Buffer for the state vector

Number of amplitudes stored in the state vector

Number of qubits in the register

The OpenCL Backend used. Use the method info() to get the devices identifier

Methods

impl State
[src]

[src]

Create a new quantum register, with a given number of qubits. The backend is the OpenCL ID of the accelerator to use.

The register will be initialized in the state |00...0>

let state = qcgpu::State::new(2,0);

[src]

Create a new quantum register, starting in the State given. The backend is the OpenCL ID of the accelerator to use.

let state = qcgpu::State::from_bit_string("|00>", 1);

[src]

Apply a gate to the target qubit

[src]

Apply a gate to every qubit in the register

[src]

Apply a gate to the register if the control qubit is 1.

[src]

Return the probabilities of each outcome.

The probabilitity of a state a|x> being measured is |a|^2.

[src]

Return the state vector of the quantum register

[src]

Measure the quantum register, returning the measured result

[src]

Preform multiple measurements, returning the results as a HashMap, with the key as the result and the value as the number of times that result was measured

[src]

Add qubits to the register. The qubits are initialized to zero. This should be used as scratch space.

[src]

Measure the scratch qubits. The measurement is discarded, and the register size is reduced by num_to_measure qubits.

[src]

Preform multiple measurements of the first num_to_measure, returning the results as a HashMap, with the key as the result and the value as the number of times that result was measured

[src]

Print Information About The Device

[src]

Hadamard Gate Shorthand Method

Equivilent to state.apply_gate(target, h());

[src]

S Gate Shorthand Method

Equivilent to state.apply_gate(target, s());

[src]

T Gate Shorthand Method

Equivilent to state.apply_gate(target, t());

[src]

Pauli X Gate Shorthand Method

Equivilent to state.apply_gate(target, x());

[src]

Pauli Y Gate Shorthand Method

Equivilent to state.apply_gate(target, y());

[src]

Pauli Z Gate Shorthand Method

Equivilent to state.apply_gate(target, z());

[src]

Controlled Not Gate Shorthand method

Equivilent to state.apply_controlled_gate(control, target, x());

[src]

Toffoli (Controlled-Controlled-NOT gate) Shorthand method

[src]

Swap two qubits in the register

[src]

Caclulates f(a) = x^a mod n.

Trait Implementations

impl Debug for State
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for State
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for State

impl Sync for State