Module qip::state_ops [−][src]
Expand description
Functions for running ops on states.
Enums
Types of unitary ops which can be applied to a state.
Functions
Apply op
to the input
, storing the results in output
. If either start at a nonzero state
index in their 0th index, use input/output_offset
.
Apply ops
to the input
, storing the results in output
. If either start at a nonzero state
index in their 0th index, use input/output_offset
.
This is much less efficient as compared to repeated applications of apply_op
, if your ops can
be applied in sequence, do so with apply_op
.
Get conjugate of op.
Make a vector of complex numbers whose reals are given by data
Make a vector of complex numbers whose reals are given by the first tuple entry in data
and
whose imaginaries are from the second.
Get the index for a submatrix indexed by indices
given the full_index
for the larger 2^n by 2^n matrix.
Get the i
th qubit index for op
Invert a unitary op (equivalent to conjugate transpose).
Make a Control UnitaryOp
Make a Function UnitaryOp
Make a Matrix UnitaryOp
Make the full op matrix from ops
.
Not very efficient, use only for debugging.
Make a vector of vectors of rows (with (column, value)
) built from a function
f
which takes row numbers.
natural_order indicates that the lowest indexed qubit is the least significant bit in row
and
the output column
from f
Make a SparseMatrix UnitaryOp from a vector of rows (with (column, value)
).
natural_order indicates that the lowest indexed qubit is the least significant bit in column
and row
where row
is the index of dat
.
Make a Swap UnitaryOp
Get the number of indices represented by op
Given the full matrix row
and col
, find the given op’s row and column using the full n
,
the op’s nindices
, the op’s `indices’.
Given the sub_index
for the submatrix, and a base to overwrite values, get the full index for the 2^n by 2^n matrix.
Invert a unitary op (equivalent to conjugate transpose).