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

pub fn make_control_op(
    c_indices: Vec<u64>,
    op: UnitaryOp
) -> Result<UnitaryOp, CircuitError>

Make a Control UnitaryOp

Example

use qip::state_ops::make_control_op;
use qip::state_ops::UnitaryOp::{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);
}