Conversation
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v16.0.6
Only 4 out of 8 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index dbca5a1..dd007a6 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -147,2 +147,2 @@ static void BM_DPpropOscillations(benchmark::State &state)
- DPpropagator dpProp(3, 295000.0, 2.6, 5);
-
+ DPpropagator dpProp(3, true, 2.6, 5);
+
diff --git a/nuTens/propagator/DP-propagator.cpp b/nuTens/propagator/DP-propagator.cpp
index b978d5e..3a00b7e 100644
--- a/nuTens/propagator/DP-propagator.cpp
+++ b/nuTens/propagator/DP-propagator.cpp
@@ -77,0 +78 @@ Tensor DPpropagator::calculateProbs()
+ {
@@ -80,0 +82 @@ Tensor DPpropagator::calculateProbs()
+ }
diff --git a/nuTens/propagator/DP-propagator.hpp b/nuTens/propagator/DP-propagator.hpp
index 77262b8..da4aac4 100644
--- a/nuTens/propagator/DP-propagator.hpp
+++ b/nuTens/propagator/DP-propagator.hpp
@@ -184 +184 @@ class DPpropagator : public Propagator
- [[nodiscard]] Tensor calculateProbs();
+ [[nodiscard]] Tensor calculateProbs() override;
diff --git a/python/binding.cpp b/python/binding.cpp
index 15344b5..86a0d83 100644
--- a/python/binding.cpp
+++ b/python/binding.cpp
@@ -443,5 +443,4 @@ void initTesting(py::module &m)
- std::vector<std::vector<double>> ret = {
- {probs_returned[0][0], probs_returned[0][1], probs_returned[0][2]},
- {probs_returned[1][0], probs_returned[1][1], probs_returned[1][2]},
- {probs_returned[2][0], probs_returned[2][1], probs_returned[2][2]}
- };
+ std::vector<std::vector<double>> ret =
+ 0 = {{probs_returned[0][0], probs_returned[0][1], probs_returned[0][2]},
+ {probs_returned[1][0], probs_returned[1][1], probs_returned[1][2]},
+ {probs_returned[2][0], probs_returned[2][1], probs_returned[2][2]}};
Have any feedback or feature suggestions? Share it here.
| Tensor B = Tmm + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| for (int i = 0; i < NRiterations; i++) | ||
| lambda3 = |
There was a problem hiding this comment.
clang-tidy suggestion
| lambda3 = | |
| { |
| Tensor See = Araw + dmsq21 * Ue2sq + dmsq31 * Ue3sq; | ||
| Tensor Tee = dmsq21 * dmsq31 * (one - Ue3sq - Ue2sq); | ||
|
|
||
| Tensor C = Amatter * Tee; |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:60:12: warning: [readability-identifier-length]
variable name 'C' is too short, expected at least 3 characters
Tensor C = Amatter * Tee;
^|
|
||
| Tensor C = Amatter * Tee; | ||
| A = A + Amatter; | ||
| Tensor A = Araw + Amatter; |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:61:12: warning: [readability-identifier-length]
variable name 'A' is too short, expected at least 3 characters
Tensor A = Araw + Amatter;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:71:99: warning: 4.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:71:104: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:71:112: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^| // Newton iterations to improve lambda3 arbitrarily, if needed, (B needed here) // | ||
| // ---------------------------------------------------------------------------- // | ||
| Tensor B = Tmm + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1 |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:76:12: warning: [readability-identifier-length]
variable name 'B' is too short, expected at least 3 characters
Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1
^|
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v16.0.6
Only 4 out of 8 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index dbca5a1..dd007a6 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -147,2 +147,2 @@ static void BM_DPpropOscillations(benchmark::State &state)
- DPpropagator dpProp(3, 295000.0, 2.6, 5);
-
+ DPpropagator dpProp(3, true, 2.6, 5);
+
diff --git a/nuTens/propagator/DP-propagator.cpp b/nuTens/propagator/DP-propagator.cpp
index d744a8c..e2ecb90 100644
--- a/nuTens/propagator/DP-propagator.cpp
+++ b/nuTens/propagator/DP-propagator.cpp
@@ -78,0 +79 @@ Tensor DPpropagator::calculateProbs()
+ {
@@ -81,0 +83 @@ Tensor DPpropagator::calculateProbs()
+ }
diff --git a/nuTens/propagator/DP-propagator.hpp b/nuTens/propagator/DP-propagator.hpp
index 77262b8..da4aac4 100644
--- a/nuTens/propagator/DP-propagator.hpp
+++ b/nuTens/propagator/DP-propagator.hpp
@@ -184 +184 @@ class DPpropagator : public Propagator
- [[nodiscard]] Tensor calculateProbs();
+ [[nodiscard]] Tensor calculateProbs() override;
diff --git a/python/binding.cpp b/python/binding.cpp
index 15344b5..86a0d83 100644
--- a/python/binding.cpp
+++ b/python/binding.cpp
@@ -443,5 +443,4 @@ void initTesting(py::module &m)
- std::vector<std::vector<double>> ret = {
- {probs_returned[0][0], probs_returned[0][1], probs_returned[0][2]},
- {probs_returned[1][0], probs_returned[1][1], probs_returned[1][2]},
- {probs_returned[2][0], probs_returned[2][1], probs_returned[2][2]}
- };
+ std::vector<std::vector<double>> ret =
+ 0 = {{probs_returned[0][0], probs_returned[0][1], probs_returned[0][2]},
+ {probs_returned[1][0], probs_returned[1][1], probs_returned[1][2]},
+ {probs_returned[2][0], probs_returned[2][1], probs_returned[2][2]}};
Have any feedback or feature suggestions? Share it here.
| Tensor B = Tmm + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| for (int i = 0; i < NRiterations; i++) | ||
| lambda3 = |
There was a problem hiding this comment.
clang-tidy suggestion
| lambda3 = | |
| { |
| Tensor Tmm = dmsq21 * dmsq31; // using Tmm as a temporary variable | ||
| Tensor Tee = Tmm * (one - Ue3sq - Ue2sq); | ||
| Tensor Araw = -dmsq21 - dmsq31; | ||
| Tensor A = Araw + Amatter; |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:57:12: warning: [readability-identifier-length]
variable name 'A' is too short, expected at least 3 characters
Tensor A = Araw + Amatter;
^| Tensor Smm = A + dmsq21 * Um2sq + dmsq31 * Um3sq; | ||
| Tensor Tmm = dmsq21 * dmsq31 * (one - Um3sq - Um2sq) + Amatter * (See + Smm - A); | ||
|
|
||
| Tensor C = Amatter * Tee; |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:65:12: warning: [readability-identifier-length]
variable name 'C' is too short, expected at least 3 characters
Tensor C = Amatter * Tee;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:72:99: warning: 4.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:72:104: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/DP-propagator.cpp:72:112: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Tensor lambda3 = -dmsq31 + Dmsqee * (xmat - 1 + Tensor::pow(tmp * tmp + sinSqTheta13 * xmat * 4.0, 0.5)) * 0.5;
^| // Newton iterations to improve lambda3 arbitrarily, if needed, (B needed here) // | ||
| // ---------------------------------------------------------------------------- // | ||
| Tensor B = Tmm + Amatter * See; // B is only needed for N_Newton >= 1 | ||
| Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1 |
There was a problem hiding this comment.
clang-tidy diagnostic
nuTens/propagator/DP-propagator.cpp:77:12: warning: [readability-identifier-length]
variable name 'B' is too short, expected at least 3 characters
Tensor B = dmsq21 * dmsq31 + Amatter * See; // B is only needed for N_Newton >= 1
^
No description provided.