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

Method compute_state_element

dlib/quantum_computing/quantum_computing.h:725–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723
724 template <typename exp>
725 qc_scalar_type compute_state_element (
726 const matrix_exp<exp>& reg,
727 long row_idx
728 ) const
729 {
730 // make sure requires clause is not broken
731 DLIB_ASSERT(reg.nr() == dims && reg.nc() == 1 &&
732 0 <= row_idx && row_idx < dims,
733 "\tqc_scalar_type cnot::compute_state_element(reg,row_idx)"
734 << "\n\tinvalid arguments to this function"
735 << "\n\treg.nr(): " << reg.nr()
736 << "\n\treg.nc(): " << reg.nc()
737 << "\n\tdims: " << dims
738 << "\n\trow_idx: " << row_idx
739 << "\n\tthis: " << this
740 );
741
742
743 unsigned long output = row_idx;
744 // if the input control bit is set
745 if (control_mask&output)
746 {
747 output = output^target_mask;
748 }
749
750 return reg(output);
751 }
752
753 private:
754

Callers

nothing calls this directly

Calls 2

nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected