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 benchmarking #37

Merged
merged 30 commits into from
Aug 7, 2024
Merged

Feature benchmarking #37

merged 30 commits into from
Aug 7, 2024

Conversation

ewanwm
Copy link
Owner

@ewanwm ewanwm commented Aug 2, 2024

Add benchmarking and integrate it using actions so it gets run on every pull request to main. Currently benchmark is pretty simple and consists of just calculating osc probabilities for 1024 batches of 1024 neutrino energies in vacuum and in constant density matter.

For some reason nuTens cannot link with the benchmark library when running in Github actions. This works fine locally so I can't figure out what's going on. Leaving as is for now and will fix in future so that benchmarking can be done in CI.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index bd0a15c..43c0288 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -10 +10,3 @@ Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &the
-    Tensor M1, M2, M3;
+    Tensor M1;
+    Tensor M2;
+    Tensor M3;
@@ -73 +75,4 @@ static void BM_vacuumOscillations(benchmark::State &state)
-    Tensor theta23, theta13, theta12, deltaCP;
+    Tensor theta23;
+    Tensor theta13;
+    Tensor theta12;
+    Tensor deltaCP;

Have any feedback or feature suggestions? Share it here.

benchmarks/benchmarks.cpp Outdated Show resolved Hide resolved
benchmarks/benchmarks.cpp Outdated Show resolved Hide resolved
@@ -0,0 +1,99 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:97:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

ewanwm and others added 2 commits August 2, 2024 22:51
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot dismissed their stale review August 2, 2024 21:52

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index bd0a15c..43c0288 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -10 +10,3 @@ Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &the
-    Tensor M1, M2, M3;
+    Tensor M1;
+    Tensor M2;
+    Tensor M3;
@@ -73 +75,4 @@ static void BM_vacuumOscillations(benchmark::State &state)
-    Tensor theta23, theta13, theta12, deltaCP;
+    Tensor theta23;
+    Tensor theta13;
+    Tensor theta12;
+    Tensor deltaCP;

Have any feedback or feature suggestions? Share it here.

Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &theta23, const Tensor &deltaCP)
{
// set up the three matrices to build the PMNS matrix
Tensor M1;
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
Tensor M1;
Tensor M1;
Tensor M2;
Tensor M3;

masses.ones({1, 3}, NTdtypes::kFloat).requiresGrad(false);
masses.setValue({0, 0}, 0.1);
masses.setValue({0, 1}, 0.2);
masses.setValue({0, 2}, 0.3);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
masses.setValue({0, 2}, 0.3);
Tensor theta23;
Tensor theta13;
Tensor theta12;
Tensor deltaCP;

@@ -0,0 +1,104 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^

for (auto _ : state)
{
// This code gets timed
batchedOscProbs(vacuumProp, energies, state.range(0), state.range(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:97:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 2, 2024 21:54

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Have any feedback or feature suggestions? Share it here.

@@ -0,0 +1,104 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:102:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 2, 2024 21:56

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Have any feedback or feature suggestions? Share it here.

@@ -0,0 +1,104 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:102:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 2, 2024 22:03

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
          ^

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@github-actions github-actions bot dismissed their stale review August 2, 2024 22:08

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 2, 2024 22:23

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 3, 2024 07:00

outdated suggestion

@github-actions github-actions bot dismissed their stale review August 6, 2024 08:52

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 08:56

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 09:09

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 09:11

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 09:31

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 09:34

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 09:41

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

@github-actions github-actions bot dismissed their stale review August 6, 2024 19:26

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
          ^

Copy link
Contributor

github-actions bot commented Aug 7, 2024

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy reports: 4 concern(s)
  • benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

    'benchmark/benchmark.h' file not found

    #include <benchmark/benchmark.h>
             ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                                   ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 0}, 0.1);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 1}, 0.2);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 2}, 0.3);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        std::srand(123);
                   ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 0}, 0.1);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 1}, 0.2);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        masses.setValue({0, 2}, 0.3);
                                ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                     ^
    /home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                     ^
  • benchmarks/benchmarks.cpp:127:39: warning: [cppcoreguidelines-init-variables]

    variable 'matterSolver' is not initialized

        std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
                                          ^
                                                       = 0
  • benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

    BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10});
              ^
  • benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

    BENCHMARK(BM_constMatterOscillations)->Name("Const Density Oscillations")->Args({1 << 10, 1 << 10});
              ^

Have any feedback or feature suggestions? Share it here.

@github-actions github-actions bot dismissed their stale review August 7, 2024 09:53

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

No concerns from clang-format.

Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index e866ee4..1a8fe0a 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
-    std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+    std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

Have any feedback or feature suggestions? Share it here.


// set up the propagator
Propagator matterProp(3, 100.0);
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostics

Suggested change
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);

@@ -0,0 +1,149 @@

#include <benchmark/benchmark.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]

'benchmark/benchmark.h' file not found

#include <benchmark/benchmark.h>
         ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
                                                                               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    std::srand(123);
               ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 0}, 0.1);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 1}, 0.2);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    masses.setValue({0, 2}, 0.3);
                            ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
                                                                                 ^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
    deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
                                                                                 ^

}

// Register the function as a benchmark
BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10});
          ^

BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10});

// Register the function as a benchmark
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Oscillations")->Args({1 << 10, 1 << 10});
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-tidy diagnostic

benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]

variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const

BENCHMARK(BM_constMatterOscillations)->Name("Const Density Oscillations")->Args({1 << 10, 1 << 10});
          ^

@ewanwm ewanwm merged commit a919de8 into main Aug 7, 2024
1 of 4 checks passed
@ewanwm ewanwm deleted the feature_benchmarking branch August 7, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants