From e944bd390681a049b1861f28c180261b47ddecd3 Mon Sep 17 00:00:00 2001 From: Jake Date: Tue, 17 Oct 2023 14:40:18 -0700 Subject: [PATCH] Fix format line and format --- README.md | 2 +- core/include/jml/model.tpp | 8 ++++---- tests/core/math/test_activation_functions.cpp | 6 ++++-- tests/core/math/test_matrix.cpp | 5 ++--- tests/core/math/test_vector.cpp | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d047e8a..c0a50d3 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ We use [clang-format](https://www.kernel.org/doc/html/latest/process/clang-forma Before you push your code, you can run the following that finds all source code files, and then formats them all in place. ``` -find . -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.c" -o -iname "*.h" | xargs -I {} clang-format -i -style='{IndentWidth: 4, ReferenceAlignment: Left}' {} +find . -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.c" -o -iname "*.h" -o -iname "*.tpp" | xargs -I {} clang-format {} ``` You can also add this to your editors formatting system or some precommit step. diff --git a/core/include/jml/model.tpp b/core/include/jml/model.tpp index d489491..5370864 100644 --- a/core/include/jml/model.tpp +++ b/core/include/jml/model.tpp @@ -4,10 +4,10 @@ namespace jml { -template -void Model::add_testing_data (Iter inb, Iter ine, Iter otb, Iter ote) { - testing_data_inputs .insert(std::end(testing_data_inputs), inb, ine); +template +void Model::add_testing_data(Iter inb, Iter ine, Iter otb, Iter ote) { + testing_data_inputs.insert(std::end(testing_data_inputs), inb, ine); testing_data_outputs.insert(std::end(testing_data_outputs), otb, ote); } -} +} // namespace jml diff --git a/tests/core/math/test_activation_functions.cpp b/tests/core/math/test_activation_functions.cpp index cc4fe34..f091259 100644 --- a/tests/core/math/test_activation_functions.cpp +++ b/tests/core/math/test_activation_functions.cpp @@ -6,7 +6,8 @@ TEST_CASE("FastSigmoid function", "[activation_function]") { jml::FastSigmoid act; - // FIXME: I don't know what mathematically significant values to check so here's some random ones + // FIXME: I don't know what mathematically significant values to check so + // here's some random ones // FIXME: FastSigmoid impl appears to have forgotten the constant offset REQUIRE_THAT(act.f(-1), Catch::Matchers::WithinRel(-0.25, 0.00001)); REQUIRE_THAT(act.f(0), Catch::Matchers::WithinRel(0, 0.00001)); @@ -49,7 +50,8 @@ TEST_CASE("LeakyReLU activation function", "[activation_function]") { REQUIRE(act.df(1) == 1); } -TEST_CASE("LeakyReLU activation function with custom leak", "[activation_function]") { +TEST_CASE("LeakyReLU activation function with custom leak", + "[activation_function]") { jml::LeakyReLU act(0.0001); // TODO: is it necessary to check function values? diff --git a/tests/core/math/test_matrix.cpp b/tests/core/math/test_matrix.cpp index 2276a01..7b3d210 100644 --- a/tests/core/math/test_matrix.cpp +++ b/tests/core/math/test_matrix.cpp @@ -25,7 +25,7 @@ SCENARIO("Matrix entries can be set and get", "[matrix]") { m.set_entry(0, 2, 5); m.set_entry(1, 2, 6); }()); - + THEN("the stored values are correct") { REQUIRE(m.get_entry(0, 0) == 1); REQUIRE(m.get_entry(1, 0) == 2); @@ -44,8 +44,7 @@ SCENARIO("Matrix entries can be set and get", "[matrix]") { } } -SCENARIO("Matrix is correctly multiplied with vector", - "[matrix][vector]") { +SCENARIO("Matrix is correctly multiplied with vector", "[matrix][vector]") { GIVEN("a matrix and vector with some values") { jml::Matrix m(2, 3); jml::Vector V(3); diff --git a/tests/core/math/test_vector.cpp b/tests/core/math/test_vector.cpp index cf5c6b8..2dd3778 100644 --- a/tests/core/math/test_vector.cpp +++ b/tests/core/math/test_vector.cpp @@ -64,7 +64,7 @@ SCENARIO("Vector is added to another vector") { SCENARIO("Activation function is applied to a vector") { GIVEN("a vector and an activation function") { jml::Vector v(3); - jml::ReLU act; // Use ReLU for simplicity + jml::ReLU act; // Use ReLU for simplicity v.set_entry(0, -10); v.set_entry(1, 0);