| 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 | // ---------------------------------------------------------------------------------------- |