Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | // Copyright 2019-2022 Cambridge Quantum Computing | |||
2 | // | |||
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |||
4 | // you may not use this file except in compliance with the License. | |||
5 | // You may obtain a copy of the License at | |||
6 | // | |||
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |||
8 | // | |||
9 | // Unless required by applicable law or agreed to in writing, software | |||
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |||
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
12 | // See the License for the specific language governing permissions and | |||
13 | // limitations under the License. | |||
14 | ||||
15 | #include "DiagUtils.hpp" | |||
16 | ||||
17 | namespace tket { | |||
18 | ||||
19 | 78 | void insert_into_gadget_map( | ||
20 | QubitOperator &gadget_map, const PauliGadgetProperties &pgp) { | |||
21 |
1/2✓ Branch 1 taken 78 times.
✗ Branch 2 not taken.
|
78 | QubitOperator::iterator iter = gadget_map.find(pgp.tensor_); | |
22 |
1/2✓ Branch 2 taken 78 times.
✗ Branch 3 not taken.
|
1/2✓ Decision 'true' taken 78 times.
✗ Decision 'false' not taken.
|
78 | if (iter == gadget_map.end()) |
23 |
2/4✓ Branch 1 taken 78 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 78 times.
✗ Branch 5 not taken.
|
78 | gadget_map[pgp.tensor_] = pgp.angle_; | |
24 | else { | |||
25 | ✗ | QubitPauliTensor string_to_insert = pgp.tensor_ * iter->first; | ||
26 | ✗ | Expr ang_to_insert = pgp.angle_ * iter->second; | ||
27 | ✗ | gadget_map.erase(iter); | ||
28 | ✗ | gadget_map[string_to_insert] = ang_to_insert; | ||
29 | } | |||
30 | 78 | } | ||
31 | ||||
32 | } // namespace tket | |||
33 |