[][src]Module qip::state_ops

Enums

QubitOp

Types of unitary ops which can be applied to a state.

Functions

apply_op

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

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.

from_reals

Make a vector of complex numbers whose reals are given by data

from_tuples

Make a vector of complex numbers whose reals are given by the first tuple entry in data and whose imaginaries are from the second.

full_to_sub

Get the index for a submatrix indexed by indices given the full_index for the larger 2^n by 2^n matrix.

get_index

Get the ith qubit index for op

make_control_op

Make a Control QubitOp

make_function_op

Make a Function QubitOp

make_matrix_op

Make a Matrix QubitOp

make_op_matrix

Make the full op matrix from ops. Not very efficient, use only for debugging.

make_sparse_matrix_from_function

Make a SparseMatrix QubitOp from a vector of rows (with (column, value)) build 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_sparse_matrix_op

Make a SparseMatrix QubitOp 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_swap_op

Make a Swap QubitOp

num_indices

Get the number of indices represented by op

select_matrix_coords

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'.

sub_to_full

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.