Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Sep 24, 2024
1 parent 7570f88 commit 73d3239
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 35 deletions.
4 changes: 2 additions & 2 deletions include/mqt-core/datastructures/DirectedGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ template <class V> class DirectedGraph {
ss << "}\n";
return ss.str();
}
friend auto operator<<(std::ostream& os,
const DirectedGraph& g) -> std::ostream& {
friend auto operator<<(std::ostream& os, const DirectedGraph& g)
-> std::ostream& {
return os << g.toString(); // Using toString() method
}
};
Expand Down
17 changes: 9 additions & 8 deletions include/mqt-core/datastructures/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class Layer final {
: operation(op), executableSet(&es) {}

public:
[[nodiscard]] static auto
create(Operation* operation,
ExecutableSet& executableSet) -> std::shared_ptr<DAGVertex> {
[[nodiscard]] static auto create(Operation* operation,
ExecutableSet& executableSet)
-> std::shared_ptr<DAGVertex> {
std::shared_ptr<DAGVertex> v(new DAGVertex(operation, executableSet));
v->updateExecutableSet();
return v;
Expand Down Expand Up @@ -152,10 +152,11 @@ class Layer final {
[[nodiscard]] auto getExecutableSet() const -> const ExecutableSet& {
return executableSet;
}
[[nodiscard]] auto
constructInteractionGraph(OpType opType,
std::size_t nControls) const -> InteractionGraph;
[[nodiscard]] auto getExecutablesOfType(OpType opType, std::size_t nControls)
const -> std::vector<std::shared_ptr<DAGVertex>>;
[[nodiscard]] auto constructInteractionGraph(OpType opType,
std::size_t nControls) const
-> InteractionGraph;
[[nodiscard]] auto getExecutablesOfType(OpType opType,
std::size_t nControls) const
-> std::vector<std::shared_ptr<DAGVertex>>;
};
} // namespace qc
4 changes: 2 additions & 2 deletions include/mqt-core/datastructures/UndirectedGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ template <class V, class E> class UndirectedGraph final {
ss << "}\n";
return ss.str();
}
friend auto operator<<(std::ostream& os,
const UndirectedGraph& g) -> std::ostream& {
friend auto operator<<(std::ostream& os, const UndirectedGraph& g)
-> std::ostream& {
return os << g.toString(); // Using toString() method
}
};
Expand Down
10 changes: 5 additions & 5 deletions include/mqt-core/ir/operations/Operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ class Operation {
bool openQASM3) const = 0;

/// Checks whether operation commutes with other operation on a given qubit.
[[nodiscard]] virtual auto
commutesAtQubit(const Operation& /*other*/,
const Qubit& /*qubit*/) const -> bool {
[[nodiscard]] virtual auto commutesAtQubit(const Operation& /*other*/,
const Qubit& /*qubit*/) const
-> bool {
return false;
}

[[nodiscard]] virtual auto
isInverseOf(const Operation& /*other*/) const -> bool;
[[nodiscard]] virtual auto isInverseOf(const Operation& /*other*/) const
-> bool;

virtual void invert() = 0;

Expand Down
8 changes: 4 additions & 4 deletions include/mqt-core/na/NAComputation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ class NAComputation {
}
}
[[nodiscard]] auto size() const -> std::size_t { return operations.size(); }
[[nodiscard]] auto
getInitialPositions() const -> const std::vector<std::shared_ptr<Point>>& {
[[nodiscard]] auto getInitialPositions() const
-> const std::vector<std::shared_ptr<Point>>& {
return initialPositions;
}
auto emplaceInitialPosition(std::shared_ptr<Point> p) -> void {
initialPositions.emplace_back(std::move(p));
}
[[nodiscard]] auto toString() const -> std::string;
friend auto operator<<(std::ostream& os,
const NAComputation& qc) -> std::ostream& {
friend auto operator<<(std::ostream& os, const NAComputation& qc)
-> std::ostream& {
return os << qc.toString();
}
// Iterators (pass-through)
Expand Down
4 changes: 2 additions & 2 deletions include/mqt-core/na/NADefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ struct FullOpType {
[[nodiscard]] auto toString() const -> std::string {
return std::string(nControls, 'c') + qc::toString(type);
}
friend auto operator<<(std::ostream& os,
const FullOpType& obj) -> std::ostream& {
friend auto operator<<(std::ostream& os, const FullOpType& obj)
-> std::ostream& {
return os << obj.toString(); // Using toString() method
}
[[nodiscard]] auto operator==(const FullOpType& other) const -> bool {
Expand Down
4 changes: 2 additions & 2 deletions include/mqt-core/na/operations/NALocalOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class NALocalOperation : public NAOperation {
explicit NALocalOperation(const FullOpType& opType,
std::shared_ptr<Point> pos)
: NALocalOperation(opType, {}, std::move(pos)) {}
[[nodiscard]] auto
getPositions() const -> const std::vector<std::shared_ptr<Point>>& {
[[nodiscard]] auto getPositions() const
-> const std::vector<std::shared_ptr<Point>>& {
return positions;
}
[[nodiscard]] auto getParams() const -> const std::vector<qc::fp>& {
Expand Down
4 changes: 2 additions & 2 deletions include/mqt-core/na/operations/NAOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class NAOperation {
[[nodiscard]] virtual auto isLocalOperation() const -> bool { return false; }
[[nodiscard]] virtual auto isGlobalOperation() const -> bool { return false; }
[[nodiscard]] virtual auto toString() const -> std::string = 0;
friend auto operator<<(std::ostream& os,
const NAOperation& obj) -> std::ostream& {
friend auto operator<<(std::ostream& os, const NAOperation& obj)
-> std::ostream& {
return os << obj.toString(); // Using toString() method
}
virtual ~NAOperation() = default;
Expand Down
8 changes: 4 additions & 4 deletions include/mqt-core/na/operations/NAShuttlingOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class NAShuttlingOperation : public NAOperation {
std::vector<std::shared_ptr<Point>>{std::move(startPoint)},
std::vector<std::shared_ptr<Point>>{std::move(endPoint)}) {}
[[nodiscard]] auto getType() const -> ShuttleType { return type; }
[[nodiscard]] auto
getStart() const -> const std::vector<std::shared_ptr<Point>>& {
[[nodiscard]] auto getStart() const
-> const std::vector<std::shared_ptr<Point>>& {
return start;
}
[[nodiscard]] auto
getEnd() const -> const std::vector<std::shared_ptr<Point>>& {
[[nodiscard]] auto getEnd() const
-> const std::vector<std::shared_ptr<Point>>& {
return end;
}
[[nodiscard]] auto isShuttlingOperation() const -> bool override {
Expand Down
4 changes: 2 additions & 2 deletions src/datastructures/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace qc {

auto Layer::constructDAG(const QuantumComputation& qc,
const bool commutable) -> void {
auto Layer::constructDAG(const QuantumComputation& qc, const bool commutable)
-> void {
const auto nQubits = qc.getNqubits();
// For a pair of self-canceling operations like two consecutive X operations
// or RY rotations with opposite angles the first operations is a
Expand Down
4 changes: 2 additions & 2 deletions src/ir/Permutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <algorithm>

namespace qc {
[[nodiscard]] auto
Permutation::apply(const Controls& controls) const -> Controls {
[[nodiscard]] auto Permutation::apply(const Controls& controls) const
-> Controls {
if (empty()) {
return controls;
}
Expand Down

0 comments on commit 73d3239

Please sign in to comment.