From c314c1bc122be88e8a6dd23dda967a15cdf5f9a2 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Wed, 25 Feb 2026 14:46:55 +0100 Subject: [PATCH 1/9] Adapt the test layout to detray --- tests/include/algebra/test/device/matrix_fixture.hpp | 1 + tests/include/algebra/test/device/transform_fixture.hpp | 1 + tests/include/algebra/test/device/vector_fixture.hpp | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/include/algebra/test/device/matrix_fixture.hpp b/tests/include/algebra/test/device/matrix_fixture.hpp index f7ee987b..9fc1636e 100644 --- a/tests/include/algebra/test/device/matrix_fixture.hpp +++ b/tests/include/algebra/test/device/matrix_fixture.hpp @@ -80,6 +80,7 @@ class matrix_fixture : public device_fixture> { // Delete the matrices. m_m1.reset(); m_m2.reset(); + // Tear down the base class. base_fixture::TearDown(); } diff --git a/tests/include/algebra/test/device/transform_fixture.hpp b/tests/include/algebra/test/device/transform_fixture.hpp index 940768b4..370c5b08 100644 --- a/tests/include/algebra/test/device/transform_fixture.hpp +++ b/tests/include/algebra/test/device/transform_fixture.hpp @@ -89,6 +89,7 @@ class transform_fixture : public device_fixture> { m_t3.reset(); m_v1.reset(); m_v2.reset(); + // Tear down the base class. base_fixture::TearDown(); } diff --git a/tests/include/algebra/test/device/vector_fixture.hpp b/tests/include/algebra/test/device/vector_fixture.hpp index 08621965..802e19ab 100644 --- a/tests/include/algebra/test/device/vector_fixture.hpp +++ b/tests/include/algebra/test/device/vector_fixture.hpp @@ -86,6 +86,7 @@ class vector_fixture : public device_fixture> { m_p2.reset(); m_v1.reset(); m_v2.reset(); + // Tear down the base class. base_fixture::TearDown(); } From e6e9907c366bf1037341501be9d41a833cab6220 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Mon, 2 Mar 2026 11:29:48 +0100 Subject: [PATCH 2/9] Build up the new common lib --- benchmarks/CMakeLists.txt | 10 +++++----- common/CMakeLists.txt | 12 ++++++++++++ .../include/algebra}/array_operators.hpp | 2 +- common/include/algebra/assert.hpp | 2 +- .../math => common/include/algebra}/boolean.hpp | 2 +- common/include/algebra/concepts.hpp | 2 +- .../include/algebra/math.hpp | 2 +- .../include/algebra}/matrix.hpp | 4 ++-- .../include/algebra}/matrix_getter.hpp | 6 +++--- common/include/algebra/qualifiers.hpp | 2 +- common/include/algebra/type_traits.hpp | 2 +- .../include/algebra}/vector.hpp | 4 ++-- math/CMakeLists.txt | 1 - math/cmath/CMakeLists.txt | 2 +- math/cmath/include/algebra/math/cmath.hpp | 4 ++-- .../include/algebra/math/impl/cmath_matrix.hpp | 2 +- .../include/algebra/math/impl/cmath_vector.hpp | 2 +- math/common/CMakeLists.txt | 17 ----------------- math/eigen/CMakeLists.txt | 1 - math/eigen/include/algebra/math/eigen.hpp | 4 ++-- math/fastor/CMakeLists.txt | 1 - math/fastor/include/algebra/math/fastor.hpp | 4 ++-- math/generic/CMakeLists.txt | 2 +- .../matrix/decomposition/partial_pivot_lud.hpp | 2 +- math/generic/include/algebra/math/generic.hpp | 4 ++-- .../algebra/math/impl/generic_matrix.hpp | 2 +- .../algebra/math/impl/generic_vector.hpp | 2 +- math/smatrix/include/algebra/math/smatrix.hpp | 4 ++-- math/vc_aos/CMakeLists.txt | 1 - .../include/algebra/math/impl/vc_aos_matrix.hpp | 2 +- .../algebra/math/impl/vc_aos_transform3.hpp | 8 ++++---- .../include/algebra/math/impl/vc_aos_vector.hpp | 4 ++-- math/vc_aos/include/algebra/math/vc_aos.hpp | 4 ++-- math/vc_soa/CMakeLists.txt | 7 +------ .../algebra/math/impl/vc_soa_boolean.hpp | 2 +- .../include/algebra/math/impl/vc_soa_matrix.hpp | 2 +- .../include/algebra/math/impl/vc_soa_vector.hpp | 2 +- storage/CMakeLists.txt | 1 - storage/array/CMakeLists.txt | 2 +- storage/cmath/CMakeLists.txt | 5 +---- .../algebra/storage/impl/cmath_getter.hpp | 2 +- storage/common/CMakeLists.txt | 14 -------------- storage/eigen/CMakeLists.txt | 2 +- .../algebra/storage/impl/eigen_getter.hpp | 2 +- storage/fastor/CMakeLists.txt | 2 +- .../algebra/storage/impl/fastor_getter.hpp | 2 +- storage/smatrix/CMakeLists.txt | 2 +- storage/vc_aos/CMakeLists.txt | 9 +-------- .../algebra/storage/impl/vc_aos_concepts.hpp | 2 +- .../algebra/storage/impl/vc_aos_getter.hpp | 2 +- .../vc_aos/include/algebra/storage/vc_aos.hpp | 4 ++-- storage/vc_soa/CMakeLists.txt | 6 +----- .../algebra/storage/impl/vc_soa_getter.hpp | 2 +- .../vc_soa/include/algebra/storage/vc_soa.hpp | 4 ++-- utils/CMakeLists.txt | 5 +---- .../algebra/utils/approximately_equal.hpp | 2 +- 56 files changed, 80 insertions(+), 126 deletions(-) rename {storage/common/include/algebra/storage => common/include/algebra}/array_operators.hpp (97%) rename {math/common/include/algebra/math => common/include/algebra}/boolean.hpp (86%) rename math/common/include/algebra/math/common.hpp => common/include/algebra/math.hpp (90%) rename {storage/common/include/algebra/storage => common/include/algebra}/matrix.hpp (99%) rename {storage/common/include/algebra/storage => common/include/algebra}/matrix_getter.hpp (98%) rename {storage/common/include/algebra/storage => common/include/algebra}/vector.hpp (99%) delete mode 100644 math/common/CMakeLists.txt delete mode 100644 storage/common/CMakeLists.txt diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 73dfff21..def496b2 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -29,7 +29,7 @@ target_include_directories( ) target_link_libraries( algebra_bench_array - INTERFACE algebra::array algebra::common_storage + INTERFACE algebra::array algebra::common ) algebra_add_benchmark( array_getter "array/array_getter.cpp" @@ -60,7 +60,7 @@ if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) ) target_link_libraries( algebra_bench_eigen - INTERFACE algebra::eigen algebra::common_storage + INTERFACE algebra::eigen algebra::common ) algebra_add_benchmark(eigen_getter "eigen/eigen_getter.cpp" @@ -93,7 +93,7 @@ if(ALGEBRA_PLUGINS_INCLUDE_VC) ) target_link_libraries( algebra_bench_vc_aos - INTERFACE algebra::vc_aos algebra::common_storage + INTERFACE algebra::vc_aos algebra::common ) algebra_add_benchmark(vc_aos_getter "vc_aos/vc_aos_getter.cpp" @@ -124,7 +124,7 @@ if(ALGEBRA_PLUGINS_INCLUDE_VC) ) target_link_libraries( algebra_bench_vc_soa - INTERFACE algebra::vc_soa algebra::common_storage + INTERFACE algebra::vc_soa algebra::common ) algebra_add_benchmark(vc_soa_getter "vc_soa/vc_soa_getter.cpp" @@ -161,7 +161,7 @@ if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) ) target_link_libraries( algebra_bench_fastor - INTERFACE algebra::fastor algebra::common_storage + INTERFACE algebra::fastor algebra::common ) algebra_add_benchmark(fastor_getter "fastor/fastor_getter.cpp" diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 53722aeb..0f7f31e1 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -6,15 +6,27 @@ # Set up the library. algebra_add_library( algebra_common common + "include/algebra/array_operators.hpp" "include/algebra/assert.hpp" + "include/algebra/boolean.hpp" "include/algebra/concepts.hpp" + "include/algebra/math.hpp" + "include/algebra/matrix_getter.hpp" + "include/algebra/matrix.hpp" "include/algebra/qualifiers.hpp" "include/algebra/type_traits.hpp" + "include/algebra/vector.hpp" ) algebra_test_public_headers( algebra_common + "algebra/array_operators.hpp" "algebra/assert.hpp" + "algebra/boolean.hpp" "algebra/concepts.hpp" + "algebra/math.hpp" + "algebra/matrix_getter.hpp" + "algebra/matrix.hpp" "algebra/qualifiers.hpp" "algebra/type_traits.hpp" + "algebra/vector.hpp" ) diff --git a/storage/common/include/algebra/storage/array_operators.hpp b/common/include/algebra/array_operators.hpp similarity index 97% rename from storage/common/include/algebra/storage/array_operators.hpp rename to common/include/algebra/array_operators.hpp index f9f8a59d..51b04c24 100644 --- a/storage/common/include/algebra/storage/array_operators.hpp +++ b/common/include/algebra/array_operators.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/common/include/algebra/assert.hpp b/common/include/algebra/assert.hpp index eddbd30b..8af9b8b9 100644 --- a/common/include/algebra/assert.hpp +++ b/common/include/algebra/assert.hpp @@ -1,7 +1,7 @@ /** * ALGEBRA PLUGIN library, part of the ACTS project (R&D line) * - * (c) 2025 CERN for the benefit of the ACTS project + * (c) 2025-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/common/include/algebra/math/boolean.hpp b/common/include/algebra/boolean.hpp similarity index 86% rename from math/common/include/algebra/math/boolean.hpp rename to common/include/algebra/boolean.hpp index ba8e9792..d2e0eac2 100644 --- a/math/common/include/algebra/math/boolean.hpp +++ b/common/include/algebra/boolean.hpp @@ -1,6 +1,6 @@ /** Detray library, part of the ACTS project (R&D line) * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/common/include/algebra/concepts.hpp b/common/include/algebra/concepts.hpp index d212dec4..24dea2a2 100644 --- a/common/include/algebra/concepts.hpp +++ b/common/include/algebra/concepts.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/common/include/algebra/math/common.hpp b/common/include/algebra/math.hpp similarity index 90% rename from math/common/include/algebra/math/common.hpp rename to common/include/algebra/math.hpp index 8109318c..488c887e 100644 --- a/math/common/include/algebra/math/common.hpp +++ b/common/include/algebra/math.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/storage/common/include/algebra/storage/matrix.hpp b/common/include/algebra/matrix.hpp similarity index 99% rename from storage/common/include/algebra/storage/matrix.hpp rename to common/include/algebra/matrix.hpp index 02046a7f..d01e7f86 100644 --- a/storage/common/include/algebra/storage/matrix.hpp +++ b/common/include/algebra/matrix.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,8 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/storage/vector.hpp" #include "algebra/type_traits.hpp" +#include "algebra/vector.hpp" // System include(s). #include diff --git a/storage/common/include/algebra/storage/matrix_getter.hpp b/common/include/algebra/matrix_getter.hpp similarity index 98% rename from storage/common/include/algebra/storage/matrix_getter.hpp rename to common/include/algebra/matrix_getter.hpp index d53e8e1d..649e98d0 100644 --- a/storage/common/include/algebra/storage/matrix_getter.hpp +++ b/common/include/algebra/matrix_getter.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,8 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/storage/matrix.hpp" -#include "algebra/storage/vector.hpp" +#include "algebra/matrix.hpp" +#include "algebra/vector.hpp" // System include(s). #include diff --git a/common/include/algebra/qualifiers.hpp b/common/include/algebra/qualifiers.hpp index 5ebb8e11..6991519a 100644 --- a/common/include/algebra/qualifiers.hpp +++ b/common/include/algebra/qualifiers.hpp @@ -1,7 +1,7 @@ /** * ALGEBRA PLUGIN library, part of the ACTS project (R&D line) * - * (c) 2021-2022 CERN for the benefit of the ACTS project + * (c) 2021-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/common/include/algebra/type_traits.hpp b/common/include/algebra/type_traits.hpp index 5cd4864e..4d996550 100644 --- a/common/include/algebra/type_traits.hpp +++ b/common/include/algebra/type_traits.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/storage/common/include/algebra/storage/vector.hpp b/common/include/algebra/vector.hpp similarity index 99% rename from storage/common/include/algebra/storage/vector.hpp rename to common/include/algebra/vector.hpp index 7db15bdf..7fa7841b 100644 --- a/storage/common/include/algebra/storage/vector.hpp +++ b/common/include/algebra/vector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -12,9 +12,9 @@ #endif // Project include(s) +#include "algebra/array_operators.hpp" #include "algebra/concepts.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/array_operators.hpp" // System include(s). #include diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt index 3a7e3604..06b8982e 100644 --- a/math/CMakeLists.txt +++ b/math/CMakeLists.txt @@ -5,7 +5,6 @@ # Mozilla Public License Version 2.0 # Set up all enabled libraries. -add_subdirectory(common) add_subdirectory(cmath) add_subdirectory(generic) diff --git a/math/cmath/CMakeLists.txt b/math/cmath/CMakeLists.txt index b1066bda..57fffe9f 100644 --- a/math/cmath/CMakeLists.txt +++ b/math/cmath/CMakeLists.txt @@ -14,7 +14,7 @@ algebra_add_library(algebra_cmath_math cmath_math ) target_link_libraries( algebra_cmath_math - INTERFACE algebra::common algebra::common_math algebra::generic_math + INTERFACE algebra::common algebra::generic_math ) algebra_test_public_headers( algebra_cmath_math "algebra/math/cmath.hpp" diff --git a/math/cmath/include/algebra/math/cmath.hpp b/math/cmath/include/algebra/math/cmath.hpp index 5423775d..3b665eca 100644 --- a/math/cmath/include/algebra/math/cmath.hpp +++ b/math/cmath/include/algebra/math/cmath.hpp @@ -8,8 +8,8 @@ #pragma once // Impl include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/cmath_matrix.hpp" #include "algebra/math/impl/cmath_operators.hpp" #include "algebra/math/impl/cmath_vector.hpp" diff --git a/math/cmath/include/algebra/math/impl/cmath_matrix.hpp b/math/cmath/include/algebra/math/impl/cmath_matrix.hpp index 4029500e..65359742 100644 --- a/math/cmath/include/algebra/math/impl/cmath_matrix.hpp +++ b/math/cmath/include/algebra/math/impl/cmath_matrix.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/math/generic.hpp" #include "algebra/qualifiers.hpp" diff --git a/math/cmath/include/algebra/math/impl/cmath_vector.hpp b/math/cmath/include/algebra/math/impl/cmath_vector.hpp index 9ccbf579..24d56735 100644 --- a/math/cmath/include/algebra/math/impl/cmath_vector.hpp +++ b/math/cmath/include/algebra/math/impl/cmath_vector.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/math/generic.hpp" #include "algebra/qualifiers.hpp" diff --git a/math/common/CMakeLists.txt b/math/common/CMakeLists.txt deleted file mode 100644 index 31d13beb..00000000 --- a/math/common/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2022-2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library(algebra_common_math common_math - # Math - "include/algebra/math/boolean.hpp" - "include/algebra/math/common.hpp" -) -target_link_libraries(algebra_common_math INTERFACE algebra::common) -algebra_test_public_headers( algebra_common_math - "algebra/math/boolean.hpp" - "algebra/math/common.hpp" -) diff --git a/math/eigen/CMakeLists.txt b/math/eigen/CMakeLists.txt index 90fb706c..67945406 100644 --- a/math/eigen/CMakeLists.txt +++ b/math/eigen/CMakeLists.txt @@ -17,7 +17,6 @@ target_link_libraries( Eigen3::Eigen algebra::common algebra::utils - algebra::common_math algebra::eigen_storage ) algebra_test_public_headers( algebra_eigen_math diff --git a/math/eigen/include/algebra/math/eigen.hpp b/math/eigen/include/algebra/math/eigen.hpp index eb9250e3..e7390df7 100644 --- a/math/eigen/include/algebra/math/eigen.hpp +++ b/math/eigen/include/algebra/math/eigen.hpp @@ -8,8 +8,8 @@ #pragma once // Project include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/eigen_matrix.hpp" #include "algebra/math/impl/eigen_transform3.hpp" #include "algebra/math/impl/eigen_vector.hpp" diff --git a/math/fastor/CMakeLists.txt b/math/fastor/CMakeLists.txt index d54f8797..c4260240 100644 --- a/math/fastor/CMakeLists.txt +++ b/math/fastor/CMakeLists.txt @@ -17,7 +17,6 @@ target_link_libraries( Fastor::Fastor algebra::common algebra::utils - algebra::common_math algebra::fastor_storage ) algebra_test_public_headers( algebra_fastor_math diff --git a/math/fastor/include/algebra/math/fastor.hpp b/math/fastor/include/algebra/math/fastor.hpp index 84e6587a..49c73f42 100644 --- a/math/fastor/include/algebra/math/fastor.hpp +++ b/math/fastor/include/algebra/math/fastor.hpp @@ -8,8 +8,8 @@ #pragma once // Project include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/fastor_matrix.hpp" #include "algebra/math/impl/fastor_transform3.hpp" #include "algebra/math/impl/fastor_vector.hpp" diff --git a/math/generic/CMakeLists.txt b/math/generic/CMakeLists.txt index e27afce7..f1232c70 100644 --- a/math/generic/CMakeLists.txt +++ b/math/generic/CMakeLists.txt @@ -23,7 +23,7 @@ algebra_add_library(algebra_generic_math generic_math ) target_link_libraries( algebra_generic_math - INTERFACE algebra::common algebra::utils algebra::common_math + INTERFACE algebra::common algebra::utils ) algebra_test_public_headers( algebra_generic_math "algebra/math/generic.hpp" diff --git a/math/generic/include/algebra/math/algorithms/matrix/decomposition/partial_pivot_lud.hpp b/math/generic/include/algebra/math/algorithms/matrix/decomposition/partial_pivot_lud.hpp index b67ddcd7..b0e7de61 100644 --- a/math/generic/include/algebra/math/algorithms/matrix/decomposition/partial_pivot_lud.hpp +++ b/math/generic/include/algebra/math/algorithms/matrix/decomposition/partial_pivot_lud.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" // System include(s). diff --git a/math/generic/include/algebra/math/generic.hpp b/math/generic/include/algebra/math/generic.hpp index bab33912..56d4da4d 100644 --- a/math/generic/include/algebra/math/generic.hpp +++ b/math/generic/include/algebra/math/generic.hpp @@ -8,8 +8,8 @@ #pragma once // Impl include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/generic_matrix.hpp" #include "algebra/math/impl/generic_transform3.hpp" #include "algebra/math/impl/generic_vector.hpp" diff --git a/math/generic/include/algebra/math/impl/generic_matrix.hpp b/math/generic/include/algebra/math/impl/generic_matrix.hpp index 8ebd6516..528e31cc 100644 --- a/math/generic/include/algebra/math/impl/generic_matrix.hpp +++ b/math/generic/include/algebra/math/impl/generic_matrix.hpp @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/math.hpp" #include "algebra/math/algorithms/utils/algorithm_finder.hpp" -#include "algebra/math/common.hpp" #include "algebra/qualifiers.hpp" namespace algebra::generic::math { diff --git a/math/generic/include/algebra/math/impl/generic_vector.hpp b/math/generic/include/algebra/math/impl/generic_vector.hpp index f1f49ff0..01099c7e 100644 --- a/math/generic/include/algebra/math/impl/generic_vector.hpp +++ b/math/generic/include/algebra/math/impl/generic_vector.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" #include "algebra/type_traits.hpp" diff --git a/math/smatrix/include/algebra/math/smatrix.hpp b/math/smatrix/include/algebra/math/smatrix.hpp index 5f4d86fb..48d53be9 100644 --- a/math/smatrix/include/algebra/math/smatrix.hpp +++ b/math/smatrix/include/algebra/math/smatrix.hpp @@ -8,8 +8,8 @@ #pragma once // Project include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/smatrix_matrix.hpp" #include "algebra/math/impl/smatrix_transform3.hpp" #include "algebra/math/impl/smatrix_vector.hpp" diff --git a/math/vc_aos/CMakeLists.txt b/math/vc_aos/CMakeLists.txt index 3d9b6f77..23da77d7 100644 --- a/math/vc_aos/CMakeLists.txt +++ b/math/vc_aos/CMakeLists.txt @@ -17,7 +17,6 @@ target_link_libraries( Vc::Vc algebra::common algebra::utils - algebra::common_math algebra::generic_math algebra::vc_aos_storage ) diff --git a/math/vc_aos/include/algebra/math/impl/vc_aos_matrix.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_matrix.hpp index 381f77c3..667a78cd 100644 --- a/math/vc_aos/include/algebra/math/impl/vc_aos_matrix.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_matrix.hpp @@ -10,8 +10,8 @@ // Project include(s). #include "algebra/concepts.hpp" #include "algebra/math/generic.hpp" +#include "algebra/matrix.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/matrix.hpp" namespace algebra::vc_aos::math { diff --git a/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp index 77b00db1..37d40126 100644 --- a/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp @@ -9,13 +9,13 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" +#include "algebra/matrix.hpp" +#include "algebra/matrix_getter.hpp" #include "algebra/qualifiers.hpp" #include "algebra/storage/impl/vc_aos_approximately_equal.hpp" -#include "algebra/storage/matrix.hpp" -#include "algebra/storage/matrix_getter.hpp" -#include "algebra/storage/vector.hpp" #include "algebra/utils/approximately_equal.hpp" +#include "algebra/vector.hpp" // Vc include(s). #ifdef _MSC_VER diff --git a/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp index 0b53acb9..69bdc1d4 100644 --- a/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp @@ -9,10 +9,10 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" #include "algebra/storage/vc_aos.hpp" -#include "algebra/storage/vector.hpp" +#include "algebra/vector.hpp" // Vc include(s). #ifdef _MSC_VER diff --git a/math/vc_aos/include/algebra/math/vc_aos.hpp b/math/vc_aos/include/algebra/math/vc_aos.hpp index 38fa17d5..7208d397 100644 --- a/math/vc_aos/include/algebra/math/vc_aos.hpp +++ b/math/vc_aos/include/algebra/math/vc_aos.hpp @@ -8,8 +8,8 @@ #pragma once // Project include(s). -#include "algebra/math/boolean.hpp" -#include "algebra/math/common.hpp" +#include "algebra/boolean.hpp" +#include "algebra/math.hpp" #include "algebra/math/impl/vc_aos_matrix.hpp" #include "algebra/math/impl/vc_aos_transform3.hpp" #include "algebra/math/impl/vc_aos_vector.hpp" diff --git a/math/vc_soa/CMakeLists.txt b/math/vc_soa/CMakeLists.txt index bf35a24d..a448e474 100644 --- a/math/vc_soa/CMakeLists.txt +++ b/math/vc_soa/CMakeLists.txt @@ -14,12 +14,7 @@ algebra_add_library( algebra_vc_soa_math vc_soa_math ) target_link_libraries( algebra_vc_soa_math - INTERFACE - algebra::common - algebra::common_math - algebra::common_storage - algebra::vc_soa_storage - Vc::Vc + INTERFACE algebra::common algebra::vc_soa_storage Vc::Vc ) algebra_test_public_headers( algebra_vc_soa_math "algebra/math/vc_soa.hpp" diff --git a/math/vc_soa/include/algebra/math/impl/vc_soa_boolean.hpp b/math/vc_soa/include/algebra/math/impl/vc_soa_boolean.hpp index 1e108b94..0de16585 100644 --- a/math/vc_soa/include/algebra/math/impl/vc_soa_boolean.hpp +++ b/math/vc_soa/include/algebra/math/impl/vc_soa_boolean.hpp @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/math/boolean.hpp" +#include "algebra/boolean.hpp" // Vc include(s). #ifdef _MSC_VER diff --git a/math/vc_soa/include/algebra/math/impl/vc_soa_matrix.hpp b/math/vc_soa/include/algebra/math/impl/vc_soa_matrix.hpp index 278f3b03..ae69770b 100644 --- a/math/vc_soa/include/algebra/math/impl/vc_soa_matrix.hpp +++ b/math/vc_soa/include/algebra/math/impl/vc_soa_matrix.hpp @@ -10,8 +10,8 @@ // Project include(s). #include "algebra/concepts.hpp" #include "algebra/math/impl/vc_soa_vector.hpp" +#include "algebra/matrix.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/matrix.hpp" namespace algebra::vc_soa::math { diff --git a/math/vc_soa/include/algebra/math/impl/vc_soa_vector.hpp b/math/vc_soa/include/algebra/math/impl/vc_soa_vector.hpp index c032f587..0d997ae8 100644 --- a/math/vc_soa/include/algebra/math/impl/vc_soa_vector.hpp +++ b/math/vc_soa/include/algebra/math/impl/vc_soa_vector.hpp @@ -11,7 +11,7 @@ #include "algebra/concepts.hpp" #include "algebra/math/impl/vc_soa_math.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/vector.hpp" +#include "algebra/vector.hpp" // Vc include(s). #ifdef _MSC_VER diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index f11121c8..8f1b315a 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -7,7 +7,6 @@ # Set up all enabled libraries. add_subdirectory(array) add_subdirectory(cmath) -add_subdirectory(common) if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) add_subdirectory(eigen) diff --git a/storage/array/CMakeLists.txt b/storage/array/CMakeLists.txt index 4975d876..84a73c2a 100644 --- a/storage/array/CMakeLists.txt +++ b/storage/array/CMakeLists.txt @@ -10,7 +10,7 @@ algebra_add_library( algebra_array_storage array_storage ) target_link_libraries( algebra_array_storage - INTERFACE algebra::common algebra::common_math algebra::cmath_storage + INTERFACE algebra::common algebra::cmath_storage ) algebra_test_public_headers( algebra_array_storage "algebra/storage/array.hpp" diff --git a/storage/cmath/CMakeLists.txt b/storage/cmath/CMakeLists.txt index 0f87e895..acbeed90 100644 --- a/storage/cmath/CMakeLists.txt +++ b/storage/cmath/CMakeLists.txt @@ -8,10 +8,7 @@ algebra_add_library( algebra_cmath_storage cmath_storage "include/algebra/storage/impl/cmath_getter.hpp" ) -target_link_libraries( - algebra_cmath_storage - INTERFACE algebra::common algebra::common_math -) +target_link_libraries(algebra_cmath_storage INTERFACE algebra::common) algebra_test_public_headers( algebra_cmath_storage "algebra/storage/impl/cmath_getter.hpp" ) diff --git a/storage/cmath/include/algebra/storage/impl/cmath_getter.hpp b/storage/cmath/include/algebra/storage/impl/cmath_getter.hpp index 1dc504e7..3121ea3c 100644 --- a/storage/cmath/include/algebra/storage/impl/cmath_getter.hpp +++ b/storage/cmath/include/algebra/storage/impl/cmath_getter.hpp @@ -10,7 +10,7 @@ // Project include(s). #include "algebra/assert.hpp" #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" // System include(s). diff --git a/storage/common/CMakeLists.txt b/storage/common/CMakeLists.txt deleted file mode 100644 index cf3dd934..00000000 --- a/storage/common/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2023-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library(algebra_common_storage common_storage - "include/algebra/storage/array_operators.hpp" - "include/algebra/storage/matrix_getter.hpp" - "include/algebra/storage/matrix.hpp" - "include/algebra/storage/vector.hpp" -) -target_link_libraries(algebra_common_storage INTERFACE algebra::common) diff --git a/storage/eigen/CMakeLists.txt b/storage/eigen/CMakeLists.txt index cb818a93..d4a4340f 100644 --- a/storage/eigen/CMakeLists.txt +++ b/storage/eigen/CMakeLists.txt @@ -12,7 +12,7 @@ algebra_add_library( algebra_eigen_storage eigen_storage ) target_link_libraries( algebra_eigen_storage - INTERFACE algebra::common Eigen3::Eigen algebra::common_math + INTERFACE algebra::common Eigen3::Eigen ) algebra_test_public_headers( algebra_eigen_storage "algebra/storage/eigen.hpp" diff --git a/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp b/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp index 7a5b841c..a9530d13 100644 --- a/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp +++ b/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" // Eigen include(s). diff --git a/storage/fastor/CMakeLists.txt b/storage/fastor/CMakeLists.txt index f81d30b5..8f4abe3b 100644 --- a/storage/fastor/CMakeLists.txt +++ b/storage/fastor/CMakeLists.txt @@ -12,7 +12,7 @@ algebra_add_library( algebra_fastor_storage fastor_storage ) target_link_libraries( algebra_fastor_storage - INTERFACE Fastor::Fastor algebra::common algebra::common_math + INTERFACE Fastor::Fastor algebra::common ) algebra_test_public_headers( algebra_fastor_storage "algebra/storage/fastor.hpp" diff --git a/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp b/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp index 250273d3..2e920281 100644 --- a/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp +++ b/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" #include "algebra/storage/impl/fastor_matrix.hpp" diff --git a/storage/smatrix/CMakeLists.txt b/storage/smatrix/CMakeLists.txt index e7a12d81..3287f9f6 100644 --- a/storage/smatrix/CMakeLists.txt +++ b/storage/smatrix/CMakeLists.txt @@ -14,7 +14,7 @@ algebra_add_library( algebra_smatrix_storage smatrix_storage ) target_link_libraries( algebra_smatrix_storage - INTERFACE algebra::common ROOT::Smatrix algebra::common_math + INTERFACE algebra::common ROOT::Smatrix ) algebra_test_public_headers( algebra_smatrix_storage "algebra/storage/smatrix.hpp" diff --git a/storage/vc_aos/CMakeLists.txt b/storage/vc_aos/CMakeLists.txt index 66a7b8c7..ae447340 100644 --- a/storage/vc_aos/CMakeLists.txt +++ b/storage/vc_aos/CMakeLists.txt @@ -11,14 +11,7 @@ algebra_add_library( algebra_vc_aos_storage vc_aos_storage "include/algebra/storage/impl/vc_aos_concepts.hpp" "include/algebra/storage/impl/vc_aos_getter.hpp" ) -target_link_libraries( - algebra_vc_aos_storage - INTERFACE - algebra::common - algebra::common_storage - Vc::Vc - algebra::common_math -) +target_link_libraries(algebra_vc_aos_storage INTERFACE algebra::common Vc::Vc) algebra_test_public_headers( algebra_vc_aos_storage "algebra/storage/vc_aos.hpp" ) diff --git a/storage/vc_aos/include/algebra/storage/impl/vc_aos_concepts.hpp b/storage/vc_aos/include/algebra/storage/impl/vc_aos_concepts.hpp index 7ae9490d..796563ed 100644 --- a/storage/vc_aos/include/algebra/storage/impl/vc_aos_concepts.hpp +++ b/storage/vc_aos/include/algebra/storage/impl/vc_aos_concepts.hpp @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/storage/vector.hpp" +#include "algebra/vector.hpp" // Vc include(s). #ifdef _MSC_VER diff --git a/storage/vc_aos/include/algebra/storage/impl/vc_aos_getter.hpp b/storage/vc_aos/include/algebra/storage/impl/vc_aos_getter.hpp index 3bc7bbb2..caedd9b5 100644 --- a/storage/vc_aos/include/algebra/storage/impl/vc_aos_getter.hpp +++ b/storage/vc_aos/include/algebra/storage/impl/vc_aos_getter.hpp @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/matrix_getter.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/matrix_getter.hpp" namespace algebra::vc_aos::storage { diff --git a/storage/vc_aos/include/algebra/storage/vc_aos.hpp b/storage/vc_aos/include/algebra/storage/vc_aos.hpp index c45e853d..a2af4124 100644 --- a/storage/vc_aos/include/algebra/storage/vc_aos.hpp +++ b/storage/vc_aos/include/algebra/storage/vc_aos.hpp @@ -9,12 +9,12 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/matrix.hpp" #include "algebra/storage/impl/vc_aos_approximately_equal.hpp" #include "algebra/storage/impl/vc_aos_concepts.hpp" #include "algebra/storage/impl/vc_aos_getter.hpp" -#include "algebra/storage/matrix.hpp" -#include "algebra/storage/vector.hpp" #include "algebra/type_traits.hpp" +#include "algebra/vector.hpp" // System include(s). #include diff --git a/storage/vc_soa/CMakeLists.txt b/storage/vc_soa/CMakeLists.txt index 1836158d..4f42813b 100644 --- a/storage/vc_soa/CMakeLists.txt +++ b/storage/vc_soa/CMakeLists.txt @@ -13,11 +13,7 @@ algebra_add_library( algebra_vc_soa_storage vc_soa_storage ) target_link_libraries( algebra_vc_soa_storage - INTERFACE - algebra::common - algebra::common_storage - Vc::Vc - algebra::vc_aos_storage + INTERFACE algebra::common Vc::Vc algebra::vc_aos_storage ) algebra_test_public_headers( algebra_vc_soa_storage "algebra/storage/vc_soa.hpp" diff --git a/storage/vc_soa/include/algebra/storage/impl/vc_soa_getter.hpp b/storage/vc_soa/include/algebra/storage/impl/vc_soa_getter.hpp index 98cf14ee..712fc400 100644 --- a/storage/vc_soa/include/algebra/storage/impl/vc_soa_getter.hpp +++ b/storage/vc_soa/include/algebra/storage/impl/vc_soa_getter.hpp @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/matrix_getter.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/matrix_getter.hpp" namespace algebra::vc_soa::storage { diff --git a/storage/vc_soa/include/algebra/storage/vc_soa.hpp b/storage/vc_soa/include/algebra/storage/vc_soa.hpp index 6053bd26..7739624f 100644 --- a/storage/vc_soa/include/algebra/storage/vc_soa.hpp +++ b/storage/vc_soa/include/algebra/storage/vc_soa.hpp @@ -9,12 +9,12 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/matrix.hpp" #include "algebra/storage/impl/vc_aos_approximately_equal.hpp" #include "algebra/storage/impl/vc_soa_casts.hpp" #include "algebra/storage/impl/vc_soa_getter.hpp" -#include "algebra/storage/matrix.hpp" -#include "algebra/storage/vector.hpp" #include "algebra/type_traits.hpp" +#include "algebra/vector.hpp" // System include(s). #include diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 4e042e22..bdaba136 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -11,10 +11,7 @@ algebra_add_library( algebra_utils utils "include/algebra/utils/print.hpp" ) -target_link_libraries( - algebra_utils - INTERFACE algebra::common algebra_common_math -) +target_link_libraries(algebra_utils INTERFACE algebra::common) algebra_test_public_headers( algebra_utils "algebra/utils/approximately_equal.hpp" diff --git a/utils/include/algebra/utils/approximately_equal.hpp b/utils/include/algebra/utils/approximately_equal.hpp index fa64147e..31099146 100644 --- a/utils/include/algebra/utils/approximately_equal.hpp +++ b/utils/include/algebra/utils/approximately_equal.hpp @@ -9,7 +9,7 @@ // Project include(s) #include "algebra/concepts.hpp" -#include "algebra/math/common.hpp" +#include "algebra/math.hpp" #include "algebra/qualifiers.hpp" // System include(s) From c556aaa2dcd19e118ac4efa95d8ea69cfc49f645 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Mon, 2 Mar 2026 15:06:07 +0100 Subject: [PATCH 3/9] Refactor Eigen3 plugin --- frontend/eigen/CMakeLists.txt | 8 ++----- frontend/eigen/include/algebra/eigen.hpp | 11 ++++++--- .../include/algebra}/impl/eigen_array.hpp | 2 +- .../include/algebra}/impl/eigen_getter.hpp | 2 +- .../include/algebra}/impl/eigen_matrix.hpp | 5 ++-- .../algebra}/impl/eigen_transform3.hpp | 4 ++-- .../include/algebra/impl/eigen_types.hpp | 6 ++--- .../include/algebra}/impl/eigen_vector.hpp | 2 +- math/CMakeLists.txt | 4 ---- math/eigen/CMakeLists.txt | 24 ------------------- math/eigen/include/algebra/math/eigen.hpp | 16 ------------- storage/CMakeLists.txt | 4 ---- storage/eigen/CMakeLists.txt | 19 --------------- 13 files changed, 21 insertions(+), 86 deletions(-) rename {storage/eigen/include/algebra/storage => frontend/eigen/include/algebra}/impl/eigen_array.hpp (93%) rename {storage/eigen/include/algebra/storage => frontend/eigen/include/algebra}/impl/eigen_getter.hpp (99%) rename {math/eigen/include/algebra/math => frontend/eigen/include/algebra}/impl/eigen_matrix.hpp (94%) rename {math/eigen/include/algebra/math => frontend/eigen/include/algebra}/impl/eigen_transform3.hpp (98%) rename storage/eigen/include/algebra/storage/eigen.hpp => frontend/eigen/include/algebra/impl/eigen_types.hpp (97%) rename {math/eigen/include/algebra/math => frontend/eigen/include/algebra}/impl/eigen_vector.hpp (98%) delete mode 100644 math/eigen/CMakeLists.txt delete mode 100644 math/eigen/include/algebra/math/eigen.hpp delete mode 100644 storage/eigen/CMakeLists.txt diff --git a/frontend/eigen/CMakeLists.txt b/frontend/eigen/CMakeLists.txt index 3af35d48..c7686d3e 100644 --- a/frontend/eigen/CMakeLists.txt +++ b/frontend/eigen/CMakeLists.txt @@ -9,16 +9,12 @@ message(STATUS "Building the Eigen3 algebra plugin") # Set up the library. algebra_add_library( algebra_eigen eigen "include/algebra/eigen.hpp" + "include/algebra/impl/*.hpp" ) target_link_libraries( algebra_eigen - INTERFACE - algebra::common - algebra::eigen_storage - algebra::eigen_math - algebra::generic_math - Eigen3::Eigen + INTERFACE algebra::common algebra::generic_math Eigen3::Eigen ) algebra_test_public_headers( algebra_eigen diff --git a/frontend/eigen/include/algebra/eigen.hpp b/frontend/eigen/include/algebra/eigen.hpp index 9a753492..66257b7a 100644 --- a/frontend/eigen/include/algebra/eigen.hpp +++ b/frontend/eigen/include/algebra/eigen.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,9 +8,14 @@ #pragma once // Project include(s). -#include "algebra/math/eigen.hpp" +#include "algebra/boolean.hpp" +#include "algebra/impl/eigen_getter.hpp" +#include "algebra/impl/eigen_matrix.hpp" +#include "algebra/impl/eigen_transform3.hpp" +#include "algebra/impl/eigen_types.hpp" +#include "algebra/impl/eigen_vector.hpp" +#include "algebra/math.hpp" #include "algebra/math/generic.hpp" -#include "algebra/storage/eigen.hpp" // Eigen include(s). #ifdef _MSC_VER diff --git a/storage/eigen/include/algebra/storage/impl/eigen_array.hpp b/frontend/eigen/include/algebra/impl/eigen_array.hpp similarity index 93% rename from storage/eigen/include/algebra/storage/impl/eigen_array.hpp rename to frontend/eigen/include/algebra/impl/eigen_array.hpp index d86f100d..4db308a9 100644 --- a/storage/eigen/include/algebra/storage/impl/eigen_array.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_array.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp b/frontend/eigen/include/algebra/impl/eigen_getter.hpp similarity index 99% rename from storage/eigen/include/algebra/storage/impl/eigen_getter.hpp rename to frontend/eigen/include/algebra/impl/eigen_getter.hpp index a9530d13..4958d11f 100644 --- a/storage/eigen/include/algebra/storage/impl/eigen_getter.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_getter.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/eigen/include/algebra/math/impl/eigen_matrix.hpp b/frontend/eigen/include/algebra/impl/eigen_matrix.hpp similarity index 94% rename from math/eigen/include/algebra/math/impl/eigen_matrix.hpp rename to frontend/eigen/include/algebra/impl/eigen_matrix.hpp index bd22e2f0..c8347d95 100644 --- a/math/eigen/include/algebra/math/impl/eigen_matrix.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_matrix.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,9 @@ #pragma once // Project include(s). +#include "algebra/concepts.hpp" +#include "algebra/impl/eigen_types.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/eigen.hpp" // Eigen include(s). #ifdef _MSC_VER diff --git a/math/eigen/include/algebra/math/impl/eigen_transform3.hpp b/frontend/eigen/include/algebra/impl/eigen_transform3.hpp similarity index 98% rename from math/eigen/include/algebra/math/impl/eigen_transform3.hpp rename to frontend/eigen/include/algebra/impl/eigen_transform3.hpp index 64f5f00c..79858fb1 100644 --- a/math/eigen/include/algebra/math/impl/eigen_transform3.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_transform3.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,8 @@ #pragma once // Project include(s). +#include "algebra/impl/eigen_array.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/impl/eigen_array.hpp" #include "algebra/utils/approximately_equal.hpp" // Eigen include(s). diff --git a/storage/eigen/include/algebra/storage/eigen.hpp b/frontend/eigen/include/algebra/impl/eigen_types.hpp similarity index 97% rename from storage/eigen/include/algebra/storage/eigen.hpp rename to frontend/eigen/include/algebra/impl/eigen_types.hpp index 707d95e2..1de2da1f 100644 --- a/storage/eigen/include/algebra/storage/eigen.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_types.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/storage/impl/eigen_array.hpp" -#include "algebra/storage/impl/eigen_getter.hpp" +#include "algebra/impl/eigen_array.hpp" +#include "algebra/impl/eigen_getter.hpp" #include "algebra/type_traits.hpp" // System include(s). diff --git a/math/eigen/include/algebra/math/impl/eigen_vector.hpp b/frontend/eigen/include/algebra/impl/eigen_vector.hpp similarity index 98% rename from math/eigen/include/algebra/math/impl/eigen_vector.hpp rename to frontend/eigen/include/algebra/impl/eigen_vector.hpp index 928fda0c..297f94ec 100644 --- a/math/eigen/include/algebra/math/impl/eigen_vector.hpp +++ b/frontend/eigen/include/algebra/impl/eigen_vector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt index 06b8982e..6bdf8b71 100644 --- a/math/CMakeLists.txt +++ b/math/CMakeLists.txt @@ -8,10 +8,6 @@ add_subdirectory(cmath) add_subdirectory(generic) -if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) - add_subdirectory(eigen) -endif() - if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) add_subdirectory(fastor) endif() diff --git a/math/eigen/CMakeLists.txt b/math/eigen/CMakeLists.txt deleted file mode 100644 index 67945406..00000000 --- a/math/eigen/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2021-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library(algebra_eigen_math eigen_math - "include/algebra/math/eigen.hpp" - "include/algebra/math/impl/eigen_matrix.hpp" - "include/algebra/math/impl/eigen_transform3.hpp" - "include/algebra/math/impl/eigen_vector.hpp" -) -target_link_libraries( - algebra_eigen_math - INTERFACE - Eigen3::Eigen - algebra::common - algebra::utils - algebra::eigen_storage -) -algebra_test_public_headers( algebra_eigen_math - "algebra/math/eigen.hpp" -) diff --git a/math/eigen/include/algebra/math/eigen.hpp b/math/eigen/include/algebra/math/eigen.hpp deleted file mode 100644 index e7390df7..00000000 --- a/math/eigen/include/algebra/math/eigen.hpp +++ /dev/null @@ -1,16 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2020-2022 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s). -#include "algebra/boolean.hpp" -#include "algebra/math.hpp" -#include "algebra/math/impl/eigen_matrix.hpp" -#include "algebra/math/impl/eigen_transform3.hpp" -#include "algebra/math/impl/eigen_vector.hpp" -#include "algebra/storage/impl/eigen_getter.hpp" diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index 8f1b315a..800e5bc9 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -8,10 +8,6 @@ add_subdirectory(array) add_subdirectory(cmath) -if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) - add_subdirectory(eigen) -endif() - if(ALGEBRA_PLUGINS_INCLUDE_SMATRIX) add_subdirectory(smatrix) endif() diff --git a/storage/eigen/CMakeLists.txt b/storage/eigen/CMakeLists.txt deleted file mode 100644 index d4a4340f..00000000 --- a/storage/eigen/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2021-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library( algebra_eigen_storage eigen_storage - "include/algebra/storage/eigen.hpp" - "include/algebra/storage/impl/eigen_array.hpp" - "include/algebra/storage/impl/eigen_getter.hpp" -) -target_link_libraries( - algebra_eigen_storage - INTERFACE algebra::common Eigen3::Eigen -) -algebra_test_public_headers( algebra_eigen_storage - "algebra/storage/eigen.hpp" -) From fc39470781a2f4733d351a14d097259e7496d4b6 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Mon, 2 Mar 2026 15:16:49 +0100 Subject: [PATCH 4/9] Refactor Fastor plugin --- frontend/fastor/CMakeLists.txt | 7 ++---- frontend/fastor/include/algebra/fastor.hpp | 9 ++++--- .../include/algebra}/impl/fastor_getter.hpp | 4 ++-- .../include/algebra}/impl/fastor_matrix.hpp | 4 ++-- .../algebra/impl/fastor_matrix_wrapper.hpp | 2 +- .../algebra}/impl/fastor_transform3.hpp | 4 ++-- .../include/algebra/impl/fastor_types.hpp | 6 ++--- .../include/algebra}/impl/fastor_vector.hpp | 2 +- math/CMakeLists.txt | 4 ---- math/fastor/CMakeLists.txt | 24 ------------------- math/fastor/include/algebra/math/fastor.hpp | 15 ------------ storage/CMakeLists.txt | 4 ---- storage/fastor/CMakeLists.txt | 19 --------------- 13 files changed, 19 insertions(+), 85 deletions(-) rename {storage/fastor/include/algebra/storage => frontend/fastor/include/algebra}/impl/fastor_getter.hpp (98%) rename {math/fastor/include/algebra/math => frontend/fastor/include/algebra}/impl/fastor_matrix.hpp (96%) rename storage/fastor/include/algebra/storage/impl/fastor_matrix.hpp => frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp (98%) rename {math/fastor/include/algebra/math => frontend/fastor/include/algebra}/impl/fastor_transform3.hpp (98%) rename storage/fastor/include/algebra/storage/fastor.hpp => frontend/fastor/include/algebra/impl/fastor_types.hpp (91%) rename {math/fastor/include/algebra/math => frontend/fastor/include/algebra}/impl/fastor_vector.hpp (99%) delete mode 100644 math/fastor/CMakeLists.txt delete mode 100644 math/fastor/include/algebra/math/fastor.hpp delete mode 100644 storage/fastor/CMakeLists.txt diff --git a/frontend/fastor/CMakeLists.txt b/frontend/fastor/CMakeLists.txt index a7226796..b06725ca 100644 --- a/frontend/fastor/CMakeLists.txt +++ b/frontend/fastor/CMakeLists.txt @@ -9,15 +9,12 @@ message(STATUS "Building the Fastor algebra plugin") # Set up the library. algebra_add_library( algebra_fastor fastor "include/algebra/fastor.hpp" + "include/algebra/impl/*.hpp" ) target_link_libraries( algebra_fastor - INTERFACE - algebra::common - algebra::fastor_storage - algebra::fastor_math - algebra::generic_math + INTERFACE Fastor::Fastor algebra::common algebra::generic_math ) algebra_test_public_headers( algebra_fastor diff --git a/frontend/fastor/include/algebra/fastor.hpp b/frontend/fastor/include/algebra/fastor.hpp index e2ec281e..6ef0d94b 100644 --- a/frontend/fastor/include/algebra/fastor.hpp +++ b/frontend/fastor/include/algebra/fastor.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,9 +8,12 @@ #pragma once // Project include(s). -#include "algebra/math/fastor.hpp" +#include "algebra/impl/fastor_getter.hpp" +#include "algebra/impl/fastor_matrix.hpp" +#include "algebra/impl/fastor_transform3.hpp" +#include "algebra/impl/fastor_types.hpp" +#include "algebra/impl/fastor_vector.hpp" #include "algebra/math/generic.hpp" -#include "algebra/storage/fastor.hpp" // Fastor include(s). #ifdef _MSC_VER diff --git a/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp b/frontend/fastor/include/algebra/impl/fastor_getter.hpp similarity index 98% rename from storage/fastor/include/algebra/storage/impl/fastor_getter.hpp rename to frontend/fastor/include/algebra/impl/fastor_getter.hpp index 2e920281..a6d76bab 100644 --- a/storage/fastor/include/algebra/storage/impl/fastor_getter.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_getter.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,9 +9,9 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/impl/fastor_matrix_wrapper.hpp" #include "algebra/math.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/impl/fastor_matrix.hpp" // Fastor include(s). #ifdef _MSC_VER diff --git a/math/fastor/include/algebra/math/impl/fastor_matrix.hpp b/frontend/fastor/include/algebra/impl/fastor_matrix.hpp similarity index 96% rename from math/fastor/include/algebra/math/impl/fastor_matrix.hpp rename to frontend/fastor/include/algebra/impl/fastor_matrix.hpp index 0e165192..ada27726 100644 --- a/math/fastor/include/algebra/math/impl/fastor_matrix.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_matrix.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,8 @@ #pragma once // Project include(s). +#include "algebra/impl/fastor_types.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/fastor.hpp" // Fastor include(s). #ifdef _MSC_VER diff --git a/storage/fastor/include/algebra/storage/impl/fastor_matrix.hpp b/frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp similarity index 98% rename from storage/fastor/include/algebra/storage/impl/fastor_matrix.hpp rename to frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp index 4b84409b..783d9afc 100644 --- a/storage/fastor/include/algebra/storage/impl/fastor_matrix.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/fastor/include/algebra/math/impl/fastor_transform3.hpp b/frontend/fastor/include/algebra/impl/fastor_transform3.hpp similarity index 98% rename from math/fastor/include/algebra/math/impl/fastor_transform3.hpp rename to frontend/fastor/include/algebra/impl/fastor_transform3.hpp index e6c321c0..28c9b407 100644 --- a/math/fastor/include/algebra/math/impl/fastor_transform3.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_transform3.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/math/impl/fastor_matrix.hpp" +#include "algebra/impl/fastor_matrix.hpp" #include "algebra/qualifiers.hpp" #include "algebra/utils/approximately_equal.hpp" diff --git a/storage/fastor/include/algebra/storage/fastor.hpp b/frontend/fastor/include/algebra/impl/fastor_types.hpp similarity index 91% rename from storage/fastor/include/algebra/storage/fastor.hpp rename to frontend/fastor/include/algebra/impl/fastor_types.hpp index 7cce3b8d..674e6f7e 100644 --- a/storage/fastor/include/algebra/storage/fastor.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_types.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/storage/impl/fastor_getter.hpp" -#include "algebra/storage/impl/fastor_matrix.hpp" +#include "algebra/impl/fastor_getter.hpp" +#include "algebra/impl/fastor_matrix_wrapper.hpp" #include "algebra/type_traits.hpp" // System include(s). diff --git a/math/fastor/include/algebra/math/impl/fastor_vector.hpp b/frontend/fastor/include/algebra/impl/fastor_vector.hpp similarity index 99% rename from math/fastor/include/algebra/math/impl/fastor_vector.hpp rename to frontend/fastor/include/algebra/impl/fastor_vector.hpp index 7cc68cec..a7a7a8bc 100644 --- a/math/fastor/include/algebra/math/impl/fastor_vector.hpp +++ b/frontend/fastor/include/algebra/impl/fastor_vector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt index 6bdf8b71..ee966888 100644 --- a/math/CMakeLists.txt +++ b/math/CMakeLists.txt @@ -8,10 +8,6 @@ add_subdirectory(cmath) add_subdirectory(generic) -if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) - add_subdirectory(fastor) -endif() - if(ALGEBRA_PLUGINS_INCLUDE_SMATRIX) add_subdirectory(smatrix) endif() diff --git a/math/fastor/CMakeLists.txt b/math/fastor/CMakeLists.txt deleted file mode 100644 index c4260240..00000000 --- a/math/fastor/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2022-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library(algebra_fastor_math fastor_math - "include/algebra/math/fastor.hpp" - "include/algebra/math/impl/fastor_matrix.hpp" - "include/algebra/math/impl/fastor_transform3.hpp" - "include/algebra/math/impl/fastor_vector.hpp" -) -target_link_libraries( - algebra_fastor_math - INTERFACE - Fastor::Fastor - algebra::common - algebra::utils - algebra::fastor_storage -) -algebra_test_public_headers( algebra_fastor_math - "algebra/math/fastor.hpp" -) diff --git a/math/fastor/include/algebra/math/fastor.hpp b/math/fastor/include/algebra/math/fastor.hpp deleted file mode 100644 index 49c73f42..00000000 --- a/math/fastor/include/algebra/math/fastor.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2020-2022 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s). -#include "algebra/boolean.hpp" -#include "algebra/math.hpp" -#include "algebra/math/impl/fastor_matrix.hpp" -#include "algebra/math/impl/fastor_transform3.hpp" -#include "algebra/math/impl/fastor_vector.hpp" diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index 800e5bc9..a6d43e95 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -16,7 +16,3 @@ if(ALGEBRA_PLUGINS_INCLUDE_VC) add_subdirectory(vc_aos) add_subdirectory(vc_soa) endif() - -if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) - add_subdirectory(fastor) -endif() diff --git a/storage/fastor/CMakeLists.txt b/storage/fastor/CMakeLists.txt deleted file mode 100644 index 8f4abe3b..00000000 --- a/storage/fastor/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2022-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library( algebra_fastor_storage fastor_storage - "include/algebra/storage/fastor.hpp" - "include/algebra/storage/impl/fastor_getter.hpp" - "include/algebra/storage/impl/fastor_matrix.hpp" -) -target_link_libraries( - algebra_fastor_storage - INTERFACE Fastor::Fastor algebra::common -) -algebra_test_public_headers( algebra_fastor_storage - "algebra/storage/fastor.hpp" -) From 5018a39981c749f29f1930e072007fc7e2c18a5c Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Mon, 2 Mar 2026 15:24:08 +0100 Subject: [PATCH 5/9] Refactor smatrix plugin --- frontend/fastor/include/algebra/fastor.hpp | 1 + frontend/smatrix/CMakeLists.txt | 6 ++-- .../algebra}/impl/smatrix_errorcheck.hpp | 2 +- .../include/algebra}/impl/smatrix_getter.hpp | 2 +- .../include/algebra}/impl/smatrix_matrix.hpp | 4 +-- .../algebra}/impl/smatrix_transform3.hpp | 4 +-- .../include/algebra/impl/smatrix_types.hpp | 4 +-- .../include/algebra}/impl/smatrix_vector.hpp | 2 +- frontend/smatrix/include/algebra/smatrix.hpp | 10 +++++-- math/CMakeLists.txt | 4 --- math/smatrix/CMakeLists.txt | 30 ------------------- math/smatrix/include/algebra/math/smatrix.hpp | 15 ---------- storage/CMakeLists.txt | 4 --- storage/smatrix/CMakeLists.txt | 21 ------------- 14 files changed, 21 insertions(+), 88 deletions(-) rename {math/smatrix/include/algebra/math => frontend/smatrix/include/algebra}/impl/smatrix_errorcheck.hpp (93%) rename {storage/smatrix/include/algebra/storage => frontend/smatrix/include/algebra}/impl/smatrix_getter.hpp (99%) rename {math/smatrix/include/algebra/math => frontend/smatrix/include/algebra}/impl/smatrix_matrix.hpp (95%) rename {math/smatrix/include/algebra/math => frontend/smatrix/include/algebra}/impl/smatrix_transform3.hpp (98%) rename storage/smatrix/include/algebra/storage/smatrix.hpp => frontend/smatrix/include/algebra/impl/smatrix_types.hpp (94%) rename {math/smatrix/include/algebra/math => frontend/smatrix/include/algebra}/impl/smatrix_vector.hpp (99%) delete mode 100644 math/smatrix/CMakeLists.txt delete mode 100644 math/smatrix/include/algebra/math/smatrix.hpp delete mode 100644 storage/smatrix/CMakeLists.txt diff --git a/frontend/fastor/include/algebra/fastor.hpp b/frontend/fastor/include/algebra/fastor.hpp index 6ef0d94b..2a68eeba 100644 --- a/frontend/fastor/include/algebra/fastor.hpp +++ b/frontend/fastor/include/algebra/fastor.hpp @@ -8,6 +8,7 @@ #pragma once // Project include(s). +#include "algebra/boolean.hpp" #include "algebra/impl/fastor_getter.hpp" #include "algebra/impl/fastor_matrix.hpp" #include "algebra/impl/fastor_transform3.hpp" diff --git a/frontend/smatrix/CMakeLists.txt b/frontend/smatrix/CMakeLists.txt index ef334f3e..cbe97d65 100644 --- a/frontend/smatrix/CMakeLists.txt +++ b/frontend/smatrix/CMakeLists.txt @@ -9,14 +9,16 @@ message(STATUS "Building the SMatrix algebra plugin") # Set up the library. algebra_add_library( algebra_smatrix smatrix "include/algebra/smatrix.hpp" + "include/algebra/impl/*.hpp" ) target_link_libraries( algebra_smatrix INTERFACE + ROOT::Core + ROOT::MathCore + ROOT::Smatrix algebra::common - algebra::smatrix_storage - algebra::smatrix_math algebra::generic_math ) diff --git a/math/smatrix/include/algebra/math/impl/smatrix_errorcheck.hpp b/frontend/smatrix/include/algebra/impl/smatrix_errorcheck.hpp similarity index 93% rename from math/smatrix/include/algebra/math/impl/smatrix_errorcheck.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_errorcheck.hpp index 4cf7042d..d2f65921 100644 --- a/math/smatrix/include/algebra/math/impl/smatrix_errorcheck.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_errorcheck.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2022 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/storage/smatrix/include/algebra/storage/impl/smatrix_getter.hpp b/frontend/smatrix/include/algebra/impl/smatrix_getter.hpp similarity index 99% rename from storage/smatrix/include/algebra/storage/impl/smatrix_getter.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_getter.hpp index 1dac384c..22f9cebb 100644 --- a/storage/smatrix/include/algebra/storage/impl/smatrix_getter.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_getter.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/math/smatrix/include/algebra/math/impl/smatrix_matrix.hpp b/frontend/smatrix/include/algebra/impl/smatrix_matrix.hpp similarity index 95% rename from math/smatrix/include/algebra/math/impl/smatrix_matrix.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_matrix.hpp index ded7eba4..e3565f34 100644 --- a/math/smatrix/include/algebra/math/impl/smatrix_matrix.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_matrix.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/impl/smatrix_types.hpp" #include "algebra/qualifiers.hpp" -#include "algebra/storage/smatrix.hpp" // ROOT/Smatrix include(s). #include diff --git a/math/smatrix/include/algebra/math/impl/smatrix_transform3.hpp b/frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp similarity index 98% rename from math/smatrix/include/algebra/math/impl/smatrix_transform3.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp index 13d36130..29290e41 100644 --- a/math/smatrix/include/algebra/math/impl/smatrix_transform3.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/math/impl/smatrix_errorcheck.hpp" +#include "algebra/impl/smatrix_errorcheck.hpp" #include "algebra/qualifiers.hpp" #include "algebra/utils/approximately_equal.hpp" diff --git a/storage/smatrix/include/algebra/storage/smatrix.hpp b/frontend/smatrix/include/algebra/impl/smatrix_types.hpp similarity index 94% rename from storage/smatrix/include/algebra/storage/smatrix.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_types.hpp index 26703ee4..457e6513 100644 --- a/storage/smatrix/include/algebra/storage/smatrix.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_types.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,7 +9,7 @@ // Project include(s) #include "algebra/concepts.hpp" -#include "algebra/storage/impl/smatrix_getter.hpp" +#include "algebra/impl/smatrix_getter.hpp" #include "algebra/type_traits.hpp" // ROOT/Smatrix include(s). diff --git a/math/smatrix/include/algebra/math/impl/smatrix_vector.hpp b/frontend/smatrix/include/algebra/impl/smatrix_vector.hpp similarity index 99% rename from math/smatrix/include/algebra/math/impl/smatrix_vector.hpp rename to frontend/smatrix/include/algebra/impl/smatrix_vector.hpp index be5fbfe8..14aa9d44 100644 --- a/math/smatrix/include/algebra/math/impl/smatrix_vector.hpp +++ b/frontend/smatrix/include/algebra/impl/smatrix_vector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/frontend/smatrix/include/algebra/smatrix.hpp b/frontend/smatrix/include/algebra/smatrix.hpp index 9c1794d7..371f053d 100644 --- a/frontend/smatrix/include/algebra/smatrix.hpp +++ b/frontend/smatrix/include/algebra/smatrix.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2020-2024 CERN for the benefit of the ACTS project + * (c) 2020-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,9 +8,13 @@ #pragma once // Project include(s). +#include "algebra/boolean.hpp" +#include "algebra/impl/smatrix_getter.hpp" +#include "algebra/impl/smatrix_matrix.hpp" +#include "algebra/impl/smatrix_transform.hpp" +#include "algebra/impl/smatrix_types.hpp" +#include "algebra/impl/smatrix_vector.hpp" #include "algebra/math/generic.hpp" -#include "algebra/math/smatrix.hpp" -#include "algebra/storage/smatrix.hpp" namespace algebra { diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt index ee966888..e02f1faa 100644 --- a/math/CMakeLists.txt +++ b/math/CMakeLists.txt @@ -8,10 +8,6 @@ add_subdirectory(cmath) add_subdirectory(generic) -if(ALGEBRA_PLUGINS_INCLUDE_SMATRIX) - add_subdirectory(smatrix) -endif() - if(ALGEBRA_PLUGINS_INCLUDE_VC) add_subdirectory(vc_aos) add_subdirectory(vc_soa) diff --git a/math/smatrix/CMakeLists.txt b/math/smatrix/CMakeLists.txt deleted file mode 100644 index c63ca4e5..00000000 --- a/math/smatrix/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2021-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Find Smatrix. -find_package(ROOT COMPONENTS Core MathCore Smatrix REQUIRED) - -# Set up the library. -algebra_add_library(algebra_smatrix_math smatrix_math - "include/algebra/math/smatrix.hpp" - "include/algebra/math/impl/smatrix_errorcheck.hpp" - "include/algebra/math/impl/smatrix_matrix.hpp" - "include/algebra/math/impl/smatrix_transform3.hpp" - "include/algebra/math/impl/smatrix_vector.hpp" -) -target_link_libraries( - algebra_smatrix_math - INTERFACE - algebra::common - algebra::utils - algebra::smatrix_storage - ROOT::Core - ROOT::MathCore - ROOT::Smatrix -) -algebra_test_public_headers( algebra_smatrix_math - "algebra/math/smatrix.hpp" -) diff --git a/math/smatrix/include/algebra/math/smatrix.hpp b/math/smatrix/include/algebra/math/smatrix.hpp deleted file mode 100644 index 48d53be9..00000000 --- a/math/smatrix/include/algebra/math/smatrix.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2020-2022 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s). -#include "algebra/boolean.hpp" -#include "algebra/math.hpp" -#include "algebra/math/impl/smatrix_matrix.hpp" -#include "algebra/math/impl/smatrix_transform3.hpp" -#include "algebra/math/impl/smatrix_vector.hpp" diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index a6d43e95..5fd6ddb9 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -8,10 +8,6 @@ add_subdirectory(array) add_subdirectory(cmath) -if(ALGEBRA_PLUGINS_INCLUDE_SMATRIX) - add_subdirectory(smatrix) -endif() - if(ALGEBRA_PLUGINS_INCLUDE_VC) add_subdirectory(vc_aos) add_subdirectory(vc_soa) diff --git a/storage/smatrix/CMakeLists.txt b/storage/smatrix/CMakeLists.txt deleted file mode 100644 index 3287f9f6..00000000 --- a/storage/smatrix/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2021-2024 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Find Smatrix. -find_package(ROOT COMPONENTS Smatrix REQUIRED) - -# Set up the library. -algebra_add_library( algebra_smatrix_storage smatrix_storage - "include/algebra/storage/smatrix.hpp" - "include/algebra/storage/impl/smatrix_getter.hpp" -) -target_link_libraries( - algebra_smatrix_storage - INTERFACE algebra::common ROOT::Smatrix -) -algebra_test_public_headers( algebra_smatrix_storage - "algebra/storage/smatrix.hpp" -) From 2678bff99d19ab34e08fb8cdcf87cda040a23271 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Mon, 2 Mar 2026 15:57:38 +0100 Subject: [PATCH 6/9] Refactor Vc plugin --- common/include/algebra/matrix.hpp | 5 ++-- common/include/algebra/vector.hpp | 2 +- frontend/vc_aos/CMakeLists.txt | 7 ++--- .../impl/vc_aos_approximately_equal.hpp | 2 +- .../include/algebra}/impl/vc_aos_concepts.hpp | 2 +- .../include/algebra}/impl/vc_aos_getter.hpp | 2 +- .../include/algebra}/impl/vc_aos_matrix.hpp | 26 +++++++++------- .../algebra}/impl/vc_aos_transform3.hpp | 18 +++++------ .../include/algebra/impl/vc_aos_types.hpp | 8 ++--- .../include/algebra}/impl/vc_aos_vector.hpp | 4 +-- frontend/vc_aos/include/algebra/vc_aos.hpp | 10 +++++-- frontend/vc_soa/CMakeLists.txt | 8 ++--- .../include/algebra}/impl/vc_soa_boolean.hpp | 0 .../include/algebra}/impl/vc_soa_casts.hpp | 0 .../include/algebra}/impl/vc_soa_concepts.hpp | 2 +- .../include/algebra}/impl/vc_soa_getter.hpp | 0 .../include/algebra}/impl/vc_soa_math.hpp | 2 +- .../include/algebra}/impl/vc_soa_matrix.hpp | 20 +++++++------ .../include/algebra/impl/vc_soa_types.hpp | 6 ++-- .../include/algebra}/impl/vc_soa_vector.hpp | 30 ++++++++++--------- frontend/vc_soa/include/algebra/vc_soa.hpp | 11 +++++-- math/CMakeLists.txt | 5 ---- math/vc_aos/CMakeLists.txt | 25 ---------------- math/vc_aos/include/algebra/math/vc_aos.hpp | 15 ---------- math/vc_soa/CMakeLists.txt | 21 ------------- math/vc_soa/include/algebra/math/vc_soa.hpp | 14 --------- storage/CMakeLists.txt | 5 ---- storage/vc_aos/CMakeLists.txt | 17 ----------- storage/vc_soa/CMakeLists.txt | 20 ------------- 29 files changed, 88 insertions(+), 199 deletions(-) rename {storage/vc_aos/include/algebra/storage => frontend/vc_aos/include/algebra}/impl/vc_aos_approximately_equal.hpp (97%) rename {storage/vc_aos/include/algebra/storage => frontend/vc_aos/include/algebra}/impl/vc_aos_concepts.hpp (92%) rename {storage/vc_aos/include/algebra/storage => frontend/vc_aos/include/algebra}/impl/vc_aos_getter.hpp (93%) rename {math/vc_aos/include/algebra/math => frontend/vc_aos/include/algebra}/impl/vc_aos_matrix.hpp (56%) rename {math/vc_aos/include/algebra/math => frontend/vc_aos/include/algebra}/impl/vc_aos_transform3.hpp (94%) rename storage/vc_aos/include/algebra/storage/vc_aos.hpp => frontend/vc_aos/include/algebra/impl/vc_aos_types.hpp (93%) rename {math/vc_aos/include/algebra/math => frontend/vc_aos/include/algebra}/impl/vc_aos_vector.hpp (98%) rename {math/vc_soa/include/algebra/math => frontend/vc_soa/include/algebra}/impl/vc_soa_boolean.hpp (100%) rename {storage/vc_soa/include/algebra/storage => frontend/vc_soa/include/algebra}/impl/vc_soa_casts.hpp (100%) rename {storage/vc_soa/include/algebra/storage => frontend/vc_soa/include/algebra}/impl/vc_soa_concepts.hpp (89%) rename {storage/vc_soa/include/algebra/storage => frontend/vc_soa/include/algebra}/impl/vc_soa_getter.hpp (100%) rename {math/vc_soa/include/algebra/math => frontend/vc_soa/include/algebra}/impl/vc_soa_math.hpp (98%) rename {math/vc_soa/include/algebra/math => frontend/vc_soa/include/algebra}/impl/vc_soa_matrix.hpp (59%) rename storage/vc_soa/include/algebra/storage/vc_soa.hpp => frontend/vc_soa/include/algebra/impl/vc_soa_types.hpp (95%) rename {math/vc_soa/include/algebra/math => frontend/vc_soa/include/algebra}/impl/vc_soa_vector.hpp (82%) delete mode 100644 math/vc_aos/CMakeLists.txt delete mode 100644 math/vc_aos/include/algebra/math/vc_aos.hpp delete mode 100644 math/vc_soa/CMakeLists.txt delete mode 100644 math/vc_soa/include/algebra/math/vc_soa.hpp delete mode 100644 storage/vc_aos/CMakeLists.txt delete mode 100644 storage/vc_soa/CMakeLists.txt diff --git a/common/include/algebra/matrix.hpp b/common/include/algebra/matrix.hpp index d01e7f86..65af3016 100644 --- a/common/include/algebra/matrix.hpp +++ b/common/include/algebra/matrix.hpp @@ -20,10 +20,11 @@ namespace algebra::storage { /// Generic matrix type that can take vectors as columns template ; - using size_type = typename T::size_type; + using index_type = typename T::index_type; using boolean = typename T::boolean; using value = typename T::value_type; using scalar = typename T::scalar; @@ -173,7 +173,7 @@ template using get_simd_t = typename traits::get_algebra::template simd; template -using get_size_t = typename traits::get_algebra::size_type; +using get_size_t = typename traits::get_algebra::index_type; template using get_scalar_t = typename traits::get_algebra::scalar; @@ -207,32 +207,32 @@ using get_matrix_t = typename traits::get_algebra::template matrix; \ template \ struct index> { \ - using type = algebra::A::size_type; \ + using type = algebra::A::index_type; \ }; \ \ template \ struct index> { \ - using type = algebra::A::size_type; \ + using type = algebra::A::index_type; \ }; \ \ template \ struct dimensions> { \ \ - using size_type = index_t>; \ + using index_type = index_t>; \ \ - static constexpr size_type dim{1}; \ - static constexpr size_type rows{N}; \ - static constexpr size_type columns{1}; \ + static constexpr index_type _dim{1}; \ + static constexpr index_type _rows{N}; \ + static constexpr index_type _columns{1}; \ }; \ \ template \ struct dimensions> { \ \ - using size_type = index_t>; \ + using index_type = index_t>; \ \ - static constexpr size_type dim{2}; \ - static constexpr size_type rows{ROWS}; \ - static constexpr size_type columns{COLS}; \ + static constexpr index_type _dim{2}; \ + static constexpr index_type _rows{ROWS}; \ + static constexpr index_type _columns{COLS}; \ }; \ \ template \ diff --git a/generic/include/algebra/algorithms/matrix/decomposition/partial_pivot_lud.hpp b/generic/include/algebra/algorithms/matrix/decomposition/partial_pivot_lud.hpp index b0e7de61..14878c0a 100644 --- a/generic/include/algebra/algorithms/matrix/decomposition/partial_pivot_lud.hpp +++ b/generic/include/algebra/algorithms/matrix/decomposition/partial_pivot_lud.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -18,24 +18,21 @@ namespace algebra::generic::matrix::decomposition { /// "Partial Pivot LU Decomposition", assuming a N X N matrix -template +template struct partial_pivot_lud { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; - using vector_type = algebra::traits::vector_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; + using vector_t = algebra::traits::vector_t; - /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; - - template + template struct lud { // LU decomposition matrix, equal to (L - I) + U, where the diagonal // components of L is always 1 matrix_t lu; // Permutation vector - vector_type P; + vector_t P; // Number of pivots int n_pivot = 0; @@ -44,37 +41,41 @@ struct partial_pivot_lud { ALGEBRA_HOST_DEVICE constexpr lud> operator()( const matrix_t& m) const { - constexpr size_type N{algebra::traits::rank}; + // Function (object) used for accessing a matrix element + using element_getter_t = algebra::traits::element_getter_t; + + constexpr element_getter_t elem{}; + constexpr index_t N{algebra::traits::rank}; // LU decomposition matrix matrix_t lu = m; // Permutation - vector_type P; + vector_t P; // Max index and value - size_type max_idx; - scalar_type max_val; - scalar_type abs_val; + index_t max_idx; + scalar_t max_val; + scalar_t abs_val; // Number of pivoting int n_pivot = N; // Rows for swapping - vector_type row_0; - vector_type row_1; + vector_t row_0; + vector_t row_1; // Unit permutation matrix, P[N] initialized with N - for (size_type i = 0; i < N; i++) { - P[i] = static_cast(i); + for (index_t i = 0; i < N; i++) { + P[i] = static_cast(i); } - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { max_val = 0; max_idx = i; - for (size_type k = i; k < N; k++) { - abs_val = algebra::math::fabs(element_getter()(lu, k, i)); + for (index_t k = i; k < N; k++) { + abs_val = algebra::math::fabs(elem(lu, k, i)); if (abs_val > max_val) { @@ -91,27 +92,26 @@ struct partial_pivot_lud { P[max_idx] = j; // Pivoting rows of A - for (size_type q = 0; q < N; q++) { - row_0[q] = element_getter_t()(lu, i, q); - row_1[q] = element_getter_t()(lu, max_idx, q); + for (index_t q = 0; q < N; q++) { + row_0[q] = elem(lu, i, q); + row_1[q] = elem(lu, max_idx, q); } - for (size_type q = 0; q < N; q++) { - element_getter_t()(lu, i, q) = row_1[q]; - element_getter_t()(lu, max_idx, q) = row_0[q]; + for (index_t q = 0; q < N; q++) { + elem(lu, i, q) = row_1[q]; + elem(lu, max_idx, q) = row_0[q]; } // counting pivots starting from N (for determinant) n_pivot++; } - for (size_type j = i + 1; j < N; j++) { + for (index_t j = i + 1; j < N; j++) { // m[j][i] /= m[i][i]; - element_getter_t()(lu, j, i) /= element_getter_t()(lu, i, i); + elem(lu, j, i) /= elem(lu, i, i); - for (size_type k = i + 1; k < N; k++) { + for (index_t k = i + 1; k < N; k++) { // m[j][k] -= m[j][i] * m[i][k]; - element_getter_t()(lu, j, k) -= - element_getter_t()(lu, j, i) * element_getter_t()(lu, i, k); + elem(lu, j, k) -= elem(lu, j, i) * elem(lu, i, k); } } } diff --git a/generic/include/algebra/algorithms/matrix/determinant/cofactor.hpp b/generic/include/algebra/algorithms/matrix/determinant/cofactor.hpp index 8d1942f4..3a068f91 100644 --- a/generic/include/algebra/algorithms/matrix/determinant/cofactor.hpp +++ b/generic/include/algebra/algorithms/matrix/determinant/cofactor.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -18,53 +18,64 @@ namespace algebra::generic::matrix::determinant { /// "Determinant getter", assuming a N X N matrix -template +template struct cofactor { using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; - - /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; + using index_type = algebra::traits::index_t; ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( const matrix_t &m) const { return determinant_getter_helper>()(m); } - template + template struct determinant_getter_helper; - template - struct determinant_getter_helper> { + template + requires(N == 1) + struct determinant_getter_helper { template ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( const input_matrix_type &m) const { - return element_getter()(m, 0, 0); + + using element_getter_t = + algebra::traits::element_getter_t; + + constexpr element_getter_t elem{}; + + return elem(m, 0, 0); } }; - template - struct determinant_getter_helper> { + template + requires(N != 1) + struct determinant_getter_helper { template ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( const input_matrix_type &m) const { - scalar_type D = 0; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; + using element_getter_t = + algebra::traits::element_getter_t; + + constexpr element_getter_t elem{}; + + scalar_t D = 0; // To store cofactors - matrix_t temp; + input_matrix_type temp; // To store sign multiplier int sign = 1; // Iterate for each element of first row - for (size_type col = 0; col < N; col++) { + for (index_t col = 0; col < N; col++) { // Getting Cofactor of A[0][f] - this->get_cofactor(m, temp, size_type(0), col); - D += sign * element_getter()(m, 0, col) * - determinant_getter_helper()(temp); + this->get_cofactor(m, temp, index_t(0), col); + D += sign * elem(m, 0, col) * determinant_getter_helper()(temp); // terms are to be added with alternate sign sign = -sign; @@ -75,19 +86,26 @@ struct cofactor { template ALGEBRA_HOST_DEVICE constexpr void get_cofactor(const input_matrix_type &m, - matrix_t &temp, size_type p, - size_type q) const { + input_matrix_type &temp, + index_type p, + index_type q) const { + + using index_t = algebra::traits::index_t; + using element_getter_t = + algebra::traits::element_getter_t; + + constexpr element_getter_t elem{}; - size_type i = 0; - size_type j = 0; + index_t i = 0; + index_t j = 0; // Looping for each element of the matrix - for (size_type row = 0; row < N; row++) { - for (size_type col = 0; col < N; col++) { + for (index_t row = 0; row < N; row++) { + for (index_t col = 0; col < N; col++) { // Copying into temporary matrix only those element // which are not in given row and column if (row != p && col != q) { - element_getter()(temp, i, j++) = element_getter()(m, row, col); + elem(temp, i, j++) = elem(m, row, col); // Row is filled, so increase row index and // reset col index diff --git a/generic/include/algebra/algorithms/matrix/determinant/hard_coded.hpp b/generic/include/algebra/algorithms/matrix/determinant/hard_coded.hpp index f73225ee..173e8324 100644 --- a/generic/include/algebra/algorithms/matrix/determinant/hard_coded.hpp +++ b/generic/include/algebra/algorithms/matrix/determinant/hard_coded.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -18,79 +18,56 @@ namespace algebra::generic::matrix::determinant { /// "Determinant getter", assuming a N X N matrix -template +template struct hard_coded { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; + using element_getter_t = algebra::traits::element_getter_t; // 2 X 2 matrix determinant template requires(algebra::traits::rank == 2) - ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( - const matrix_t &m) const { + ALGEBRA_HOST_DEVICE constexpr scalar_t operator()(const matrix_t &m) const { - return element_getter()(m, 0, 0) * element_getter()(m, 1, 1) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 0); + constexpr element_getter_t elem{}; + + return elem(m, 0, 0) * elem(m, 1, 1) - elem(m, 0, 1) * elem(m, 1, 0); } // 4 X 4 matrix determinant template requires(algebra::traits::rank == 4) - ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( - const matrix_t &m) const { + ALGEBRA_HOST_DEVICE constexpr scalar_t operator()(const matrix_t &m) const { + + constexpr element_getter_t elem{}; - return element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 0) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 0) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 0) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 0) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 1) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 1) + - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 1) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 1) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 1) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 1) + - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 2) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 2) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 2) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 2) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 2) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 3) * element_getter()(m, 3, 2) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 3) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 0) * element_getter()(m, 3, 3) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 3) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 1) * element_getter()(m, 3, 3) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 3) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 2) * element_getter()(m, 3, 3); + return elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 2, 1) * elem(m, 3, 0) - + elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 2, 1) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 2, 2) * elem(m, 3, 0) + + elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 2, 2) * elem(m, 3, 0) + + elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 2, 0) * elem(m, 3, 1) + + elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 2, 0) * elem(m, 3, 1) + + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 2, 2) * elem(m, 3, 1) - + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 2, 2) * elem(m, 3, 1) - + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 2, 3) * elem(m, 3, 1) + + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 2, 3) * elem(m, 3, 1) + + elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 2, 0) * elem(m, 3, 2) - + elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 2, 0) * elem(m, 3, 2) - + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 2, 1) * elem(m, 3, 2) + + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 2, 1) * elem(m, 3, 2) + + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 2, 3) * elem(m, 3, 2) - + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 2, 3) * elem(m, 3, 2) - + elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 2, 0) * elem(m, 3, 3) + + elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 2, 0) * elem(m, 3, 3) + + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 2, 1) * elem(m, 3, 3) - + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 2, 1) * elem(m, 3, 3) - + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 2, 2) * elem(m, 3, 3) + + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 2, 2) * elem(m, 3, 3); } }; diff --git a/generic/include/algebra/algorithms/matrix/determinant/partial_pivot_lud.hpp b/generic/include/algebra/algorithms/matrix/determinant/partial_pivot_lud.hpp index c7e3ad49..aa8a9e3e 100644 --- a/generic/include/algebra/algorithms/matrix/determinant/partial_pivot_lud.hpp +++ b/generic/include/algebra/algorithms/matrix/determinant/partial_pivot_lud.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -16,23 +16,23 @@ namespace algebra::generic::matrix::determinant { /// "Partial Pivot LU Decomposition", assuming a N X N matrix -template +template struct partial_pivot_lud { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; + using element_getter_t = algebra::traits::element_getter_t; using decomposition_t = typename algebra::generic::matrix::decomposition::partial_pivot_lud< - matrix_t, element_getter_t>; + matrix_t>; - ALGEBRA_HOST_DEVICE constexpr scalar_type operator()( - const matrix_t& m) const { + ALGEBRA_HOST_DEVICE constexpr scalar_t operator()(const matrix_t& m) const { - constexpr size_type N{algebra::traits::rank}; + constexpr element_getter_t elem{}; + constexpr index_t N{algebra::traits::rank}; const typename decomposition_t::template lud< algebra::traits::rank> @@ -40,12 +40,12 @@ struct partial_pivot_lud { // Get the LU decomposition matrix equal to (L - I) + U const auto& lu = decomp_res.lu; - const auto n_pivot = static_cast(decomp_res.n_pivot); + const auto n_pivot = static_cast(decomp_res.n_pivot); - scalar_type det = element_getter()(lu, 0, 0); + scalar_t det = elem(lu, 0, 0); - for (size_type i = 1; i < N; i++) { - det *= element_getter()(lu, i, i); + for (index_t i = 1; i < N; i++) { + det *= elem(lu, i, i); } return (n_pivot - N) % 2 == 0 ? det : -det; diff --git a/generic/include/algebra/algorithms/matrix/inverse/cofactor.hpp b/generic/include/algebra/algorithms/matrix/inverse/cofactor.hpp index 0c139155..26ee6226 100644 --- a/generic/include/algebra/algorithms/matrix/inverse/cofactor.hpp +++ b/generic/include/algebra/algorithms/matrix/inverse/cofactor.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -21,50 +21,54 @@ namespace algebra::generic::matrix { namespace adjoint { /// "Adjoint getter", assuming a N X N matrix -template +template struct cofactor { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; - - /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; + using index_type = algebra::traits::index_t; ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t &m) const { return adjoint_getter_helper>()(m); } - template + template struct adjoint_getter_helper; - template - struct adjoint_getter_helper> { + template + requires(N == 1) + struct adjoint_getter_helper { ALGEBRA_HOST_DEVICE constexpr matrix_t operator()( const matrix_t & /*m*/) const { + + using element_getter_t = algebra::traits::element_getter_t; + constexpr element_getter_t elem{}; + matrix_t ret; - element_getter()(ret, 0, 0) = 1; + elem(ret, 0, 0) = 1; + return ret; } }; - template - struct adjoint_getter_helper> { + template + requires(N != 1) + struct adjoint_getter_helper { - using determinant_getter = - determinant::cofactor; + using determinant_getter = determinant::cofactor; ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t &m) const { - matrix_t adj; + using index_t = algebra::traits::index_t; + using element_getter_t = algebra::traits::element_getter_t; + constexpr element_getter_t elem{}; // temp is used to store cofactors of m int sign = 1; - // To store cofactors - matrix_t temp; + matrix_t temp; //< To store cofactors + matrix_t adj; - for (size_type i = 0; i < N; i++) { - for (size_type j = 0; j < N; j++) { + for (index_t i = 0; i < N; i++) { + for (index_t j = 0; j < N; j++) { // Get cofactor of m[i][j] typename determinant_getter::template determinant_getter_helper() .get_cofactor(m, temp, i, j); @@ -75,7 +79,7 @@ struct cofactor { // Interchanging rows and columns to get the // transpose of the cofactor matrix - element_getter()(adj, j, i) = + elem(adj, j, i) = sign * typename determinant_getter::template determinant_getter_helper< N - 1>()(temp); @@ -92,27 +96,26 @@ struct cofactor { namespace inverse { /// "inverse getter", assuming a N X N matrix -template +template struct cofactor { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; - - using determinant_getter = determinant::cofactor; - - using adjoint_getter = adjoint::cofactor; + using element_getter_t = algebra::traits::element_getter_t; + using determinant_getter = determinant::cofactor; + using adjoint_getter = adjoint::cofactor; ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t &m) const { - constexpr size_type N{algebra::traits::rank}; + constexpr element_getter_t elem{}; + constexpr index_t N{algebra::traits::rank}; matrix_t ret; // Find determinant of A - scalar_type det = determinant_getter()(m); + scalar_t det = determinant_getter()(m); // TODO: handle singular matrix error // if (det == 0) { @@ -122,9 +125,9 @@ struct cofactor { auto adj = adjoint_getter()(m); // Find Inverse using formula "inverse(A) = adj(A)/det(A)" - for (size_type i = 0; i < N; i++) { - for (size_type j = 0; j < N; j++) { - element_getter()(ret, j, i) = element_getter()(adj, j, i) / det; + for (index_t i = 0; i < N; i++) { + for (index_t j = 0; j < N; j++) { + elem(ret, j, i) = elem(adj, j, i) / det; } } diff --git a/generic/include/algebra/algorithms/matrix/inverse/hard_coded.hpp b/generic/include/algebra/algorithms/matrix/inverse/hard_coded.hpp index 4463d05c..f83bbfd3 100644 --- a/generic/include/algebra/algorithms/matrix/inverse/hard_coded.hpp +++ b/generic/include/algebra/algorithms/matrix/inverse/hard_coded.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -19,31 +19,30 @@ namespace algebra::generic::matrix::inverse { /// "inverse getter", assuming a N X N matrix -template +template struct hard_coded { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; - - using determinant_getter = - determinant::hard_coded; + using element_getter_t = algebra::traits::element_getter_t; + using determinant_getter = determinant::hard_coded; // 2 X 2 matrix inverse template requires(algebra::traits::rank == 2) ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t &m) const { - matrix_t ret; + constexpr element_getter_t elem{}; - scalar_type det = determinant_getter()(m); + const scalar_t det = determinant_getter()(m); - element_getter()(ret, 0, 0) = element_getter()(m, 1, 1) / det; - element_getter()(ret, 0, 1) = -1 * element_getter()(m, 0, 1) / det; - element_getter()(ret, 1, 0) = -1 * element_getter()(m, 1, 0) / det; - element_getter()(ret, 1, 1) = element_getter()(m, 0, 0) / det; + matrix_t ret; + elem(ret, 0, 0) = elem(m, 1, 1) / det; + elem(ret, 0, 1) = -elem(m, 0, 1) / det; + elem(ret, 1, 0) = -elem(m, 1, 0) / det; + elem(ret, 1, 1) = elem(m, 0, 0) / det; return ret; } @@ -53,222 +52,113 @@ struct hard_coded { requires(algebra::traits::rank == 4) ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t &m) const { - matrix_t ret; - element_getter()(ret, 0, 0) = - element_getter()(m, 1, 2) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 1) - - element_getter()(m, 1, 3) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 1) + - element_getter()(m, 1, 3) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 2) - - element_getter()(m, 1, 1) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 2) - - element_getter()(m, 1, 2) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 3) + - element_getter()(m, 1, 1) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 0, 1) = - element_getter()(m, 0, 3) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 2) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 3) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 2) + - element_getter()(m, 0, 1) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 2) + - element_getter()(m, 0, 2) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 3) - - element_getter()(m, 0, 1) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 0, 2) = - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 1) + - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 2) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 2) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 3) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 0, 3) = - element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 1) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 1) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 2) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 2) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 3) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 3); - element_getter()(ret, 1, 0) = - element_getter()(m, 1, 3) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 0) - - element_getter()(m, 1, 2) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 1, 3) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 2) + - element_getter()(m, 1, 0) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 2) + - element_getter()(m, 1, 2) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 3) - - element_getter()(m, 1, 0) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 1, 1) = - element_getter()(m, 0, 2) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 0) + - element_getter()(m, 0, 3) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 2) - - element_getter()(m, 0, 0) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 2) - - element_getter()(m, 0, 2) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 3) + - element_getter()(m, 0, 0) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 1, 2) = - element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 2) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 2) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 3) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 3); - element_getter()(ret, 1, 3) = - element_getter()(m, 0, 2) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 0) + - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 2) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 2) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 3) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 3); - element_getter()(ret, 2, 0) = - element_getter()(m, 1, 1) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 1, 3) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 0) + - element_getter()(m, 1, 3) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 1) - - element_getter()(m, 1, 0) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 1) - - element_getter()(m, 1, 1) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 3) + - element_getter()(m, 1, 0) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 3); - element_getter()(ret, 2, 1) = - element_getter()(m, 0, 3) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 1) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 1) + - element_getter()(m, 0, 0) * element_getter()(m, 2, 3) * - element_getter()(m, 3, 1) + - element_getter()(m, 0, 1) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 3) - - element_getter()(m, 0, 0) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 3); - element_getter()(ret, 2, 2) = - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 0) + - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 3) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 3); - element_getter()(ret, 2, 3) = - element_getter()(m, 0, 3) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 0) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 0) - - element_getter()(m, 0, 3) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 1) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 3) * - element_getter()(m, 2, 1) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 3) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 3); - element_getter()(ret, 3, 0) = - element_getter()(m, 1, 2) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 0) - - element_getter()(m, 1, 1) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 0) - - element_getter()(m, 1, 2) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 1) + - element_getter()(m, 1, 0) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 1) + - element_getter()(m, 1, 1) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 2) - - element_getter()(m, 1, 0) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 2); - element_getter()(ret, 3, 1) = - element_getter()(m, 0, 1) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 2) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 0) + - element_getter()(m, 0, 2) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 0) * element_getter()(m, 2, 2) * - element_getter()(m, 3, 1) - - element_getter()(m, 0, 1) * element_getter()(m, 2, 0) * - element_getter()(m, 3, 2) + - element_getter()(m, 0, 0) * element_getter()(m, 2, 1) * - element_getter()(m, 3, 2); - element_getter()(ret, 3, 2) = - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 0) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 1) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 3, 1) + - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 3, 2) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 3, 2); - element_getter()(ret, 3, 3) = - element_getter()(m, 0, 1) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 0) - - element_getter()(m, 0, 2) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 0) + - element_getter()(m, 0, 2) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 1) - - element_getter()(m, 0, 0) * element_getter()(m, 1, 2) * - element_getter()(m, 2, 1) - - element_getter()(m, 0, 1) * element_getter()(m, 1, 0) * - element_getter()(m, 2, 2) + - element_getter()(m, 0, 0) * element_getter()(m, 1, 1) * - element_getter()(m, 2, 2); + constexpr element_getter_t elem{}; - scalar_type idet = static_cast(1.) / determinant_getter()(ret); + matrix_t ret; + elem(ret, 0, 0) = elem(m, 1, 2) * elem(m, 2, 3) * elem(m, 3, 1) - + elem(m, 1, 3) * elem(m, 2, 2) * elem(m, 3, 1) + + elem(m, 1, 3) * elem(m, 2, 1) * elem(m, 3, 2) - + elem(m, 1, 1) * elem(m, 2, 3) * elem(m, 3, 2) - + elem(m, 1, 2) * elem(m, 2, 1) * elem(m, 3, 3) + + elem(m, 1, 1) * elem(m, 2, 2) * elem(m, 3, 3); + elem(ret, 0, 1) = elem(m, 0, 3) * elem(m, 2, 2) * elem(m, 3, 1) - + elem(m, 0, 2) * elem(m, 2, 3) * elem(m, 3, 1) - + elem(m, 0, 3) * elem(m, 2, 1) * elem(m, 3, 2) + + elem(m, 0, 1) * elem(m, 2, 3) * elem(m, 3, 2) + + elem(m, 0, 2) * elem(m, 2, 1) * elem(m, 3, 3) - + elem(m, 0, 1) * elem(m, 2, 2) * elem(m, 3, 3); + elem(ret, 0, 2) = elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 3, 1) - + elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 3, 1) + + elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 3, 2) - + elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 3, 2) - + elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 3, 3) + + elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 3, 3); + elem(ret, 0, 3) = elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 2, 1) - + elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 2, 1) - + elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 2, 2) + + elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 2, 2) + + elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 2, 3) - + elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 2, 3); + elem(ret, 1, 0) = elem(m, 1, 3) * elem(m, 2, 2) * elem(m, 3, 0) - + elem(m, 1, 2) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 1, 3) * elem(m, 2, 0) * elem(m, 3, 2) + + elem(m, 1, 0) * elem(m, 2, 3) * elem(m, 3, 2) + + elem(m, 1, 2) * elem(m, 2, 0) * elem(m, 3, 3) - + elem(m, 1, 0) * elem(m, 2, 2) * elem(m, 3, 3); + elem(ret, 1, 1) = elem(m, 0, 2) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 2, 2) * elem(m, 3, 0) + + elem(m, 0, 3) * elem(m, 2, 0) * elem(m, 3, 2) - + elem(m, 0, 0) * elem(m, 2, 3) * elem(m, 3, 2) - + elem(m, 0, 2) * elem(m, 2, 0) * elem(m, 3, 3) + + elem(m, 0, 0) * elem(m, 2, 2) * elem(m, 3, 3); + elem(ret, 1, 2) = elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 3, 0) - + elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 3, 2) + + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 3, 2) + + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 3, 3) - + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 3, 3); + elem(ret, 1, 3) = elem(m, 0, 2) * elem(m, 1, 3) * elem(m, 2, 0) - + elem(m, 0, 3) * elem(m, 1, 2) * elem(m, 2, 0) + + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 2, 2) - + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 2, 2) - + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 2, 3) + + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 2, 3); + elem(ret, 2, 0) = elem(m, 1, 1) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 1, 3) * elem(m, 2, 1) * elem(m, 3, 0) + + elem(m, 1, 3) * elem(m, 2, 0) * elem(m, 3, 1) - + elem(m, 1, 0) * elem(m, 2, 3) * elem(m, 3, 1) - + elem(m, 1, 1) * elem(m, 2, 0) * elem(m, 3, 3) + + elem(m, 1, 0) * elem(m, 2, 1) * elem(m, 3, 3); + elem(ret, 2, 1) = elem(m, 0, 3) * elem(m, 2, 1) * elem(m, 3, 0) - + elem(m, 0, 1) * elem(m, 2, 3) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 2, 0) * elem(m, 3, 1) + + elem(m, 0, 0) * elem(m, 2, 3) * elem(m, 3, 1) + + elem(m, 0, 1) * elem(m, 2, 0) * elem(m, 3, 3) - + elem(m, 0, 0) * elem(m, 2, 1) * elem(m, 3, 3); + elem(ret, 2, 2) = elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 3, 0) - + elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 3, 0) + + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 3, 1) - + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 3, 1) - + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 3, 3) + + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 3, 3); + elem(ret, 2, 3) = elem(m, 0, 3) * elem(m, 1, 1) * elem(m, 2, 0) - + elem(m, 0, 1) * elem(m, 1, 3) * elem(m, 2, 0) - + elem(m, 0, 3) * elem(m, 1, 0) * elem(m, 2, 1) + + elem(m, 0, 0) * elem(m, 1, 3) * elem(m, 2, 1) + + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 2, 3) - + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 2, 3); + elem(ret, 3, 0) = elem(m, 1, 2) * elem(m, 2, 1) * elem(m, 3, 0) - + elem(m, 1, 1) * elem(m, 2, 2) * elem(m, 3, 0) - + elem(m, 1, 2) * elem(m, 2, 0) * elem(m, 3, 1) + + elem(m, 1, 0) * elem(m, 2, 2) * elem(m, 3, 1) + + elem(m, 1, 1) * elem(m, 2, 0) * elem(m, 3, 2) - + elem(m, 1, 0) * elem(m, 2, 1) * elem(m, 3, 2); + elem(ret, 3, 1) = elem(m, 0, 1) * elem(m, 2, 2) * elem(m, 3, 0) - + elem(m, 0, 2) * elem(m, 2, 1) * elem(m, 3, 0) + + elem(m, 0, 2) * elem(m, 2, 0) * elem(m, 3, 1) - + elem(m, 0, 0) * elem(m, 2, 2) * elem(m, 3, 1) - + elem(m, 0, 1) * elem(m, 2, 0) * elem(m, 3, 2) + + elem(m, 0, 0) * elem(m, 2, 1) * elem(m, 3, 2); + elem(ret, 3, 2) = elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 3, 0) - + elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 3, 0) - + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 3, 1) + + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 3, 1) + + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 3, 2) - + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 3, 2); + elem(ret, 3, 3) = elem(m, 0, 1) * elem(m, 1, 2) * elem(m, 2, 0) - + elem(m, 0, 2) * elem(m, 1, 1) * elem(m, 2, 0) + + elem(m, 0, 2) * elem(m, 1, 0) * elem(m, 2, 1) - + elem(m, 0, 0) * elem(m, 1, 2) * elem(m, 2, 1) - + elem(m, 0, 1) * elem(m, 1, 0) * elem(m, 2, 2) + + elem(m, 0, 0) * elem(m, 1, 1) * elem(m, 2, 2); + + const scalar_t idet = static_cast(1.) / determinant_getter()(ret); for (unsigned int c = 0; c < 4; ++c) { for (unsigned int r = 0; r < 4; ++r) { - element_getter()(ret, c, r) *= idet; + elem(ret, c, r) *= idet; } } + return ret; } }; diff --git a/generic/include/algebra/algorithms/matrix/inverse/partial_pivot_lud.hpp b/generic/include/algebra/algorithms/matrix/inverse/partial_pivot_lud.hpp index 78f039cc..0e00ccae 100644 --- a/generic/include/algebra/algorithms/matrix/inverse/partial_pivot_lud.hpp +++ b/generic/include/algebra/algorithms/matrix/inverse/partial_pivot_lud.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -16,22 +16,23 @@ namespace algebra::generic::matrix::inverse { /// "Partial Pivot LU Decomposition", assuming a N X N matrix -template +template struct partial_pivot_lud { - using scalar_type = algebra::traits::value_t; - using size_type = algebra::traits::index_t; + using scalar_t = algebra::traits::value_t; + using index_t = algebra::traits::index_t; /// Function (object) used for accessing a matrix element - using element_getter = element_getter_t; + using element_getter_t = algebra::traits::element_getter_t; using decomposition_t = typename algebra::generic::matrix::decomposition::partial_pivot_lud< - matrix_t, element_getter_t>; + matrix_t>; ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(const matrix_t& m) const { - constexpr size_type N{algebra::traits::rank}; + constexpr element_getter_t elem{}; + constexpr index_t N{algebra::traits::rank}; const typename decomposition_t::template lud decomp_res = decomposition_t()(m); @@ -46,24 +47,22 @@ struct partial_pivot_lud { matrix_t inv; // Calculate inv(A) = inv(U) * inv(L) * P; - for (size_type j = 0; j < N; j++) { - for (size_type i = 0; i < N; i++) { - element_getter_t()(inv, i, j) = static_cast(P[i]) == j - ? static_cast(1.0) - : static_cast(0.0); - - for (size_type k = 0; k < i; k++) { - element_getter_t()(inv, i, j) -= - element_getter_t()(lu, i, k) * element_getter_t()(inv, k, j); + for (index_t j = 0; j < N; j++) { + for (index_t i = 0; i < N; i++) { + elem(inv, i, j) = static_cast(P[i]) == j + ? static_cast(1.0) + : static_cast(0.0); + + for (index_t k = 0; k < i; k++) { + elem(inv, i, j) -= elem(lu, i, k) * elem(inv, k, j); } } - for (size_type i = N - 1; int(i) >= 0; i--) { - for (size_type k = i + 1; k < N; k++) { - element_getter_t()(inv, i, j) -= - element_getter_t()(lu, i, k) * element_getter_t()(inv, k, j); + for (index_t i = N - 1; int(i) >= 0; i--) { + for (index_t k = i + 1; k < N; k++) { + elem(inv, i, j) -= elem(lu, i, k) * elem(inv, k, j); } - element_getter_t()(inv, i, j) /= element_getter_t()(lu, i, i); + elem(inv, i, j) /= elem(lu, i, i); } } diff --git a/generic/include/algebra/algorithms/utils/algorithm_selector.hpp b/generic/include/algebra/algorithms/utils/algorithm_selector.hpp index 34c13049..73dcc8ea 100644 --- a/generic/include/algebra/algorithms/utils/algorithm_selector.hpp +++ b/generic/include/algebra/algorithms/utils/algorithm_selector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2022-2024 CERN for the benefit of the ACTS project + * (c) 2022-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -15,7 +15,7 @@ namespace algebra::generic { -/// Get the type of determinant algorithm acording to matrix dimension +/// Get the type of determinant algorithm according to matrix dimension /// @{ // Default algorithm @@ -33,11 +33,10 @@ struct determinant_selector<2, Args...> { /// @tparam M matrix type template using determinant_t = - typename determinant_selector, M, - algebra::traits::element_getter_t>::type; + typename determinant_selector, M>::type; /// @} -/// Get the type of inversion algorithm acording to matrix dimension +/// Get the type of inversion algorithm according to matrix dimension /// @{ template struct inversion_selector { @@ -53,8 +52,7 @@ struct inversion_selector<2, Args...> { /// @tparam M matrix type template using inversion_t = - typename inversion_selector, M, - algebra::traits::element_getter_t>::type; -/// @}generic + typename inversion_selector, M>::type; +/// @} } // namespace algebra::generic diff --git a/generic/include/algebra/impl/generic_transform3.hpp b/generic/include/algebra/impl/generic_transform3.hpp index 3ae4a367..e44d3f12 100644 --- a/generic/include/algebra/impl/generic_transform3.hpp +++ b/generic/include/algebra/impl/generic_transform3.hpp @@ -42,22 +42,16 @@ struct transform3 { using matrix44 = matrix_t; static_assert(concepts::square_matrix); - /// 3-element "vector" type using vector3 = algebra::traits::get_vector_t; - /// Point in 3D space using point3 = vector3; - /// Point in 2D space using point2 = algebra::traits::get_vector_t; - /// Function (object) used for accessing a matrix element + /// Function (object) used for accessing a matrix element/block using element_getter = algebra::traits::element_getter_t; - - /// Function (object) used for accessing a matrix element using block_getter = algebra::traits::block_getter_t; /// Matrix inversion algorithm - using matrix_inversion = - generic::matrix::inverse::hard_coded; + using matrix_inversion = generic::matrix::inverse::hard_coded; /// Helper type to cast this to another floating point precision template diff --git a/frontend/CMakeLists.txt b/plugins/CMakeLists.txt similarity index 87% rename from frontend/CMakeLists.txt rename to plugins/CMakeLists.txt index 3bda3efd..db18406b 100644 --- a/frontend/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -5,7 +5,9 @@ # Mozilla Public License Version 2.0 # Set up all enabled libraries. -add_subdirectory(array) +if(ALGEBRA_PLUGINS_INCLUDE_ARRAY) + add_subdirectory(array) +endif() if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) add_subdirectory(eigen) diff --git a/frontend/array/CMakeLists.txt b/plugins/array/CMakeLists.txt similarity index 100% rename from frontend/array/CMakeLists.txt rename to plugins/array/CMakeLists.txt diff --git a/frontend/array/include/algebra/array.hpp b/plugins/array/include/algebra/array.hpp similarity index 77% rename from frontend/array/include/algebra/array.hpp rename to plugins/array/include/algebra/array.hpp index d5a0cb43..037503ab 100644 --- a/frontend/array/include/algebra/array.hpp +++ b/plugins/array/include/algebra/array.hpp @@ -21,9 +21,9 @@ namespace algebra { /// @name Operators on @c algebra::array::storage_type /// @{ -using algebra::cmath::operator*; -using algebra::cmath::operator-; -using algebra::cmath::operator+; +using algebra::array::operator*; +using algebra::array::operator-; +using algebra::array::operator+; /// @} @@ -32,10 +32,10 @@ namespace getter { /// @name Getter functions on @c algebra::array::storage_type /// @{ -using cmath::storage::block; -using cmath::storage::element; -using cmath::storage::set_block; -using cmath::storage::vector; +using array::storage::block; +using array::storage::element; +using array::storage::set_block; +using array::storage::vector; /// @} @@ -47,16 +47,16 @@ namespace vector { /// @{ // array specific implementations -using cmath::dot; -using cmath::normalize; +using array::dot; +using array::normalize; // generic implementations -using cmath::cross; -using cmath::eta; -using cmath::norm; -using cmath::perp; -using cmath::phi; -using cmath::theta; +using array::cross; +using array::eta; +using array::norm; +using array::perp; +using array::phi; +using array::theta; /// @} @@ -70,16 +70,14 @@ template struct determinant_selector<4, array::matrix_type, array::element_getter> { using type = - matrix::determinant::hard_coded, - array::element_getter>; + matrix::determinant::hard_coded>; }; // Inversion algorithms template struct inversion_selector<4, array::matrix_type, array::element_getter> { - using type = matrix::inverse::hard_coded, - array::element_getter>; + using type = matrix::inverse::hard_coded>; }; } // namespace generic @@ -89,15 +87,15 @@ namespace matrix { /// @name Matrix functions on @c algebra::array::storage_type /// @{ -using cmath::identity; -using cmath::set_identity; -using cmath::set_zero; -using cmath::zero; +using array::identity; +using array::set_identity; +using array::set_zero; +using array::zero; // Uses generic implementation in the background -using cmath::determinant; -using cmath::inverse; -using cmath::transpose; +using array::determinant; +using array::inverse; +using array::transpose; using generic::math::set_inplace_product_left; using generic::math::set_inplace_product_left_transpose; @@ -114,12 +112,12 @@ using generic::math::transposed_product; namespace array { -/// @name cmath based transforms on @c algebra::array +/// @name array based transforms on @c algebra::array /// @{ template using transform3 = - generic::math::transform3; /// @} @@ -140,7 +138,7 @@ struct array { using boolean = bool; using scalar = value_type; - using size_type = algebra::array::size_type; + using index_type = algebra::array::index_type; using transform3D = algebra::array::transform3; using point2D = algebra::array::point2; using point3D = algebra::array::point3; diff --git a/frontend/array/include/algebra/impl/array_getter.hpp b/plugins/array/include/algebra/impl/array_getter.hpp similarity index 99% rename from frontend/array/include/algebra/impl/array_getter.hpp rename to plugins/array/include/algebra/impl/array_getter.hpp index 28eabde0..d36134b5 100644 --- a/frontend/array/include/algebra/impl/array_getter.hpp +++ b/plugins/array/include/algebra/impl/array_getter.hpp @@ -17,7 +17,7 @@ #include #include -namespace algebra::cmath::storage { +namespace algebra::array::storage { /// "Element getter", assuming a simple 2D array access struct element_getter { @@ -236,4 +236,4 @@ ALGEBRA_HOST_DEVICE constexpr void set_block(input_matrix_type &m, } } -} // namespace algebra::cmath::storage +} // namespace algebra::array::storage diff --git a/frontend/array/include/algebra/impl/array_matrix.hpp b/plugins/array/include/algebra/impl/array_matrix.hpp similarity index 97% rename from frontend/array/include/algebra/impl/array_matrix.hpp rename to plugins/array/include/algebra/impl/array_matrix.hpp index 266d61e0..d0473661 100644 --- a/frontend/array/include/algebra/impl/array_matrix.hpp +++ b/plugins/array/include/algebra/impl/array_matrix.hpp @@ -13,7 +13,7 @@ #include "algebra/math.hpp" #include "algebra/qualifiers.hpp" -namespace algebra::cmath { +namespace algebra::array { /// @returns zero matrix of type @tparam matrix_t template @@ -83,4 +83,4 @@ ALGEBRA_HOST_DEVICE constexpr auto inverse( return algebra::generic::math::inverse(m); } -} // namespace algebra::cmath +} // namespace algebra::array diff --git a/frontend/array/include/algebra/impl/array_operators.hpp b/plugins/array/include/algebra/impl/array_operators.hpp similarity index 76% rename from frontend/array/include/algebra/impl/array_operators.hpp rename to plugins/array/include/algebra/impl/array_operators.hpp index 15c5fc3f..7e9206a0 100644 --- a/frontend/array/include/algebra/impl/array_operators.hpp +++ b/plugins/array/include/algebra/impl/array_operators.hpp @@ -15,7 +15,7 @@ #include #include -namespace algebra::cmath { +namespace algebra::array { /// @name Operators on 2-element arrays /// @{ @@ -96,16 +96,16 @@ ALGEBRA_HOST_DEVICE constexpr array_t operator+( /// @name Operators on matrix /// @{ -template class array_t, - concepts::scalar scalar1_t, concepts::scalar scalar2_t, - size_type ROWS, size_type COLS> +template class array_t, + concepts::scalar scalar1_t, concepts::scalar scalar2_t, index_t ROWS, + index_t COLS> ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator*( const array_t, COLS> &a, scalar2_t s) { array_t, COLS> ret; - for (size_type j = 0; j < COLS; ++j) { - for (size_type i = 0; i < ROWS; ++i) { + for (index_t j = 0; j < COLS; ++j) { + for (index_t i = 0; i < ROWS; ++i) { ret[j][i] = a[j][i] * static_cast(s); } } @@ -113,16 +113,16 @@ ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator*( return ret; } -template class array_t, - concepts::scalar scalar1_t, concepts::scalar scalar2_t, - size_type ROWS, size_type COLS> +template class array_t, + concepts::scalar scalar1_t, concepts::scalar scalar2_t, index_t ROWS, + index_t COLS> ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator*( scalar2_t s, const array_t, COLS> &a) { array_t, COLS> ret; - for (size_type j = 0; j < COLS; ++j) { - for (size_type i = 0; i < ROWS; ++i) { + for (index_t j = 0; j < COLS; ++j) { + for (index_t i = 0; i < ROWS; ++i) { ret[j][i] = a[j][i] * static_cast(s); } } @@ -130,23 +130,23 @@ ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator*( return ret; } -template class array_t, - concepts::scalar scalar_t, size_type M, size_type N, size_type O> +template class array_t, + concepts::scalar scalar_t, index_t M, index_t N, index_t O> ALGEBRA_HOST_DEVICE constexpr array_t, O> operator*( const array_t, N> &A, const array_t, O> &B) { array_t, O> C; - for (size_type j = 0; j < O; ++j) { - for (size_type i = 0; i < M; ++i) { + for (index_t j = 0; j < O; ++j) { + for (index_t i = 0; i < M; ++i) { C[j][i] = 0.f; } } - for (size_type i = 0; i < N; ++i) { - for (size_type j = 0; j < O; ++j) { - for (size_type k = 0; k < M; ++k) { + for (index_t i = 0; i < N; ++i) { + for (index_t j = 0; j < O; ++j) { + for (index_t k = 0; k < M; ++k) { C[j][k] += A[i][k] * B[j][i]; } } @@ -155,16 +155,16 @@ ALGEBRA_HOST_DEVICE constexpr array_t, O> operator*( return C; } -template class array_t, - concepts::scalar scalar_t, size_type ROWS, size_type COLS> +template class array_t, + concepts::scalar scalar_t, index_t ROWS, index_t COLS> ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator+( const array_t, COLS> &A, const array_t, COLS> &B) { array_t, COLS> C; - for (size_type j = 0; j < COLS; ++j) { - for (size_type i = 0; i < ROWS; ++i) { + for (index_t j = 0; j < COLS; ++j) { + for (index_t i = 0; i < ROWS; ++i) { C[j][i] = A[j][i] + B[j][i]; } } @@ -172,16 +172,16 @@ ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator+( return C; } -template class array_t, - concepts::scalar scalar_t, size_type ROWS, size_type COLS> +template class array_t, + concepts::scalar scalar_t, index_t ROWS, index_t COLS> ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator-( const array_t, COLS> &A, const array_t, COLS> &B) { array_t, COLS> C; - for (size_type j = 0; j < COLS; ++j) { - for (size_type i = 0; i < ROWS; ++i) { + for (index_t j = 0; j < COLS; ++j) { + for (index_t i = 0; i < ROWS; ++i) { C[j][i] = A[j][i] - B[j][i]; } } @@ -194,16 +194,16 @@ ALGEBRA_HOST_DEVICE constexpr array_t, COLS> operator-( /// @name Operators on matrix * vector /// @{ -template class array_t, - concepts::scalar scalar_t, size_type ROWS, size_type COLS> +template class array_t, + concepts::scalar scalar_t, index_t ROWS, index_t COLS> ALGEBRA_HOST_DEVICE constexpr array_t operator*( const array_t, COLS> &a, const array_t &b) { array_t ret{0}; - for (size_type j = 0; j < COLS; ++j) { - for (size_type i = 0; i < ROWS; ++i) { + for (index_t j = 0; j < COLS; ++j) { + for (index_t i = 0; i < ROWS; ++i) { ret[i] += a[j][i] * b[j]; } } @@ -213,4 +213,4 @@ ALGEBRA_HOST_DEVICE constexpr array_t operator*( /// @} -} // namespace algebra::cmath +} // namespace algebra::array diff --git a/frontend/array/include/algebra/impl/array_types.hpp b/plugins/array/include/algebra/impl/array_types.hpp similarity index 86% rename from frontend/array/include/algebra/impl/array_types.hpp rename to plugins/array/include/algebra/impl/array_types.hpp index b6542c21..74d1f408 100644 --- a/frontend/array/include/algebra/impl/array_types.hpp +++ b/plugins/array/include/algebra/impl/array_types.hpp @@ -21,7 +21,7 @@ namespace algebra { namespace array { /// size type for Array storage model -using size_type = std::size_t; +using index_type = std::size_t; /// Value type for Array storage model template using value_type = T; @@ -29,13 +29,13 @@ using value_type = T; template using scalar_type = T; /// Array type used in the Array storage model -template +template using storage_type = std::array; /// Vector type used in the Array storage model template using vector_type = storage_type; /// Matrix type used in the Array storage model -template +template using matrix_type = storage_type, COLS>; /// 3-element "vector" type, using @c std::array @@ -52,9 +52,9 @@ template using point2 = vector2; /// Element Getter -using element_getter = cmath::storage::element_getter; +using element_getter = array::storage::element_getter; /// Block Getter -using block_getter = cmath::storage::block_getter; +using block_getter = array::storage::block_getter; } // namespace array diff --git a/frontend/array/include/algebra/impl/array_vector.hpp b/plugins/array/include/algebra/impl/array_vector.hpp similarity index 63% rename from frontend/array/include/algebra/impl/array_vector.hpp rename to plugins/array/include/algebra/impl/array_vector.hpp index d298951f..c31b803f 100644 --- a/frontend/array/include/algebra/impl/array_vector.hpp +++ b/plugins/array/include/algebra/impl/array_vector.hpp @@ -10,17 +10,17 @@ // Project include(s). #include "algebra/concepts.hpp" #include "algebra/generic.hpp" +#include "algebra/impl/array_operators.hpp" #include "algebra/math.hpp" #include "algebra/qualifiers.hpp" -namespace algebra::cmath { +namespace algebra::array { /// This method retrieves phi from a vector with rows >= 2 /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 2) ALGEBRA_HOST_DEVICE constexpr scalar_t phi(const array_t &v) { return algebra::generic::math::phi(v); @@ -29,9 +29,8 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t phi(const array_t &v) { /// This method retrieves the perpendicular magnitude of a vector with rows >= 2 /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 2) ALGEBRA_HOST_DEVICE constexpr scalar_t perp(const array_t &v) { return algebra::generic::math::perp(v); @@ -40,9 +39,8 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t perp(const array_t &v) { /// This method retrieves theta from a vector with rows >= 3 /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 2) ALGEBRA_HOST_DEVICE constexpr scalar_t theta(const array_t &v) { return algebra::generic::math::theta(v); @@ -50,7 +48,7 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t theta(const array_t &v) { /// Cross product between two input vectors - 3 Dim /// -/// @tparam size_type the index type for this plugin +/// @tparam index_t the index type for this plugin /// @tparam array_t the array type the plugin is based on /// @tparam scalar_t the scalar type /// @tparam N the dimension of the vectors (minimum 3) @@ -60,36 +58,32 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t theta(const array_t &v) { /// /// @return a vector representing the cross product /// @{ -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 3) ALGEBRA_HOST_DEVICE constexpr array_t cross( const array_t &a, const array_t &b) { return algebra::generic::math::cross(a, b); } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 3) ALGEBRA_HOST_DEVICE constexpr array_t cross( const array_t &a, const array_t, 1> &b) { return algebra::generic::math::cross(a, b); } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 3) ALGEBRA_HOST_DEVICE constexpr array_t cross( const array_t, 1> &a, const array_t &b) { return algebra::generic::math::cross(a, b); } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 3) ALGEBRA_HOST_DEVICE constexpr array_t cross( const array_t, 1> &a, @@ -105,66 +99,62 @@ ALGEBRA_HOST_DEVICE constexpr array_t cross( /// /// @return the scalar dot product value /// @{ -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> ALGEBRA_HOST_DEVICE constexpr scalar_t dot(const array_t &a, const array_t &b) { array_t tmp; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { tmp[i] = a[i] * b[i]; } scalar_t ret{0.f}; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { ret += tmp[i]; } return ret; } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> ALGEBRA_HOST_DEVICE constexpr scalar_t dot( const array_t &a, const array_t, 1> &b) { array_t tmp; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { tmp[i] = a[i] * b[0][i]; } scalar_t ret{0.f}; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { ret += tmp[i]; } return ret; } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> ALGEBRA_HOST_DEVICE constexpr scalar_t dot( const array_t, 1> &a, const array_t &b) { array_t tmp; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { tmp[i] = a[0][i] * b[i]; } scalar_t ret{0.f}; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { ret += tmp[i]; } return ret; } -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> ALGEBRA_HOST_DEVICE constexpr scalar_t dot( const array_t, 1> &a, const array_t, 1> &b) { array_t tmp; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { tmp[i] = a[0][i] * b[0][i]; } scalar_t ret{0.f}; - for (size_type i = 0; i < N; i++) { + for (index_t i = 0; i < N; i++) { ret += tmp[i]; } return ret; @@ -174,9 +164,8 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t dot( /// This method retrieves the norm of a vector, no dimension restriction /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 2) ALGEBRA_HOST_DEVICE constexpr scalar_t norm(const array_t &v) { @@ -187,9 +176,8 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t norm(const array_t &v) { /// rows >= 3 /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> requires(N >= 3) ALGEBRA_HOST_DEVICE constexpr scalar_t eta( const array_t &v) noexcept { @@ -200,13 +188,12 @@ ALGEBRA_HOST_DEVICE constexpr scalar_t eta( /// Get a normalized version of the input vector /// /// @param v the input vector -template class array_t, - concepts::scalar scalar_t, size_type N> +template class array_t, + concepts::scalar scalar_t, index_t N> ALGEBRA_HOST_DEVICE constexpr array_t normalize( const array_t &v) { return (static_cast(1.) / norm(v)) * v; } -} // namespace algebra::cmath +} // namespace algebra::array diff --git a/frontend/eigen/CMakeLists.txt b/plugins/eigen/CMakeLists.txt similarity index 92% rename from frontend/eigen/CMakeLists.txt rename to plugins/eigen/CMakeLists.txt index bf48e5da..28bf013b 100644 --- a/frontend/eigen/CMakeLists.txt +++ b/plugins/eigen/CMakeLists.txt @@ -10,6 +10,7 @@ message(STATUS "Building the Eigen3 algebra plugin") algebra_add_library( algebra_eigen eigen "include/algebra/eigen.hpp" "include/algebra/impl/*.hpp" + "include/algebra/impl/detail/*.hpp" ) target_link_libraries( diff --git a/frontend/eigen/include/algebra/eigen.hpp b/plugins/eigen/include/algebra/eigen.hpp similarity index 98% rename from frontend/eigen/include/algebra/eigen.hpp rename to plugins/eigen/include/algebra/eigen.hpp index f58eb379..5de06a0d 100644 --- a/frontend/eigen/include/algebra/eigen.hpp +++ b/plugins/eigen/include/algebra/eigen.hpp @@ -105,7 +105,7 @@ struct eigen { using boolean = bool; using scalar = value_type; - using size_type = algebra::eigen::size_type; + using index_type = algebra::eigen::index_type; using transform3D = algebra::eigen::transform3; using point2D = algebra::eigen::point2; using point3D = algebra::eigen::point3; diff --git a/frontend/eigen/include/algebra/impl/eigen_array.hpp b/plugins/eigen/include/algebra/impl/detail/eigen_array.hpp similarity index 100% rename from frontend/eigen/include/algebra/impl/eigen_array.hpp rename to plugins/eigen/include/algebra/impl/detail/eigen_array.hpp diff --git a/frontend/eigen/include/algebra/impl/eigen_getter.hpp b/plugins/eigen/include/algebra/impl/eigen_getter.hpp similarity index 80% rename from frontend/eigen/include/algebra/impl/eigen_getter.hpp rename to plugins/eigen/include/algebra/impl/eigen_getter.hpp index 4958d11f..5fe1c3c5 100644 --- a/frontend/eigen/include/algebra/impl/eigen_getter.hpp +++ b/plugins/eigen/include/algebra/impl/eigen_getter.hpp @@ -36,40 +36,39 @@ namespace algebra::eigen::storage { /// Functor used to access elements of Eigen matrices struct element_getter { /// Get non-const access to a matrix element - template + template requires std::is_base_of_v< Eigen::DenseCoeffsBase, Eigen::MatrixBase > ALGEBRA_HOST_DEVICE constexpr auto &operator()( - Eigen::MatrixBase &m, size_type_1 row, - size_type_2 col) const { + Eigen::MatrixBase &m, index_t_1 row, index_t_2 col) const { return m(static_cast(row), static_cast(col)); } /// Get const access to a matrix element - template + template ALGEBRA_HOST_DEVICE constexpr auto operator()( - const Eigen::MatrixBase &m, size_type_1 row, - size_type_2 col) const { + const Eigen::MatrixBase &m, index_t_1 row, + index_t_2 col) const { return m(static_cast(row), static_cast(col)); } /// Get non-const access to a matrix element - template + template requires std::is_base_of_v< Eigen::DenseCoeffsBase, Eigen::MatrixBase > ALGEBRA_HOST_DEVICE constexpr auto &operator()( - Eigen::MatrixBase &m, size_type row) const { + Eigen::MatrixBase &m, index_t row) const { return m(static_cast(row)); } /// Get const access to a matrix element - template + template ALGEBRA_HOST_DEVICE constexpr auto operator()( - const Eigen::MatrixBase &m, size_type row) const { + const Eigen::MatrixBase &m, index_t row) const { return m(static_cast(row)); } @@ -120,37 +119,36 @@ ALGEBRA_HOST_DEVICE constexpr decltype(auto) element( struct block_getter { template + concepts::index index_t_1, concepts::index index_t_2> ALGEBRA_HOST_DEVICE decltype(auto) operator()( - const Eigen::MatrixBase &m, size_type_1 row, - size_type_2 col) const { + const Eigen::MatrixBase &m, index_t_1 row, + index_t_2 col) const { return m.template block(row, col); } template + concepts::index index_t_1, concepts::index index_t_2> ALGEBRA_HOST_DEVICE decltype(auto) operator()( - Eigen::MatrixBase &m, size_type_1 row, - size_type_2 col) const { + Eigen::MatrixBase &m, index_t_1 row, index_t_2 col) const { return m.template block(row, col); } - template + template ALGEBRA_HOST_DEVICE decltype(auto) vector(Eigen::MatrixBase &m, - size_type_1 row, - size_type_2 col) const { + index_t_1 row, + index_t_2 col) const { return m.template block(row, col); } - template + template ALGEBRA_HOST_DEVICE decltype(auto) vector( - const Eigen::MatrixBase &m, size_type_1 row, - size_type_2 col) const { + const Eigen::MatrixBase &m, index_t_1 row, + index_t_2 col) const { return m.template block(row, col); } diff --git a/frontend/eigen/include/algebra/impl/eigen_matrix.hpp b/plugins/eigen/include/algebra/impl/eigen_matrix.hpp similarity index 100% rename from frontend/eigen/include/algebra/impl/eigen_matrix.hpp rename to plugins/eigen/include/algebra/impl/eigen_matrix.hpp diff --git a/frontend/eigen/include/algebra/impl/eigen_transform3.hpp b/plugins/eigen/include/algebra/impl/eigen_transform3.hpp similarity index 99% rename from frontend/eigen/include/algebra/impl/eigen_transform3.hpp rename to plugins/eigen/include/algebra/impl/eigen_transform3.hpp index 79858fb1..a6314e56 100644 --- a/frontend/eigen/include/algebra/impl/eigen_transform3.hpp +++ b/plugins/eigen/include/algebra/impl/eigen_transform3.hpp @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/impl/eigen_array.hpp" +#include "algebra/impl/detail/eigen_array.hpp" #include "algebra/qualifiers.hpp" #include "algebra/utils/approximately_equal.hpp" diff --git a/frontend/eigen/include/algebra/impl/eigen_types.hpp b/plugins/eigen/include/algebra/impl/eigen_types.hpp similarity index 88% rename from frontend/eigen/include/algebra/impl/eigen_types.hpp rename to plugins/eigen/include/algebra/impl/eigen_types.hpp index 1de2da1f..74e27cc5 100644 --- a/frontend/eigen/include/algebra/impl/eigen_types.hpp +++ b/plugins/eigen/include/algebra/impl/eigen_types.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/impl/eigen_array.hpp" +#include "algebra/impl/detail/eigen_array.hpp" #include "algebra/impl/eigen_getter.hpp" #include "algebra/type_traits.hpp" @@ -21,7 +21,7 @@ namespace algebra { namespace eigen { /// size type for Eigen storage model -using size_type = int; +using index_type = int; /// Value type for Eigen storage model template using value_type = T; @@ -29,14 +29,14 @@ using value_type = T; template using scalar_type = T; /// Array type used in the Eigen storage model -template +template using storage_type = array; /// Vector type used in the Eigen storage model -template +template using vector_type = storage_type; /// Matrix type used in the Eigen storage model /// If the number of rows is 1, make it RowMajor -template +template using matrix_type = Eigen::Matrix; /// 3-element "vector" type, using @c eigen::vector_type @@ -68,13 +68,13 @@ namespace traits { /// @{ template struct index> { - using type = algebra::eigen::size_type; + using type = algebra::eigen::index_type; }; template struct index, bROWS, bCOLS, false>> { - using type = algebra::eigen::size_type; + using type = algebra::eigen::index_type; }; /// @} @@ -83,12 +83,12 @@ struct index, bROWS, template struct dimensions> { - using size_type = index_t>; + using index_type = index_t>; - static constexpr size_type dim{2}; - static constexpr size_type rows{ + static constexpr index_type _dim{2}; + static constexpr index_type _rows{ Eigen::MatrixBase::RowsAtCompileTime}; - static constexpr size_type columns{ + static constexpr index_type _columns{ Eigen::MatrixBase::ColsAtCompileTime}; }; @@ -96,13 +96,13 @@ template struct dimensions, bROWS, bCOLS, false>> { - using size_type = + using index_type = index_t, bROWS, bCOLS, false>>; - static constexpr size_type dim{2}; - static constexpr size_type rows{bROWS}; - static constexpr size_type columns{bCOLS}; + static constexpr index_type _dim{2}; + static constexpr index_type _rows{bROWS}; + static constexpr index_type _columns{bCOLS}; }; /// @} diff --git a/frontend/eigen/include/algebra/impl/eigen_vector.hpp b/plugins/eigen/include/algebra/impl/eigen_vector.hpp similarity index 100% rename from frontend/eigen/include/algebra/impl/eigen_vector.hpp rename to plugins/eigen/include/algebra/impl/eigen_vector.hpp diff --git a/frontend/fastor/CMakeLists.txt b/plugins/fastor/CMakeLists.txt similarity index 93% rename from frontend/fastor/CMakeLists.txt rename to plugins/fastor/CMakeLists.txt index 05c79447..1ef00ca7 100644 --- a/frontend/fastor/CMakeLists.txt +++ b/plugins/fastor/CMakeLists.txt @@ -10,6 +10,7 @@ message(STATUS "Building the Fastor algebra plugin") algebra_add_library( algebra_fastor fastor "include/algebra/fastor.hpp" "include/algebra/impl/*.hpp" + "include/algebra/impl/detail/*.hpp" ) target_link_libraries( diff --git a/frontend/fastor/include/algebra/fastor.hpp b/plugins/fastor/include/algebra/fastor.hpp similarity index 98% rename from frontend/fastor/include/algebra/fastor.hpp rename to plugins/fastor/include/algebra/fastor.hpp index 7aac87cf..6a5a6940 100644 --- a/frontend/fastor/include/algebra/fastor.hpp +++ b/plugins/fastor/include/algebra/fastor.hpp @@ -111,7 +111,7 @@ struct fastor { using boolean = bool; using scalar = value_type; - using size_type = algebra::fastor::size_type; + using index_type = algebra::fastor::index_type; using transform3D = algebra::fastor::transform3; using point2D = algebra::fastor::point2; using point3D = algebra::fastor::point3; diff --git a/frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp b/plugins/fastor/include/algebra/impl/detail/fastor_matrix_wrapper.hpp similarity index 63% rename from frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp rename to plugins/fastor/include/algebra/impl/detail/fastor_matrix_wrapper.hpp index 783d9afc..1b0ef273 100644 --- a/frontend/fastor/include/algebra/impl/fastor_matrix_wrapper.hpp +++ b/plugins/fastor/include/algebra/impl/detail/fastor_matrix_wrapper.hpp @@ -24,7 +24,7 @@ namespace algebra::fastor { -/// Fastor Matrix type +/// @brief Fastor Matrix type /// /// This class is needed because Fastor differentiates between normal /// matrix-matrix multiplication and element-wise matrix-matrix multiplication. @@ -46,6 +46,7 @@ class Matrix : public Fastor::Tensor { /// Inherit all constructors from the base class using Fastor::Tensor::Tensor; + private: /// When we encounter an `operator*` function call between Matrix objects, we /// will catch it and handle it correctly by invoking `Fastor::matmul()`. /// @@ -56,30 +57,30 @@ class Matrix : public Fastor::Tensor { /// /// The `static_cast` is there to signal both to the compiler and the reader /// that we wish to interpret the `Matrix` object as a `Fastor::Tensor` here. - template - constexpr Matrix operator*(const Matrix& other) const { - return Fastor::matmul(static_cast>(*this), - static_cast>(other)); - } + /// @{ + template + constexpr friend Matrix operator*(const Matrix& lhs, + const Matrix& rhs); - /// When we encounter an `operator*` function call between a Matrix object and - /// a `Fastor::Tensor` with one dimensional parameter (i.e. a vector), we will - /// catch it and handle it correctly by invoking `Fastor::matmul()`. - /// - /// The data type contained in the `other` has a separate template parameter - /// dedicated to it because in certain cases, we might want to multiply say, a - /// float matrix with a double vector and not have it produce a compilation - /// error. - /// - /// The `static_cast` is there to signal both to the compiler and the reader - /// that we wish to interpret the `Matrix` object as a `Fastor::Tensor` here. - template - constexpr Fastor::Tensor operator*( - const Fastor::Tensor& other) const { - return Fastor::matmul(static_cast>(*this), - static_cast>(other)); - } + template + constexpr friend Fastor::Tensor operator*( + const Matrix& lhs, const Fastor::Tensor& vector); + /// @} }; // class Matrix +template +constexpr Matrix operator*(const Matrix& lhs, + const Matrix& rhs) { + return Fastor::matmul(static_cast>(lhs), + static_cast>(rhs)); +} + +template +constexpr Fastor::Tensor operator*(const Matrix& lhs, + const Fastor::Tensor& vector) { + return Fastor::matmul(static_cast>(lhs), + static_cast>(vector)); +} + } // namespace algebra::fastor diff --git a/frontend/fastor/include/algebra/impl/fastor_getter.hpp b/plugins/fastor/include/algebra/impl/fastor_getter.hpp similarity index 99% rename from frontend/fastor/include/algebra/impl/fastor_getter.hpp rename to plugins/fastor/include/algebra/impl/fastor_getter.hpp index a6d76bab..e7f99a6f 100644 --- a/frontend/fastor/include/algebra/impl/fastor_getter.hpp +++ b/plugins/fastor/include/algebra/impl/fastor_getter.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/concepts.hpp" -#include "algebra/impl/fastor_matrix_wrapper.hpp" +#include "algebra/impl/detail/fastor_matrix_wrapper.hpp" #include "algebra/math.hpp" #include "algebra/qualifiers.hpp" diff --git a/frontend/fastor/include/algebra/impl/fastor_matrix.hpp b/plugins/fastor/include/algebra/impl/fastor_matrix.hpp similarity index 100% rename from frontend/fastor/include/algebra/impl/fastor_matrix.hpp rename to plugins/fastor/include/algebra/impl/fastor_matrix.hpp diff --git a/frontend/fastor/include/algebra/impl/fastor_transform3.hpp b/plugins/fastor/include/algebra/impl/fastor_transform3.hpp similarity index 100% rename from frontend/fastor/include/algebra/impl/fastor_transform3.hpp rename to plugins/fastor/include/algebra/impl/fastor_transform3.hpp diff --git a/frontend/fastor/include/algebra/impl/fastor_types.hpp b/plugins/fastor/include/algebra/impl/fastor_types.hpp similarity index 86% rename from frontend/fastor/include/algebra/impl/fastor_types.hpp rename to plugins/fastor/include/algebra/impl/fastor_types.hpp index 674e6f7e..b5856d9d 100644 --- a/frontend/fastor/include/algebra/impl/fastor_types.hpp +++ b/plugins/fastor/include/algebra/impl/fastor_types.hpp @@ -9,8 +9,8 @@ // Project include(s). #include "algebra/concepts.hpp" +#include "algebra/impl/detail/fastor_matrix_wrapper.hpp" #include "algebra/impl/fastor_getter.hpp" -#include "algebra/impl/fastor_matrix_wrapper.hpp" #include "algebra/type_traits.hpp" // System include(s). @@ -21,7 +21,7 @@ namespace algebra { namespace fastor { /// size type for Fastor storage model -using size_type = std::size_t; +using index_type = std::size_t; /// Value type for Fastor storage model template using value_type = T; @@ -29,13 +29,13 @@ using value_type = T; template using scalar_type = T; /// Array type used in the Fastor storage model -template +template using storage_type = Fastor::Tensor; /// Vector type used in the Fastor storage model -template +template using vector_type = storage_type; /// Matrix type used in the Fastor storage model -template +template using matrix_type = algebra::fastor::Matrix; /// 3-element "vector" type, using @c Fastor::Tensor diff --git a/frontend/fastor/include/algebra/impl/fastor_vector.hpp b/plugins/fastor/include/algebra/impl/fastor_vector.hpp similarity index 100% rename from frontend/fastor/include/algebra/impl/fastor_vector.hpp rename to plugins/fastor/include/algebra/impl/fastor_vector.hpp diff --git a/frontend/smatrix/CMakeLists.txt b/plugins/smatrix/CMakeLists.txt similarity index 85% rename from frontend/smatrix/CMakeLists.txt rename to plugins/smatrix/CMakeLists.txt index 63df4dd9..65efa240 100644 --- a/frontend/smatrix/CMakeLists.txt +++ b/plugins/smatrix/CMakeLists.txt @@ -6,10 +6,13 @@ message(STATUS "Building the SMatrix algebra plugin") +find_package(ROOT COMPONENTS Core MathCore Smatrix REQUIRED) + # Set up the library. algebra_add_library( algebra_smatrix smatrix "include/algebra/smatrix.hpp" "include/algebra/impl/*.hpp" + "include/algebra/impl/detail/*.hpp" ) target_link_libraries( diff --git a/frontend/smatrix/include/algebra/impl/smatrix_errorcheck.hpp b/plugins/smatrix/include/algebra/impl/detail/smatrix_errorcheck.hpp similarity index 100% rename from frontend/smatrix/include/algebra/impl/smatrix_errorcheck.hpp rename to plugins/smatrix/include/algebra/impl/detail/smatrix_errorcheck.hpp diff --git a/frontend/smatrix/include/algebra/impl/smatrix_getter.hpp b/plugins/smatrix/include/algebra/impl/smatrix_getter.hpp similarity index 100% rename from frontend/smatrix/include/algebra/impl/smatrix_getter.hpp rename to plugins/smatrix/include/algebra/impl/smatrix_getter.hpp diff --git a/frontend/smatrix/include/algebra/impl/smatrix_matrix.hpp b/plugins/smatrix/include/algebra/impl/smatrix_matrix.hpp similarity index 100% rename from frontend/smatrix/include/algebra/impl/smatrix_matrix.hpp rename to plugins/smatrix/include/algebra/impl/smatrix_matrix.hpp diff --git a/frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp b/plugins/smatrix/include/algebra/impl/smatrix_transform3.hpp similarity index 99% rename from frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp rename to plugins/smatrix/include/algebra/impl/smatrix_transform3.hpp index 29290e41..65a77405 100644 --- a/frontend/smatrix/include/algebra/impl/smatrix_transform3.hpp +++ b/plugins/smatrix/include/algebra/impl/smatrix_transform3.hpp @@ -8,7 +8,7 @@ #pragma once // Project include(s). -#include "algebra/impl/smatrix_errorcheck.hpp" +#include "algebra/impl/detail/smatrix_errorcheck.hpp" #include "algebra/qualifiers.hpp" #include "algebra/utils/approximately_equal.hpp" diff --git a/frontend/smatrix/include/algebra/impl/smatrix_types.hpp b/plugins/smatrix/include/algebra/impl/smatrix_types.hpp similarity index 90% rename from frontend/smatrix/include/algebra/impl/smatrix_types.hpp rename to plugins/smatrix/include/algebra/impl/smatrix_types.hpp index 457e6513..d0f245b7 100644 --- a/frontend/smatrix/include/algebra/impl/smatrix_types.hpp +++ b/plugins/smatrix/include/algebra/impl/smatrix_types.hpp @@ -24,7 +24,7 @@ namespace algebra { namespace smatrix { /// size type for SMatrix storage model -using size_type = unsigned int; +using index_type = unsigned int; /// Value type for SMatrix storage model template using value_type = T; @@ -32,13 +32,13 @@ using value_type = T; template using scalar_type = T; /// Array type used in the SMatrix storage model -template +template using storage_type = ROOT::Math::SVector; /// Vector type used in the SMatrix storage model -template +template using vector_type = storage_type; /// Matrix type used in the SMatrix storage model -template +template using matrix_type = ROOT::Math::SMatrix; /// 3-element "vector" type, using @c ROOT::Math::SVector diff --git a/frontend/smatrix/include/algebra/impl/smatrix_vector.hpp b/plugins/smatrix/include/algebra/impl/smatrix_vector.hpp similarity index 100% rename from frontend/smatrix/include/algebra/impl/smatrix_vector.hpp rename to plugins/smatrix/include/algebra/impl/smatrix_vector.hpp diff --git a/frontend/smatrix/include/algebra/smatrix.hpp b/plugins/smatrix/include/algebra/smatrix.hpp similarity index 96% rename from frontend/smatrix/include/algebra/smatrix.hpp rename to plugins/smatrix/include/algebra/smatrix.hpp index 1e5c0fad..d5fd1c2e 100644 --- a/frontend/smatrix/include/algebra/smatrix.hpp +++ b/plugins/smatrix/include/algebra/smatrix.hpp @@ -12,7 +12,7 @@ #include "algebra/generic.hpp" #include "algebra/impl/smatrix_getter.hpp" #include "algebra/impl/smatrix_matrix.hpp" -#include "algebra/impl/smatrix_transform.hpp" +#include "algebra/impl/smatrix_transform3.hpp" #include "algebra/impl/smatrix_types.hpp" #include "algebra/impl/smatrix_vector.hpp" @@ -102,7 +102,7 @@ struct smatrix { using boolean = bool; using scalar = value_type; - using size_type = algebra::smatrix::size_type; + using index_type = algebra::smatrix::index_type; using transform3D = algebra::smatrix::transform3; using point2D = algebra::smatrix::point2; using point3D = algebra::smatrix::point3; diff --git a/frontend/vc_aos/CMakeLists.txt b/plugins/vc_aos/CMakeLists.txt similarity index 100% rename from frontend/vc_aos/CMakeLists.txt rename to plugins/vc_aos/CMakeLists.txt diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_approximately_equal.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_approximately_equal.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_approximately_equal.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_approximately_equal.hpp diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_concepts.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_concepts.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_concepts.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_concepts.hpp diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_getter.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_getter.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_getter.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_getter.hpp diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_matrix.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_matrix.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_matrix.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_matrix.hpp diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_transform3.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_transform3.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_transform3.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_transform3.hpp diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_types.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_types.hpp similarity index 85% rename from frontend/vc_aos/include/algebra/impl/vc_aos_types.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_types.hpp index e75c8324..85114a7b 100644 --- a/frontend/vc_aos/include/algebra/impl/vc_aos_types.hpp +++ b/plugins/vc_aos/include/algebra/impl/vc_aos_types.hpp @@ -34,7 +34,7 @@ namespace algebra { namespace vc_aos { /// Size type for Vc storage model -using size_type = std::size_t; +using index_type = std::size_t; /// Value type for Vc storage model template using value_type = T; @@ -42,7 +42,7 @@ using value_type = T; template using scalar_type = T; /// Array type used to store Vc::Vectors -template +template using storage_type = Vc::SimdArray; /// Value type in a linear algebra vector: AoS layout template @@ -54,7 +54,7 @@ using scalar_type = T; template using vector_type = algebra::storage::vector; /// Matrix type used in the Vc AoS storage model -template +template using matrix_type = algebra::storage::matrix; /// 2-element "vector" type, using @c Vc::SimdArray @@ -89,12 +89,12 @@ namespace traits { template struct index> { - using size_type = vc_aos::size_type; + using index_type = vc_aos::index_type; }; template struct index>> { - using size_type = vc_aos::size_type; + using index_type = vc_aos::index_type; }; template @@ -111,22 +111,22 @@ struct value>> { template struct dimensions> { - using size_type = vc_aos::size_type; + using index_type = vc_aos::index_type; - static constexpr size_type dim{1}; - static constexpr size_type rows{N}; - static constexpr size_type columns{1}; + static constexpr index_type _dim{1}; + static constexpr index_type _rows{N}; + static constexpr index_type _columns{1}; }; // Vector and storage types are different template struct dimensions>> { - using size_type = vc_aos::size_type; + using index_type = vc_aos::index_type; - static constexpr size_type dim{1}; - static constexpr size_type rows{N}; - static constexpr size_type columns{1}; + static constexpr index_type _dim{1}; + static constexpr index_type _rows{N}; + static constexpr index_type _columns{1}; }; } // namespace traits diff --git a/frontend/vc_aos/include/algebra/impl/vc_aos_vector.hpp b/plugins/vc_aos/include/algebra/impl/vc_aos_vector.hpp similarity index 100% rename from frontend/vc_aos/include/algebra/impl/vc_aos_vector.hpp rename to plugins/vc_aos/include/algebra/impl/vc_aos_vector.hpp diff --git a/frontend/vc_aos/include/algebra/vc_aos.hpp b/plugins/vc_aos/include/algebra/vc_aos.hpp similarity index 94% rename from frontend/vc_aos/include/algebra/vc_aos.hpp rename to plugins/vc_aos/include/algebra/vc_aos.hpp index 4ffdb4aa..e2a1067e 100644 --- a/frontend/vc_aos/include/algebra/vc_aos.hpp +++ b/plugins/vc_aos/include/algebra/vc_aos.hpp @@ -63,16 +63,14 @@ template struct determinant_selector<4, vc_aos::matrix_type, vc_aos::element_getter> { using type = - matrix::determinant::hard_coded, - vc_aos::element_getter>; + matrix::determinant::hard_coded>; }; // Inversion algorithms template struct inversion_selector<4, vc_aos::matrix_type, vc_aos::element_getter> { - using type = matrix::inverse::hard_coded, - vc_aos::element_getter>; + using type = matrix::inverse::hard_coded>; }; } // namespace generic @@ -129,7 +127,7 @@ struct vc_aos { using boolean = bool; using scalar = value_type; - using size_type = algebra::vc_aos::size_type; + using index_type = algebra::vc_aos::index_type; using transform3D = algebra::vc_aos::transform3; using point2D = algebra::vc_aos::point2; using point3D = algebra::vc_aos::point3; diff --git a/frontend/vc_soa/CMakeLists.txt b/plugins/vc_soa/CMakeLists.txt similarity index 100% rename from frontend/vc_soa/CMakeLists.txt rename to plugins/vc_soa/CMakeLists.txt diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_boolean.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_boolean.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_boolean.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_boolean.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_casts.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_casts.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_casts.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_casts.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_concepts.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_concepts.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_concepts.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_concepts.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_getter.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_getter.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_getter.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_getter.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_math.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_math.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_math.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_math.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_matrix.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_matrix.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_matrix.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_matrix.hpp diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_types.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_types.hpp similarity index 91% rename from frontend/vc_soa/include/algebra/impl/vc_soa_types.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_types.hpp index 10c9964c..73148362 100644 --- a/frontend/vc_soa/include/algebra/impl/vc_soa_types.hpp +++ b/plugins/vc_soa/include/algebra/impl/vc_soa_types.hpp @@ -34,7 +34,7 @@ namespace algebra { namespace vc_soa { /// Size type for Vc storage model -using size_type = std::size_t; +using index_type = std::size_t; /// Value type in a linear algebra vector: SoA layout template using value_type = T; @@ -42,13 +42,13 @@ using value_type = T; template using scalar_type = Vc::Vector; /// Array type used to store Vc::Vectors or matrix columns -template +template using storage_type = std::array; /// Vector type used in the Vc SoA storage model template using vector_type = algebra::storage::vector, storage_type>; /// Matrix type used in the Vc SoA storage model -template +template using matrix_type = algebra::storage::matrix, ROWS, COLS>; @@ -109,11 +109,11 @@ struct value> { template struct dimensions> { - using size_type = vc_soa::size_type; + using index_type = vc_soa::index_type; - static constexpr size_type dim{1}; - static constexpr size_type rows{N}; - static constexpr size_type columns{1}; + static constexpr index_type _dim{1}; + static constexpr index_type _rows{N}; + static constexpr index_type _columns{1}; }; } // namespace traits diff --git a/frontend/vc_soa/include/algebra/impl/vc_soa_vector.hpp b/plugins/vc_soa/include/algebra/impl/vc_soa_vector.hpp similarity index 100% rename from frontend/vc_soa/include/algebra/impl/vc_soa_vector.hpp rename to plugins/vc_soa/include/algebra/impl/vc_soa_vector.hpp diff --git a/frontend/vc_soa/include/algebra/vc_soa.hpp b/plugins/vc_soa/include/algebra/vc_soa.hpp similarity index 98% rename from frontend/vc_soa/include/algebra/vc_soa.hpp rename to plugins/vc_soa/include/algebra/vc_soa.hpp index 50ca8907..2dba4f9f 100644 --- a/frontend/vc_soa/include/algebra/vc_soa.hpp +++ b/plugins/vc_soa/include/algebra/vc_soa.hpp @@ -119,7 +119,7 @@ struct vc_soa { /// Linear Algebra type definitions /// @{ using scalar = simd; - using size_type = algebra::vc_soa::size_type; + using index_type = algebra::vc_soa::index_type; using transform3D = algebra::vc_soa::transform3; using point2D = algebra::vc_soa::point2; using point3D = algebra::vc_soa::point3; diff --git a/tests/unit_tests/device/sycl/CMakeLists.txt b/tests/unit_tests/device/sycl/CMakeLists.txt index fd98fc16..e0c31955 100644 --- a/tests/unit_tests/device/sycl/CMakeLists.txt +++ b/tests/unit_tests/device/sycl/CMakeLists.txt @@ -12,6 +12,13 @@ enable_language(SYCL) # Set the default SYCL compiler flags. include(algebra-plugins-compiler-options-sycl) +if(${CMAKE_SYCL_STANDARD} LESS 20) + message( + SEND_ERROR + "CMAKE_SYCL_STANDARD=${CMAKE_SYCL_STANDARD}, but algebra-plugins requires C++>=20" + ) +endif() + # Macro setting up the SYCL tests for a specific algebra plugin. macro(algebra_add_test_suite plugin) string(TOUPPER ${plugin} PLUGIN)