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

♻️🎨 Code cleanup and refactors #798

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

burgholzer
Copy link
Member

Description

Starting the year with some obligatory code cleanup and refactors.
The individual commits and the commit messages should more or less convey the bigger changes.
For the most part, it's really all about defining clearer interfaces and following some new clang-tidy suggestions.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

- opting for references where null values are not expected or accepted.
- moving code from headers to source files.
- fixing new clang-tidy warnings
- adding a little more noexcept were appropriate

Signed-off-by: burgholzer <[email protected]>
Replaced raw pointer usages with references across the codebase for improved clarity and type safety. This adjustment simplifies operations and ensures consistency, particularly when applying, measuring, or resetting operations in simulation and functionality logic. Corresponding tests have been updated to reflect this change.

Signed-off-by: burgholzer <[email protected]>
This is only used in one part of DDSIM that is scheduled for removal. And removed code is debugged code.

Signed-off-by: burgholzer <[email protected]>
these members had getters since a while back. there is no need to keep them as public members.

Signed-off-by: burgholzer <[email protected]>
@burgholzer burgholzer added usability Anything related to usability refactor Anything related to code refactoring code quality Code quality improvements minor Minor version update DD Anything related to the DD package Core Anything related to the Core library and IR c++ Anything related to C++ code labels Jan 10, 2025
@burgholzer burgholzer self-assigned this Jan 10, 2025
@@ -38,17 +38,17 @@
const auto nq = GetParam();

auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::RandomCliffordCircuit(nq, nq * nq, 12345);
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High test

Multiplication result may overflow 'unsigned int' before it is converted to 'size_t'.

Copilot Autofix AI about 24 hours ago

To fix the problem, we need to ensure that the multiplication is performed using the larger type std::size_t to avoid overflow. This can be done by casting one of the operands to std::size_t before performing the multiplication. This ensures that the multiplication is done in the larger type, preventing overflow.

  • Cast nq to std::size_t before performing the multiplication.
  • Update the relevant lines in the file test/algorithms/test_random_clifford.cpp.
Suggested changeset 1
test/algorithms/test_random_clifford.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/algorithms/test_random_clifford.cpp b/test/algorithms/test_random_clifford.cpp
--- a/test/algorithms/test_random_clifford.cpp
+++ b/test/algorithms/test_random_clifford.cpp
@@ -40,3 +40,3 @@
   auto dd = std::make_unique<dd::Package<>>(nq);
-  auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
+  auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
   auto in = dd->makeZeroState(nq);
@@ -50,3 +50,3 @@
   auto dd = std::make_unique<dd::Package<>>(nq);
-  auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
+  auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
   ASSERT_NO_THROW({ dd::buildFunctionality(qc, *dd); });
EOF
@@ -40,3 +40,3 @@
auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
auto in = dd->makeZeroState(nq);
@@ -50,3 +50,3 @@
auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
ASSERT_NO_THROW({ dd::buildFunctionality(qc, *dd); });
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
qc.printStatistics(std::cout);
}

TEST_P(RandomClifford, buildFunctionality) {
const auto nq = GetParam();

auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::RandomCliffordCircuit(nq, nq * nq, 12345);
ASSERT_NO_THROW({ dd::buildFunctionality(&qc, *dd); });
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High test

Multiplication result may overflow 'unsigned int' before it is converted to 'size_t'.

Copilot Autofix AI about 24 hours ago

To fix the problem, we need to ensure that the multiplication is performed using the larger integer type to avoid overflow. This can be done by casting one of the operands to std::size_t before performing the multiplication. Specifically, we will cast nq to std::size_t in the multiplication expression nq * nq on line 51.

Suggested changeset 1
test/algorithms/test_random_clifford.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/test/algorithms/test_random_clifford.cpp b/test/algorithms/test_random_clifford.cpp
--- a/test/algorithms/test_random_clifford.cpp
+++ b/test/algorithms/test_random_clifford.cpp
@@ -40,3 +40,3 @@
   auto dd = std::make_unique<dd::Package<>>(nq);
-  auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
+  auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
   auto in = dd->makeZeroState(nq);
@@ -50,3 +50,3 @@
   auto dd = std::make_unique<dd::Package<>>(nq);
-  auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
+  auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
   ASSERT_NO_THROW({ dd::buildFunctionality(qc, *dd); });
EOF
@@ -40,3 +40,3 @@
auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
auto in = dd->makeZeroState(nq);
@@ -50,3 +50,3 @@
auto dd = std::make_unique<dd::Package<>>(nq);
auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
auto qc = qc::createRandomCliffordCircuit(nq, static_cast<std::size_t>(nq) * nq, 12345);
ASSERT_NO_THROW({ dd::buildFunctionality(qc, *dd); });
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v18.1.8) reports: 53 concern(s)
  • eval/eval_dd_package.cpp:103:35: warning: [misc-include-cleaner]

    no header providing "qc::Qubit" is directly included

       10 | benchmarkSimulateGrover(const qc::Qubit nq, const BitString& targetValue) {
          |                                   ^
  • eval/eval_dd_package.cpp:103:51: warning: [misc-include-cleaner]

    no header providing "qc::BitString" is directly included

      103 | benchmarkSimulateGrover(const qc::Qubit nq, const BitString& targetValue) {
          |                                                   ^
  • eval/eval_dd_package.cpp:358:49: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'std::size_t' (aka 'unsigned long') of a multiplication performed in type 'value_type' (aka 'unsigned int')

      358 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^
    /home/runner/work/mqt-core/mqt-core/eval/eval_dd_package.cpp:358:49: note: make conversion explicit to silence this warning
      358 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^~~~~~~
          |                                                 static_cast<std::size_t>( )
    /home/runner/work/mqt-core/mqt-core/eval/eval_dd_package.cpp:358:49: note: perform multiplication in a wider type
      358 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^~
          |                                                 static_cast<std::size_t>( )
  • eval/eval_dd_package.cpp:365:49: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'std::size_t' (aka 'unsigned long') of a multiplication performed in type 'value_type' (aka 'unsigned int')

      365 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^
    /home/runner/work/mqt-core/mqt-core/eval/eval_dd_package.cpp:365:49: note: make conversion explicit to silence this warning
      365 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^~~~~~~
          |                                                 static_cast<std::size_t>( )
    /home/runner/work/mqt-core/mqt-core/eval/eval_dd_package.cpp:365:49: note: perform multiplication in a wider type
      365 |       auto qc = createRandomCliffordCircuit(nq, nq * nq, SEED);
          |                                                 ^~
          |                                                 static_cast<std::size_t>( )
  • include/mqt-core/algorithms/BernsteinVazirani.hpp:19:59: warning: [misc-include-cleaner]

    no header providing "std::size_t" is directly included

       14 | 
       15 | namespace qc {
       16 | 
       17 | [[nodiscard]] auto createBernsteinVazirani(const BitString& hiddenString)
       18 |     -> QuantumComputation;
       19 | [[nodiscard]] auto createBernsteinVazirani(Qubit nq, std::size_t seed = 0)
          |                                                           ^
  • include/mqt-core/algorithms/QPE.hpp:16:64: warning: [misc-include-cleaner]

    no header providing "std::size_t" is directly included

       14 | 
       15 | namespace qc {
       16 | [[nodiscard]] auto createQPE(Qubit nq, bool exact = true, std::size_t seed = 0)
          |                                                                ^
  • include/mqt-core/dd/FunctionalityConstruction.hpp:12:1: warning: [misc-include-cleaner]

    included header Operations.hpp is not used directly

       12 | #include "dd/Operations.hpp"
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
       13 | #include "dd/Package_fwd.hpp"
  • include/mqt-core/dd/FunctionalityConstruction.hpp:16:1: warning: [misc-include-cleaner]

    included header OpType.hpp is not used directly

       16 | #include "ir/operations/OpType.hpp"
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       17 | 
  • include/mqt-core/dd/FunctionalityConstruction.hpp:19:1: warning: [misc-include-cleaner]

    included header memory is not used directly

       19 | #include <memory>
          | ^~~~~~~~~~~~~~~~~
       20 | #include <ostream>
  • include/mqt-core/dd/FunctionalityConstruction.hpp:20:1: warning: [misc-include-cleaner]

    included header ostream is not used directly

       20 | #include <ostream>
          | ^~~~~~~~~~~~~~~~~~
       21 | #include <stack>
  • include/mqt-core/dd/FunctionalityConstruction.hpp:22:1: warning: [misc-include-cleaner]

    included header vector is not used directly

       22 | #include <vector>
          | ^~~~~~~~~~~~~~~~~
       23 | 
  • include/mqt-core/ir/QuantumComputation.hpp:77:3: warning: [misc-include-cleaner]

    no header providing "qc::Permutation" is directly included

       13 |   Permutation initialLayout{};
          |   ^
  • include/mqt-core/ir/QuantumComputation.hpp:432:44: warning: [misc-include-cleaner]

    no header providing "std::stringstream" is directly included

       26 |   static void printBin(std::size_t n, std::stringstream& ss);
          |                                            ^
  • include/mqt-core/ir/parsers/qasm3_parser/passes/ConstEvalPass.hpp:52:50: warning: [readability-implicit-bool-conversion]

    implicit conversion 'bool' -> 'int64_t' (aka 'long')

       52 |       return std::make_shared<Constant>(Constant(std::get<2>(value), false));
          |                                                  ^                 
          |                                                  static_cast<int64_t>( )
  • src/algorithms/BernsteinVazirani.cpp:43:13: warning: [misc-include-cleaner]

    no header providing "std::string" is directly included

       17 |     -> std::string {
          |             ^
  • src/algorithms/BernsteinVazirani.cpp:53:40: warning: [misc-include-cleaner]

    no header providing "qc::QuantumComputation" is directly included

       13 | auto constructBernsteinVaziraniCircuit(QuantumComputation& qc,
          |                                        ^
  • src/algorithms/QFT.cpp:22:8: warning: [misc-include-cleaner]

    no header providing "qc::QuantumComputation" is directly included

       13 | #include "ir/operations/ClassicControlledOperation.hpp"
       14 | #include "ir/operations/OpType.hpp"
       15 | 
       16 | #include <cmath>
       17 | #include <string>
       18 | 
       19 | namespace qc {
       20 | 
       21 | auto createQFT(const Qubit nq, const bool includeMeasurements)
       22 |     -> QuantumComputation {
          |        ^
  • src/algorithms/QPE.cpp:62:53: warning: [misc-include-cleaner]

    no header providing "std::string" is directly included

       22 |                            const fp lambda) -> std::string {
          |                                                     ^
  • src/algorithms/QPE.cpp:71:26: warning: [misc-include-cleaner]

    no header providing "qc::QuantumComputation" is directly included

       13 | auto constructQPECircuit(QuantumComputation& qc, const fp lambda,
          |                          ^
  • src/algorithms/RandomCliffordCircuit.cpp:207:40: warning: [misc-include-cleaner]

    no header providing "std::to_string" is directly included

       19 |   qc.setName("random_clifford_" + std::to_string(nq) + "_" +
          |                                        ^
  • src/algorithms/RandomCliffordCircuit.cpp:208:19: warning: [misc-include-cleaner]

    no header providing "std::to_string" is directly included

      208 |              std::to_string(depth) + "_" + std::to_string(seed));
          |                   ^
  • src/ir/QuantumComputation.cpp:50:8: warning: [misc-include-cleaner]

    no header providing "std::map" is directly included

       31 |   std::map<decltype(RegisterType::first), std::pair<std::string, RegisterType>>
          |        ^
  • src/ir/QuantumComputation.cpp:1212:10: warning: [misc-include-cleaner]

    no header providing "std::array" is directly included

       22 |     std::array<std::mt19937_64::result_type, std::mt19937_64::state_size>
          |          ^
  • src/ir/QuantumComputation.cpp:1214:10: warning: [misc-include-cleaner]

    no header providing "std::random_device" is directly included

       34 |     std::random_device rd;
          |          ^
  • src/ir/QuantumComputation.cpp:1217:10: warning: [misc-include-cleaner]

    no header providing "std::seed_seq" is directly included

     1217 |     std::seed_seq seeds(std::begin(randomData), std::end(randomData));
          |          ^
  • src/ir/QuantumComputation.cpp:1804:8: warning: [misc-include-cleaner]

    no header providing "std::iota" is directly included

       32 |   std::iota(targets.begin(), targets.end(), 0);
          |        ^
  • src/ir/QuantumComputation.cpp:1817:58: warning: [misc-include-cleaner]

    no header providing "std::uint64_t" is directly included

       26 |     const ClassicalRegister& controlRegister, const std::uint64_t expectedValue,
          |                                                          ^
  • src/ir/QuantumComputation.cpp:1818:11: warning: [misc-include-cleaner]

    no header providing "qc::ComparisonKind" is directly included

       13 |     const ComparisonKind cmp, const std::vector<fp>& params) {
          |           ^
  • src/ir/QuantumComputation.cpp:1837:16: warning: [misc-include-cleaner]

    no header providing "qc::ClassicControlledOperation" is directly included

     1837 |   emplace_back<ClassicControlledOperation>(std::move(gate), controlRegister,
          |                ^
  • src/ir/operations/AodOperation.cpp:36:6: warning: [misc-include-cleaner]

    no header providing "std::string" is directly included

       24 | #include <tuple>
       25 | #include <utility>
       26 | #include <vector>
       27 | 
       28 | namespace na {
       29 | AodOperation::AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
       30 |                            const std::vector<uint32_t>& dirs,
       31 |                            const std::vector<qc::fp>& start,
       32 |                            const std::vector<qc::fp>& end)
       33 |     : AodOperation(s, std::move(qubits), convertToDimension(dirs), start, end) {
       34 | }
       35 | 
       36 | std::string SingleOperation::toQASMString() const {
          |      ^
  • src/ir/operations/AodOperation.cpp:115:16: warning: [misc-include-cleaner]

    no header providing "std::max_element" is directly included

       15 |   return *std::max_element(distances.begin(), distances.end());
          |                ^
  • src/ir/operations/ClassicControlledOperation.cpp:44:10: warning: [misc-include-cleaner]

    no header providing "std::unique_ptr" is directly included

       14 |     std::unique_ptr<Operation>&& operation, ClassicalRegister controlReg,
          |          ^
  • src/ir/operations/ClassicControlledOperation.cpp:45:16: warning: [misc-include-cleaner]

    no header providing "std::uint64_t" is directly included

       14 |     const std::uint64_t expectedVal, ComparisonKind kind)
          |                ^
  • src/ir/operations/ClassicControlledOperation.cpp:46:15: warning: [misc-include-cleaner]

    no header providing "std::move" is directly included

       16 |     : op(std::move(operation)), controlRegister(std::move(controlReg)),
          |               ^
  • src/ir/operations/ClassicControlledOperation.cpp:48:17: warning: [misc-include-cleaner]

    no header providing "qc::shortName" is directly included

       13 |   name = "c_" + shortName(op->getType());
          |                 ^
  • src/ir/operations/ClassicControlledOperation.cpp:53:10: warning: [misc-include-cleaner]

    no header providing "qc::ClassicControlled" is directly included

       53 |   type = ClassicControlled;
          |          ^
  • src/ir/operations/ClassicControlledOperation.cpp:73:47: warning: [misc-include-cleaner]

    no header providing "qc::Permutation" is directly included

       13 |                                         const Permutation& perm1,
          |                                               ^
  • src/ir/operations/ClassicControlledOperation.cpp:93:58: warning: [misc-include-cleaner]

    no header providing "std::size_t" is directly included

       14 |                                               const std::size_t indent,
          |                                                          ^
  • src/ir/operations/SymbolicOperation.cpp:312:6: warning: [misc-include-cleaner]

    no header providing "std::unique_ptr" is directly included

       22 | std::unique_ptr<Operation> SymbolicOperation::clone() const {
          |      ^
  • src/ir/operations/SymbolicOperation.cpp:313:15: warning: [misc-include-cleaner]

    no header providing "std::make_unique" is directly included

      313 |   return std::make_unique<SymbolicOperation>(*this);
          |               ^
  • src/ir/parsers/qasm3_parser/passes/TypeCheckPass.cpp:26:46: warning: [misc-include-cleaner]

    no header providing "std::string" is directly included

       23 | 
       24 | namespace qasm3::type_checking {
       25 | 
       26 | InferredType TypeCheckPass::error(const std::string& msg,
          |                                              ^
  • test/algorithms/test_entanglement.cpp:26:15: warning: [misc-include-cleaner]

    no header providing "std::make_unique" is directly included

       18 | #include <sstream>
       19 | #include <string>
       20 | 
       21 | class Entanglement : public testing::TestWithParam<qc::Qubit> {
       22 | protected:
       23 |   void TearDown() override {}
       24 |   void SetUp() override {
       25 |     nq = GetParam();
       26 |     dd = std::make_unique<dd::Package<>>(nq);
          |               ^
  • test/algorithms/test_entanglement.cpp:29:8: warning: [misc-include-cleaner]

    no header providing "std::unique_ptr" is directly included

       29 |   std::unique_ptr<dd::Package<>> dd;
          |        ^
  • test/algorithms/test_entanglement.cpp:64:42: warning: [misc-include-cleaner]

    no header providing "std::runtime_error" is directly included

       19 |   ASSERT_THROW(dd->makeGHZState(6), std::runtime_error);
          |                                          ^
  • test/algorithms/test_grover.cpp:29:52: warning: [misc-include-cleaner]

    no header providing "qc::Qubit" is directly included

       10 |     : public testing::TestWithParam<std::tuple<qc::Qubit, std::size_t>> {
          |                                                    ^
  • test/algorithms/test_grover.cpp:57:23: warning: [readability-redundant-member-init]

    initializer for member 'expected' is redundant

       57 |   std::string expected{};
          |                       ^~
  • test/algorithms/test_grover.cpp:58:28: warning: [readability-redundant-member-init]

    initializer for member 'targetValue' is redundant

       58 |   qc::BitString targetValue{};
          |                            ^~
  • test/algorithms/test_qft.cpp:27:47: warning: [misc-include-cleaner]

    no header providing "qc::Qubit" is directly included

       10 | class QFT : public testing::TestWithParam<qc::Qubit> {
          |                                               ^
  • test/algorithms/test_qft.cpp:38:7: warning: [misc-include-cleaner]

    no header providing "qc::QuantumComputation" is directly included

       16 |   qc::QuantumComputation qc;
          |       ^
  • test/algorithms/test_random_clifford.cpp:21:58: warning: [misc-include-cleaner]

    no header providing "qc::Qubit" is directly included

       10 | #include "algorithms/RandomCliffordCircuit.hpp"
       11 | #include "dd/FunctionalityConstruction.hpp"
       12 | #include "dd/Package.hpp"
       13 | #include "dd/Simulation.hpp"
       14 | 
       15 | #include <cstddef>
       16 | #include <gtest/gtest.h>
       17 | #include <iostream>
       18 | #include <memory>
       19 | #include <sstream>
       20 | 
       21 | class RandomClifford : public testing::TestWithParam<qc::Qubit> {
          |                                                          ^
  • test/algorithms/test_random_clifford.cpp:41:49: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'std::size_t' (aka 'unsigned long') of a multiplication performed in type 'ParamType' (aka 'unsigned int')

       41 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^
    /home/runner/work/mqt-core/mqt-core/test/algorithms/test_random_clifford.cpp:41:49: note: make conversion explicit to silence this warning
       41 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^~~~~~~
          |                                                 static_cast<std::size_t>( )
    /home/runner/work/mqt-core/mqt-core/test/algorithms/test_random_clifford.cpp:41:49: note: perform multiplication in a wider type
       41 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^~
          |                                                 static_cast<std::size_t>( )
  • test/algorithms/test_random_clifford.cpp:51:49: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'std::size_t' (aka 'unsigned long') of a multiplication performed in type 'ParamType' (aka 'unsigned int')

       51 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^
    /home/runner/work/mqt-core/mqt-core/test/algorithms/test_random_clifford.cpp:51:49: note: make conversion explicit to silence this warning
       51 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^~~~~~~
          |                                                 static_cast<std::size_t>( )
    /home/runner/work/mqt-core/mqt-core/test/algorithms/test_random_clifford.cpp:51:49: note: perform multiplication in a wider type
       51 |   auto qc = qc::createRandomCliffordCircuit(nq, nq * nq, 12345);
          |                                                 ^~
          |                                                 static_cast<std::size_t>( )
  • test/dd/test_dd_functionality.cpp:32:1: warning: [misc-include-cleaner]

    included header sstream is not used directly

       32 | #include <sstream>
          | ^~~~~~~~~~~~~~~~~~
       33 | #include <string>

Have any feedback or feature suggestions? Share it here.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 85.94421% with 131 lines in your changes missing coverage. Please review.

Project coverage is 91.6%. Comparing base (2404c85) to head (3c2d9c6).

Files with missing lines Patch % Lines
src/ir/QuantumComputation.cpp 78.8% 60 Missing ⚠️
src/algorithms/QPE.cpp 82.0% 18 Missing ⚠️
...c/ir/parsers/qasm3_parser/passes/ConstEvalPass.cpp 0.0% 16 Missing ⚠️
src/ir/operations/SymbolicOperation.cpp 56.0% 11 Missing ⚠️
include/mqt-core/dd/Operations.hpp 79.4% 8 Missing ⚠️
src/ir/operations/ClassicControlledOperation.cpp 86.5% 7 Missing ⚠️
src/algorithms/Grover.cpp 92.1% 4 Missing ⚠️
include/mqt-core/ir/operations/AodOperation.hpp 0.0% 2 Missing ⚠️
include/mqt-core/ir/parsers/qasm3_parser/Types.hpp 0.0% 1 Missing ⚠️
...e/ir/parsers/qasm3_parser/passes/ConstEvalPass.hpp 0.0% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #798     +/-   ##
=======================================
- Coverage   92.2%   91.6%   -0.7%     
=======================================
  Files        125     123      -2     
  Lines      13760   13762      +2     
  Branches    2167    2148     -19     
=======================================
- Hits       12697   12611     -86     
- Misses      1063    1151     +88     
Flag Coverage Δ
cpp 91.3% <85.9%> (-0.7%) ⬇️
python 99.7% <ø> (ø)
Files with missing lines Coverage Δ
include/mqt-core/dd/Simulation.hpp 100.0% <100.0%> (ø)
include/mqt-core/ir/QuantumComputation.hpp 100.0% <100.0%> (+8.0%) ⬆️
...-core/ir/operations/ClassicControlledOperation.hpp 96.7% <100.0%> (-0.2%) ⬇️
...clude/mqt-core/ir/operations/CompoundOperation.hpp 100.0% <100.0%> (ø)
include/mqt-core/ir/operations/Control.hpp 100.0% <ø> (ø)
include/mqt-core/ir/operations/Expression.hpp 92.7% <100.0%> (ø)
...ude/mqt-core/ir/operations/NonUnitaryOperation.hpp 100.0% <ø> (ø)
include/mqt-core/ir/operations/Operation.hpp 79.0% <100.0%> (-1.0%) ⬇️
...clude/mqt-core/ir/operations/StandardOperation.hpp 100.0% <ø> (ø)
...clude/mqt-core/ir/operations/SymbolicOperation.hpp 100.0% <ø> (ø)
... and 28 more

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Anything related to C++ code code quality Code quality improvements Core Anything related to the Core library and IR DD Anything related to the DD package minor Minor version update refactor Anything related to code refactoring usability Anything related to usability
Projects
Status: In Progress
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant