[][src]Function qip::state_ops::make_control_op

pub fn make_control_op(
    c_indices: Vec<u64>,
    op: QubitOp
) -> Result<QubitOp, &'static str>

Make a Control QubitOp

Example

use qip::state_ops::make_control_op;
use qip::state_ops::QubitOp::{Matrix, Control};
let op = Matrix(vec![1], vec![/* ... */]);
let cop = make_control_op(vec![0], op).unwrap();

if let Control(c_indices, o_indices, _) = cop {
    assert_eq!(c_indices, vec![0]);
    assert_eq!(o_indices, vec![1]);
} else {
    assert!(false);
}