MCPcopy Create free account
hub / github.com/davisking/dlib / cnot

Method cnot

dlib/quantum_computing/quantum_computing.h:688–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686 COMPILE_TIME_ASSERT(control_bit != target_bit);
687
688 cnot() : gate_exp<cnot>(*this)
689 {
690 const int min_bit = std::min(control_bit, target_bit);
691
692 control_mask = 1;
693 target_mask = 1;
694
695 // make the masks so that their only on bit corresponds to the given control_bit and target_bit bits
696 for (int i = 0; i < control_bit-min_bit; ++i)
697 control_mask <<= 1;
698 for (int i = 0; i < target_bit-min_bit; ++i)
699 target_mask <<= 1;
700 }
701
702 static const long num_bits = gate_traits<cnot>::num_bits;
703 static const long dims = gate_traits<cnot>::dims;

Callers

nothing calls this directly

Calls 1

minFunction · 0.50

Tested by

no test coverage detected