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

Method compute_state_element

examples/quantum_computing_ex.cpp:170–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169 template <typename exp>
170 qc_scalar_type compute_state_element (
171 const matrix_exp<exp>& reg,
172 long row_idx
173 ) const
174 {
175 unsigned long output = row_idx;
176 // if the input control bit is set
177 if (is_key(output>>1))
178 {
179 output = output^0x1;
180 }
181
182 return reg(output);
183 }
184};
185
186// ----------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

is_keyFunction · 0.85

Tested by

no test coverage detected