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 | #pragma once | |||
16 | ||||
17 | #include "Circuit/Circuit.hpp" | |||
18 | #include "Converters.hpp" | |||
19 | ||||
20 | namespace tket { | |||
21 | ||||
22 | class CXMaker { | |||
23 | public: | |||
24 | 265 | explicit CXMaker(unsigned qubits, bool reverse_cx_dirs = false) | ||
25 |
1/2✓ Branch 2 taken 265 times.
✗ Branch 3 not taken.
|
265 | : _circ(qubits), _reverse_cx_dirs(reverse_cx_dirs) {} | |
26 | void row_add(unsigned r0, unsigned r1); | |||
27 | Circuit _circ; | |||
28 | bool _reverse_cx_dirs; | |||
29 | }; | |||
30 | ||||
31 | class DiagMatrix { | |||
32 | public: | |||
33 | 97 | DiagMatrix() {} | ||
34 | ✗ | explicit DiagMatrix(const MatrixXb& matrix) : _matrix(matrix) {} | ||
35 | void row_add(unsigned r0, unsigned r1); | |||
36 | void col_add(unsigned c0, unsigned c1); | |||
37 | void gauss(CXMaker& cxmaker, unsigned blocksize = 6); | |||
38 | friend std::ostream& operator<<(std::ostream& out, const DiagMatrix& diam); | |||
39 | bool is_id() const; | |||
40 | bool is_id_until_columns(unsigned limit) const; | |||
41 | unsigned n_rows() const; | |||
42 | unsigned n_cols() const; | |||
43 | ||||
44 | MatrixXb _matrix; | |||
45 | }; | |||
46 | ||||
47 | } // namespace tket | |||
48 |