Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/TwoQubitEncoding #342

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5a32776
set the main structure
Jun 23, 2023
014f075
Merge branch 'main' into feature/avelsh
avelsh Jun 23, 2023
9c9256e
🎨 pre-commit fixes
pre-commit-ci[bot] Jun 23, 2023
a7822e0
add SQG and TQG encoding
Jul 8, 2023
59393a8
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 8, 2023
cdd566e
update comments
Jul 13, 2023
716b8a6
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Jul 13, 2023
499b06e
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 13, 2023
d283ef8
update according to comments, rename two qubit encoder
Jul 30, 2023
77cc2a5
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Jul 30, 2023
7c7d542
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 30, 2023
9b0155a
correct asssertTwoQubitGateConstr
Aug 9, 2023
c9c1a44
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Aug 9, 2023
0266b24
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 9, 2023
122dd5d
fix two qubit encoding
Aug 14, 2023
1c0a309
rename from STDepth to TQDepth
Aug 14, 2023
7ca3ec7
sync with upstream
Aug 14, 2023
dfea58a
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 14, 2023
cf12bef
remove addIdentityGateToTQGVariables func
Aug 14, 2023
c095997
set a new func for founding of a two qubit depth
Aug 16, 2023
b6e11dd
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Aug 16, 2023
b128086
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 16, 2023
e37653d
fix founding of phase and set the last layer of paulis
Aug 21, 2023
8d1da8f
remove irrelevant tests
Aug 21, 2023
d042b11
set bindings and small fixes
Sep 5, 2023
92c5df6
optimize the using of variables
Sep 6, 2023
727fba8
Merge branch 'main' into feature/avelsh
pehamTom Sep 9, 2023
0425bfc
Merge remote-tracking branch 'avelsh/feature/avelsh' into feature/avelsh
pehamTom Sep 9, 2023
bd9af05
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 9, 2023
3a4c206
Added parsing of target metric for two_qubit_depth
pehamTom Sep 9, 2023
247e276
Merge remote-tracking branch 'avelsh/feature/avelsh' into feature/avelsh
pehamTom Sep 9, 2023
1b39f2b
update according comments
Sep 10, 2023
c8bb1d6
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Sep 10, 2023
a80fd55
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 10, 2023
098d4d6
set a new extra SQG layer
Sep 18, 2023
caafb46
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 18, 2023
31090be
create a new func pauliGateToIndex
Oct 10, 2023
292052b
Merge remote-tracking branch 'origin/feature/avelsh' into feature/avelsh
Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extern/LogicBlocks
6 changes: 6 additions & 0 deletions include/cliffordsynthesis/CliffordSynthesizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ class CliffordSynthesizer {
return metric == TargetMetric::Depth;
}

static bool requiresTwoQubitEncoding(const TargetMetric metric) {
return metric == TargetMetric::TQDepth;
}

void determineInitialTimestepLimit(EncoderConfig& config);
std::pair<std::size_t, std::size_t> determineUpperBound(EncoderConfig config);
void runMaxSAT(const EncoderConfig& config);
Expand All @@ -92,6 +96,8 @@ class CliffordSynthesizer {
std::size_t upper);
void depthOptimalSynthesis(EncoderConfig config, std::size_t lower,
std::size_t upper);
void twoQubitDepthOptimalSynthesis(EncoderConfig config, std::size_t lower,
std::size_t upper);
void depthHeuristicSynthesis();
void twoQubitGateOptimalSynthesis(EncoderConfig config, std::size_t lower,
std::size_t upper);
Expand Down
11 changes: 8 additions & 3 deletions include/cliffordsynthesis/Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ struct Configuration {
/// Settings for depth-optimal synthesis
bool minimizeGatesAfterDepthOptimization = false;

/// Settings for STDepth-optimal synthesis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment inconsistent with variable naming

bool useTwoQubitEncoding = false;

/// Settings for two-qubit gate-optimal synthesis
bool tryHigherGateLimitForTwoQubitGateOptimization = false;
double gateLimitFactor = 1.1;
Expand All @@ -63,9 +66,10 @@ struct Configuration {
j["gate_limit_factor"] = gateLimitFactor;
j["minimize_gates_after_two_qubit_gate_optimization"] =
minimizeGatesAfterTwoQubitGateOptimization;
j["heuristic"] = heuristic;
j["split_size"] = splitSize;
j["n_threads_heuristic"] = nThreadsHeuristic;
j["use_two_qubit_encoding"] = useTwoQubitEncoding;
j["heuristic"] = heuristic;
j["split_size"] = splitSize;
j["n_threads_heuristic"] = nThreadsHeuristic;
if (!solverParameters.empty()) {
nlohmann::json solverParametersJson;
for (const auto& entry : solverParameters) {
Expand All @@ -77,6 +81,7 @@ struct Configuration {
}
j["solver_parameters"] = solverParametersJson;
}

return j;
}

Expand Down
9 changes: 7 additions & 2 deletions include/cliffordsynthesis/Results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Results {
return singleQubitGates;
}
[[nodiscard]] std::size_t getDepth() const { return depth; }
[[nodiscard]] std::size_t getTQDepth() const { return tQDepth; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

[[nodiscard]] double getRuntime() const { return runtime; }
[[nodiscard]] logicbase::Result getSolverResult() const {
return solverResult;
Expand All @@ -52,6 +53,7 @@ class Results {
void setSingleQubitGates(const std::size_t g) { singleQubitGates = g; }
void setTwoQubitGates(const std::size_t g) { twoQubitGates = g; }
void setDepth(const std::size_t d) { depth = d; }
void setTQDepth(const std::size_t d) { tQDepth = d; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

void setRuntime(const double t) { runtime = t; }
void setSolverResult(const logicbase::Result r) { solverResult = r; }
void setSolverCalls(const std::size_t c) { solverCalls = c; }
Expand Down Expand Up @@ -80,6 +82,7 @@ class Results {
resultJSON["single_qubit_gates"] = singleQubitGates;
resultJSON["two_qubit_gates"] = twoQubitGates;
resultJSON["depth"] = depth;
resultJSON["tQDepth"] = tQDepth;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

resultJSON["runtime"] = runtime;
resultJSON["solver_calls"] = solverCalls;

Expand All @@ -96,8 +99,10 @@ class Results {
std::size_t singleQubitGates = std::numeric_limits<std::size_t>::max();
std::size_t twoQubitGates = std::numeric_limits<std::size_t>::max();
std::size_t depth = std::numeric_limits<std::size_t>::max();
double runtime = 0.0;
std::size_t solverCalls = 0U;
std::size_t tQDepth = std::numeric_limits<std::size_t>::max();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename


double runtime = 0.0;
std::size_t solverCalls = 0U;

std::string resultTableau{};
std::string resultCircuit{};
Expand Down
7 changes: 6 additions & 1 deletion include/cliffordsynthesis/TargetMetric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <string>

namespace cs {
enum class TargetMetric { Gates, TwoQubitGates, Depth };
enum class TargetMetric { Gates, TwoQubitGates, Depth, TQDepth };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename


[[maybe_unused]] static inline std::string toString(const TargetMetric target) {
switch (target) {
Expand All @@ -19,6 +19,8 @@ enum class TargetMetric { Gates, TwoQubitGates, Depth };
return "two_qubit_gates";
case TargetMetric::Depth:
return "depth";
case TargetMetric::TQDepth:
return "tQDepth";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

}
return "Error";
}
Expand All @@ -34,6 +36,9 @@ targetMetricFromString(const std::string& target) {
if (target == "depth") {
return TargetMetric::Depth;
}
if (target == "tQDepth") {
return TargetMetric::TQDepth;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

return TargetMetric::Gates;
}
} // namespace cs
39 changes: 26 additions & 13 deletions include/cliffordsynthesis/encoding/GateEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,24 @@
logicbase::LogicMatrix3D gS{};
// variables for the two-qubit gates
logicbase::LogicMatrix3D gC{};
// variables for the pauli-qubit gates
logicbase::LogicMatrix gP{};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These variables are only used by the TwoQubitGateEncoder, please move the method there.


void
collectSingleQubitGateVariables(std::size_t pos, std::size_t qubit,
logicbase::LogicVector& variables) const;
void collectTwoQubitGateVariables(std::size_t pos, std::size_t qubit,
bool target,
logicbase::LogicVector& variables) const;
void
collectPauliQubitGateVariables(std::size_t qubit,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is only used by the TwoQubitGateEncoder, please move the method there.

logicbase::LogicVector& variables) const;
};

// variable creation
void createSingleQubitGateVariables();
void createTwoQubitGateVariables();
virtual void createSingleQubitGateVariables(std::size_t tqEncoding);
virtual void createTwoQubitGateVariables(std::size_t tqEncoding);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, please move.

virtual void createPauliQubitGateVariables();

// encode the relation between the tableaus and the gates
virtual void encodeGates() {
Expand All @@ -52,13 +58,20 @@
virtual void encodeSymmetryBreakingConstraints();

// extracting the circuit
void extractCircuitFromModel(Results& res, logicbase::Model& model);
virtual void extractCircuitFromModel(Results& res, logicbase::Model& model);

[[nodiscard]] auto* getVariables() { return &vars; }

static constexpr std::array<qc::OpType, 7> SINGLE_QUBIT_GATES = {
qc::OpType::None, qc::OpType::X, qc::OpType::Y, qc::OpType::Z,
qc::OpType::H, qc::OpType::S, qc::OpType::Sdag};
// TODO: set back
static constexpr std::array<qc::OpType, 4> SINGLE_QUBIT_GATES = {
qc::OpType::None, qc::OpType::H, qc::OpType::S, qc::OpType::SX};

// static constexpr std::array<qc::OpType, 7> SINGLE_QUBIT_GATES = {
// qc::OpType::None, qc::OpType::X, qc::OpType::Y, qc::OpType::Z,
// qc::OpType::H, qc::OpType::S, qc::OpType::Sdag};
Fixed Show fixed Hide fixed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, you can leave this like this at the moment.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think PAULI_GATES is a better name here.

static constexpr std::array<qc::OpType, 4> PAULI_QUBIT_GATES = {
qc::OpType::None, qc::OpType::X, qc::OpType::Y, qc::OpType::Z};

[[nodiscard]] static constexpr std::size_t
gateToIndex(const qc::OpType type) {
Expand Down Expand Up @@ -130,9 +143,9 @@
virtual void assertSingleQubitGateConstraints(std::size_t pos) = 0;
virtual void assertTwoQubitGateConstraints(std::size_t pos) = 0;
[[nodiscard]] static std::vector<TransformationFamily>
collectGateTransformations(std::size_t pos, std::size_t qubit,
const GateToTransformation& gateToTransformation);
void assertGatesImplyTransform(
collectGateTransformations(std::size_t pos, std::size_t qubit,
const GateToTransformation& gateToTransformation);
virtual void assertGatesImplyTransform(
std::size_t pos, std::size_t qubit,
const std::vector<TransformationFamily>& transformations);
virtual void assertZConstraints(std::size_t pos, std::size_t qubit);
Expand All @@ -142,10 +155,10 @@
createTwoQubitGateConstraint(std::size_t pos, std::size_t ctrl,
std::size_t trgt) = 0;

void extractSingleQubitGatesFromModel(std::size_t pos,
logicbase::Model& model,
qc::QuantumComputation& qc,
std::size_t& nSingleQubitGates);
virtual void extractSingleQubitGatesFromModel(std::size_t pos,
logicbase::Model& model,
qc::QuantumComputation& qc,
std::size_t& nSingleQubitGates);
void extractTwoQubitGatesFromModel(std::size_t pos, logicbase::Model& model,
qc::QuantumComputation& qc,
std::size_t& nTwoQubitGates);
Expand Down
6 changes: 6 additions & 0 deletions include/cliffordsynthesis/encoding/SATEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class SATEncoder {
// whether to use symmetry breaking
bool useSymmetryBreaking = false;

// whether to use SQG-TQG encoding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename

bool useTwoQubitEncoding = false;

// the number of threads to pass to the SAT solver
std::size_t nThreads = 1U;

// an optional limit on the total number of gates
std::optional<std::size_t> gateLimit = std::nullopt;

Expand Down
54 changes: 54 additions & 0 deletions include/cliffordsynthesis/encoding/TwoQubitEncoder.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// Created by Velsh Aleksei on 16.06.23.
//

#pragma once

#include "cliffordsynthesis/encoding/GateEncoder.hpp"

#include <cstddef>
#include <optional>

namespace cs::encoding {

class TwoQubitEncoder : public GateEncoder {
public:
using GateEncoder::GateEncoder;

protected:
logicbase::LogicTerm rChanges{};
logicbase::LogicMatrix xorHelpers{};

void assertConsistency() const override;
void assertGateConstraints() override;
void assertRConstraints(std::size_t pos, std::size_t qubit) override;
void assertSingleQubitGateConstraints(std::size_t pos) override;
void assertPauliGateConstraints(std::size_t pos);
void assertTwoQubitGateConstraints(std::size_t pos) override;
[[nodiscard]] logicbase::LogicTerm
createTwoQubitGateConstraint(std::size_t pos, std::size_t ctrl,
std::size_t trgt) override;
[[nodiscard]] logicbase::LogicTerm
createIdentityConstraintOnTQG(std::size_t pos, std::size_t ctrl);

// assert constrains
void assertSingleQubitGateOrderConstraints(std::size_t pos,
std::size_t qubit) override;
void assertTwoQubitGateOrderConstraints(std::size_t pos, std::size_t ctrl,
std::size_t trgt) override;

// collect TQG variables
void collectTwoQubitGateVariables(std::size_t pos, std::size_t qubit,
bool target,
logicbase::LogicVector& variables) const;
// extracting the circuit
void extractCircuitFromModel(Results& res, logicbase::Model& model) override;

void splitXorR(const logicbase::LogicTerm& changes, std::size_t pos);

virtual void assertGatesImplyTransform(

Check warning on line 49 in include/cliffordsynthesis/encoding/TwoQubitEncoder.hpp

View workflow job for this annotation

GitHub Actions / 🇨‌ Lint / 🚨 Lint

/include/cliffordsynthesis/encoding/TwoQubitEncoder.hpp:49:16 [cppcoreguidelines-explicit-virtual-functions

'virtual' is redundant since the function is already declared 'override'
std::size_t pos, std::size_t qubit,
const std::vector<TransformationFamily>& transformations) override;
};

} // namespace cs::encoding
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ macro(ADD_SYNTHESIS_LIBRARY libname srcfile)
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/Configuration.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/GateEncoder.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/MultiGateEncoder.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/TwoQubitEncoder.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/ObjectiveEncoder.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/SATEncoder.hpp
${PROJECT_SOURCE_DIR}/include/cliffordsynthesis/encoding/SingleGateEncoder.hpp
Expand All @@ -70,6 +71,7 @@ macro(ADD_SYNTHESIS_LIBRARY libname srcfile)
${PROJECT_SOURCE_DIR}/include/utils.hpp
cliffordsynthesis/encoding/GateEncoder.cpp
cliffordsynthesis/encoding/MultiGateEncoder.cpp
cliffordsynthesis/encoding/TwoQubitEncoder.cpp
cliffordsynthesis/encoding/ObjectiveEncoder.cpp
cliffordsynthesis/encoding/SATEncoder.cpp
cliffordsynthesis/encoding/SingleGateEncoder.cpp
Expand Down
46 changes: 45 additions & 1 deletion src/cliffordsynthesis/CliffordSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

#include "cliffordsynthesis/CliffordSynthesizer.hpp"

#include "LogicTerm/Logic.hpp"
#include "QuantumComputation.hpp"
#include "cliffordsynthesis/Tableau.hpp"
#include "utils/logging.hpp"

#include <chrono>
#include <fstream>
#include <future>
#include <iostream>
#include <memory>
#include <thread>

Expand Down Expand Up @@ -44,6 +44,8 @@ void CliffordSynthesizer::synthesize(const Configuration& config) {
encoderConfig.solverParameters = configuration.solverParameters;
encoderConfig.useMultiGateEncoding =
requiresMultiGateEncoding(encoderConfig.targetMetric);
encoderConfig.useTwoQubitEncoding =
requiresTwoQubitEncoding(encoderConfig.targetMetric);

if (configuration.heuristic) {
if (initialCircuit->empty() && !targetTableau.isIdentityTableau()) {
Expand Down Expand Up @@ -97,6 +99,9 @@ void CliffordSynthesizer::synthesize(const Configuration& config) {
case TargetMetric::TwoQubitGates:
twoQubitGateOptimalSynthesis(encoderConfig, 0U, results.getTwoQubitGates());
break;
case TargetMetric::TQDepth:
twoQubitDepthOptimalSynthesis(encoderConfig, lower, upper);
break;
}

results.setSolverCalls(solverCalls);
Expand Down Expand Up @@ -130,6 +135,10 @@ void CliffordSynthesizer::determineInitialTimestepLimit(EncoderConfig& config) {
config.timestepLimit = results.getDepth();
INFO() << "Using initial circuit's depth as initial timestep limit: "
<< config.timestepLimit;
} else if (requiresTwoQubitEncoding(config.targetMetric)) {
config.timestepLimit = results.getTQDepth();
INFO() << "Using initial circuit's tQDepth as initial timestep limit: "
<< config.timestepLimit;
} else {
config.timestepLimit = results.getGates();
INFO() << "Using initial circuit's gate count as initial timestep limit: "
Expand Down Expand Up @@ -159,6 +168,9 @@ CliffordSynthesizer::determineUpperBound(EncoderConfig config) {
if (!results.sat()) {
lowerBound = upperBound + 1U;
upperBound *= 2U;
std::cout << "No solution found for " << config.timestepLimit
<< " timestep(s). Doubling timestep limit to " << upperBound
<< std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover Debug print. Please remove.

INFO() << "No solution found for " << config.timestepLimit
<< " timestep(s). Doubling timestep limit to " << upperBound;
config.timestepLimit = upperBound;
Expand All @@ -170,6 +182,8 @@ CliffordSynthesizer::determineUpperBound(EncoderConfig config) {
upperBound = std::min(upperBound, results.getGates());
} else if (config.targetMetric == TargetMetric::Depth) {
upperBound = std::min(upperBound, results.getDepth());
} else if (config.targetMetric == TargetMetric::TQDepth) {
upperBound = std::max(upperBound, results.getTQDepth());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have discussed, this can't be right. The optimal synthesis result cannot have a higher depth then either of these values.

}

INFO() << "Found upper bound for the number of timesteps: " << upperBound;
Expand Down Expand Up @@ -237,6 +251,29 @@ void CliffordSynthesizer::depthOptimalSynthesis(
}
}

void CliffordSynthesizer::twoQubitDepthOptimalSynthesis(
CliffordSynthesizer::EncoderConfig config, const std::size_t lower,
const std::size_t upper) {
// tQDepth-optimal synthesis is achieved by determining a timestep limit T
// such that there exists a solution with tQDepth T, but no solution with
// tQDepth T-1. This procedure uses an encoding (SQG - TQG) where in single
// and two qubit gates are allowed just one gate per timestep. This procedure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tiny bit misleading. The number of gates is not restricted per timestep

// is guaranteed to produce a depth-optimal circuit. However, the number of
// gates in the resulting circuit is not necessarily minimal, i.e., there may
// be a solution with fewer gates and the same depth. To this end, an
// optimization pass is provided that additionally minimizes the number of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This optimization pass is not currently present

// gates.

if (configuration.linearSearch) {
runLinearSearch(config.timestepLimit, lower, upper, config);
} else {
// The binary search approach calls the SAT solver repeatedly with varying
// timestep (=tQDepth) limits T until a solution with tQDepth T is found,
// but no solution with tQDepth T-1 could be determined.
runBinarySearch(config.timestepLimit, lower, upper, config);
}
}

void CliffordSynthesizer::minimizeGatesFixedDepth(EncoderConfig config) {
if (results.getDepth() == 0U) {
return;
Expand Down Expand Up @@ -427,6 +464,13 @@ void CliffordSynthesizer::updateResults(const Configuration& config,
currentResults = newResults;
}
break;
case TargetMetric::TQDepth:
if ((newResults.getTQDepth() < currentResults.getTQDepth()) ||
((newResults.getTQDepth() == currentResults.getTQDepth()) &&
(newResults.getGates() < currentResults.getGates()))) {
currentResults = newResults;
}
break;
}
}

Expand Down
Loading
Loading