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

Method compute_state_element

examples/quantum_computing_ex.cpp:222–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221 template <typename exp>
222 qc_scalar_type compute_state_element (
223 const matrix_exp<exp>& reg,
224 long row_idx
225 ) const
226 {
227 qc_scalar_type temp = sum(reg)*2.0/dims;
228 // compute this value: temp = temp - reg(row_idx)*2.0/dims + reg(row_idx)*(2.0/dims - 1.0)
229 temp = temp - reg(row_idx);
230
231 return temp;
232 }
233};
234
235// ----------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

sumFunction · 0.50

Tested by

no test coverage detected