Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/beneills/quantum
/ functions
Functions
117 in github.com/beneills/quantum
⨍
Functions
117
◇
Types & classes
10
↓ 10 callers
Method
get
Get the element in position `(i, j)`.
src/matrix.rs:164
↓ 8 callers
Method
set
Set the element in position `(i, j)` to `value`.
src/matrix.rs:169
↓ 6 callers
Method
embed
Embed another matrix into this one, overrising elements. Embed with top-left position at (i, j). # Panics We panic if this matrix isn't large enoug
src/matrix.rs:89
↓ 6 callers
Function
identity
(width: usize)
src/gates.rs:11
↓ 5 callers
Method
apply
Apply a quantum gate to this ket, mutating its state.
src/ket.rs:94
↓ 5 callers
Function
hadamard
(n: usize)
src/gates.rs:22
↓ 5 callers
Method
initialize
Initialize the quantum register qubits to a certian classical integer state. # Panics We panic if the state is anything other than `State::Initializ
src/computer.rs:52
↓ 4 callers
Function
controlled
(u: &Matrix)
src/gates.rs:157
↓ 4 callers
Method
matrix
Representative matrix.
src/gate.rs:49
↓ 4 callers
Method
pow
Compute an integer power of this number efficiently with repeated squaring.
src/complex.rs:63
↓ 3 callers
Method
collapse
Collapse the quantum register to a classical state. # Panics We panic if the state is anything other than `State::Running`.
src/computer.rs:77
↓ 3 callers
Method
collapse
Collapse the register to yield one a classical state. A register may only be collapsed once, and is invalid thereafter.
src/registers.rs:70
↓ 3 callers
Method
norm_sqr
Compute the square of the norm/absolute value, i.e. _|z|^2_.
src/complex.rs:58
↓ 2 callers
Method
apply
Apply a quantum gate to the quantum register qubits. # Panics We panic if the state is anything other than `State::Running`.
src/computer.rs:66
↓ 2 callers
Method
im
The imaginary part.
src/complex.rs:101
↓ 2 callers
Method
permute_rows
Permute the rows to generate a new matrix. Row _i_ goes to row _perutation[i]_. # Panics We panic if set(permutation) != {0, ..., self.size - 1}.
src/matrix.rs:108
↓ 2 callers
Method
re
The real part.
src/complex.rs:96
↓ 2 callers
Method
state
Compute the current `state` of the register. The `state` is an integer which uniquely specifies all register bits (for a given width). It does this
src/registers.rs:248
↓ 2 callers
Method
value
Read the collapsed register qubits as an integer. # Panics We panic if the state is anything other than `State::Collapsed`.
src/computer.rs:99
↓ 1 callers
Method
apply
Apply a quantum gate to this register, mutating its state.
src/registers.rs:60
↓ 1 callers
Function
controlled_not
()
src/gates.rs:139
↓ 1 callers
Function
deutsch_gate
Takes |a, b> to |a, b+f(a)> f must be a function from {0, 1} to {0, 1}
src/algorithms/deutsch.rs:20
↓ 1 callers
Function
pauli_x
()
src/gates.rs:49
↓ 1 callers
Function
pauli_y
()
src/gates.rs:61
↓ 1 callers
Function
pauli_z
()
src/gates.rs:75
↓ 1 callers
Method
permute
Permute the qubits on which we act. Qubit _i_ will be acted on as qubit _permutation[i]_ was before. TODO: The consumer has to work out the (complic
src/gate.rs:63
↓ 1 callers
Method
permute_columns
Permute the columns to generate a new matrix. Column _i_ goes to column _perutation[i]_. # Panics We panic if set(permutation) != {0, ..., self.siz
src/matrix.rs:130
↓ 1 callers
Function
quantum_fourier_transform
(n: usize)
src/gates.rs:239
↓ 1 callers
Method
reset
Reset the quantum register, ready to be initialized again. # Panics We panic if the state is anything other than `State::Collapsed`.
src/computer.rs:90
↓ 1 callers
Method
to_int
Return the integer represented by this register. See the `state()` method documentation for details of the encoding.
src/registers.rs:263
↓ 1 callers
Method
width
Width of the gate.
src/gate.rs:44
Method
add
(self, rhs: &'a Matrix)
src/matrix.rs:221
Method
add
(self, rhs: Complex)
src/complex.rs:119
Method
add_assign
(&mut self, rhs: Complex)
src/complex.rs:134
Method
approx_eq
Approximately equal test.
src/matrix.rs:174
Method
approx_eq
Approximately equal test.
src/complex.rs:106
Function
bad_column_permutation_test
()
src/matrix.rs:343
Function
bad_initialization_test
()
src/other.rs:107
Function
bad_row_permutation_test
()
src/matrix.rs:335
Function
balanced1
(x: i32)
src/algorithms/deutsch.rs:79
Function
balanced2
(x: i32)
src/algorithms/deutsch.rs:85
Function
classical_test
()
src/ket.rs:115
Function
collapse_test
()
src/registers.rs:126
Function
complex_test
()
src/complex.rs:160
Function
compute_test
()
src/computer.rs:135
Function
constant1
(x: i32)
src/algorithms/deutsch.rs:67
Function
constant2
(x: i32)
src/algorithms/deutsch.rs:73
Function
controlled_not_test
()
src/gates.rs:379
Function
controlled_test
()
src/gates.rs:398
Function
controlled_x
()
src/gates.rs:175
Function
controlled_y
()
src/gates.rs:184
Function
controlled_z
()
src/gates.rs:193
Function
deutsch_algorithm
(f: fn(i32) -> i32)
src/algorithms/deutsch.rs:46
Function
deutsch_test
()
src/algorithms/deutsch.rs:66
Function
double_collapse_test
()
src/registers.rs:139
Function
embed_test
()
src/matrix.rs:313
Method
eq
(&self, other: &Matrix)
src/matrix.rs:205
Method
fmt
(&self, f: &mut fmt::Formatter)
src/matrix.rs:192
Method
fmt
(&self, f: &mut fmt::Formatter)
src/complex.rs:154
Function
fredkin
()
src/gates.rs:223
Function
fredkin_test
()
src/gates.rs:424
Method
from_classical
Generate a ket from a classical register. This ket encodes a single basis vector, and is used for initializing a quantum register to an initial (clas
src/ket.rs:43
Function
from_classical_test
()
src/ket.rs:137
Method
from_int
Construct a new non-quantum register, given an unsigned integer. See the `state()` method documentation for details of the encoding. # Panics We as
src/registers.rs:222
Method
from_state
Construct a new non-quantum register, given a `state`. See the `state()` method documentation for details of the encoding. # Panics We assert that
src/registers.rs:192
Function
hadamard_test
()
src/gates.rs:285
Method
i
The imaginary unit.
src/complex.rs:53
Method
identity
Construct a new identity matrix of given size. # Panics We panic if the given size exceeds `MAX_SIZE`.
src/matrix.rs:67
Function
identity_test
()
src/gates.rs:270
Function
initialization_test
()
src/other.rs:92
Function
initialization_test
()
src/registers.rs:116
Method
is_classical
(&self)
src/ket.rs:68
Method
is_valid
(&self)
src/ket.rs:53
Function
matrix_test
()
src/matrix.rs:292
Method
mul
(self, rhs: &Matrix)
src/matrix.rs:239
Method
mul
(self, rhs: Complex)
src/complex.rs:127
Method
mul_assign
(&mut self, rhs: Complex)
src/complex.rs:140
Method
neg
(self)
src/complex.rs:148
Method
new
Construct a new quantum computer with register of given `width`.
src/computer.rs:38
Method
new
Construct a new quantum gate, given `width` and computational basis matrix. Currently we do not check whether the matrix is unitary. # Panics We pa
src/gate.rs:32
Method
new
Construct a new, zero-initialized ket of given size.
src/ket.rs:32
Method
new
Safely construct a qubit, given the real and imaginary parts of both coefficients. This function validates that the given state is possible.
src/other.rs:56
Method
new
Construct a new zero-initialized matrix of given size. # Panics We panic if the given size exceeds `MAX_SIZE`.
src/matrix.rs:35
Method
new
Construct a new quantum register of given `width` and initial state. # Panics We panic if the initial state register has a different size to `width`
src/registers.rs:49
Method
new
Construct a new complex number as `re + im * i` with 64-bit float parts.
src/complex.rs:20
Method
new_euler
Construct a new complex number as `r * exp(i * phi)` with 64-bit float parts.
src/complex.rs:25
Method
new_from_elements
Construct a new matrix of given size from elements. # Panics We panic if the given size exceeds `MAX_SIZE`.
src/matrix.rs:49
Method
nth_root_of_unity
Construct a new primitive nth root of unity.
src/complex.rs:33
Method
one
One in the complex plane, i.e. `1 + 0i`.
src/complex.rs:48
Function
pauli_x_test
()
src/gates.rs:300
Function
pauli_y_test
()
src/gates.rs:313
Function
pauli_z_test
()
src/gates.rs:326
Function
permutation_test
()
src/gates.rs:458
Function
permutation_test
()
src/matrix.rs:323
Method
permutation_valid
Tests whether the permutation is valid.
src/matrix.rs:146
Function
phase_shift
(phi: f64)
src/gates.rs:87
Function
phase_shift_test
()
src/gates.rs:339
Method
probabilities
Compute the probabilities of each register state without collapsing. This function is intended for test purposes. We return a vector of probabilitie
src/computer.rs:110
Method
probabilities
Compute the probabilities of each state without collapsing. This function is intended for test purposes. We return a vector of probabilities mirrori
src/registers.rs:102
Function
probabilities_test
()
src/computer.rs:150
next →
1–100 of 117, ranked by callers