Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Algebra plugins library, part of the ACTS project (R&D line)
#
# (c) 2021-2024 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

Expand Down Expand Up @@ -243,9 +243,8 @@ endif()

# Set up the Algebra Plugin libraries.
add_subdirectory(common)
add_subdirectory(frontend)
add_subdirectory(math)
add_subdirectory(storage)
add_subdirectory(plugins)
add_subdirectory(generic)
add_subdirectory(utils)

# Set up the test(s).
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 13 additions & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@
#
# Mozilla Public License Version 2.0

# Set up the library.
# Set up the common 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"
)
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion common/include/algebra/assert.hpp
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions common/include/algebra/concepts.hpp
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -144,7 +144,7 @@ concept transform3D = requires(T trf) {
template <typename A>
concept algebra = (concepts::value<typename A::value_type> &&
concepts::scalar<typename A::scalar> &&
concepts::index<typename A::size_type> &&
concepts::index<typename A::index_type> &&
concepts::vector3D<typename A::vector3D> &&
concepts::point2D<typename A::point2D> &&
concepts::point3D<typename A::point3D> &&
Expand Down
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/** 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
*/
#pragma once

// 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 <array>
Expand All @@ -20,10 +20,11 @@ namespace algebra::storage {
/// Generic matrix type that can take vectors as columns
template <template <typename, std::size_t> class array_t,
concepts::scalar scalar_t, std::size_t ROW, std::size_t COL>
struct ALGEBRA_ALIGN(alignof(storage::vector<ROW, scalar_t, array_t>)) matrix {
struct ALGEBRA_ALIGN(
alignof(algebra::storage::vector<ROW, scalar_t, array_t>)) matrix {

// The matrix consists of column vectors
using vector_type = storage::vector<ROW, scalar_t, array_t>;
using vector_type = algebra::storage::vector<ROW, scalar_t, array_t>;
// Value type: Can be simd types
using scalar_type = scalar_t;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/** 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
*/
#pragma once

// 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 <cassert>
Expand Down
2 changes: 1 addition & 1 deletion common/include/algebra/qualifiers.hpp
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
52 changes: 26 additions & 26 deletions common/include/algebra/type_traits.hpp
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -77,35 +77,35 @@ using get_matrix_t = typename matrix<M>::template other_type<T, ROWS, COLS>;
template <typename M>
struct dimensions {

using size_type = int;
using index_type = int;

// Error case
static constexpr size_type dim{-1};
static constexpr size_type rows{-1};
static constexpr size_type columns{-1};
static constexpr index_type _dim{-1};
static constexpr index_type _rows{-1};
static constexpr index_type _columns{-1};
};

/// Specilization for scalar types
template <typename M>
requires std::is_fundamental_v<M>
struct dimensions<M> {

using size_type = std::size_t;
using index_type = std::size_t;

static constexpr size_type dim{0};
static constexpr size_type rows{1};
static constexpr size_type columns{1};
static constexpr index_type _dim{0};
static constexpr index_type _rows{1};
static constexpr index_type _columns{1};
};

template <class M>
inline constexpr index_t<M> dim{dimensions<std::remove_cvref_t<M>>::sim};
inline constexpr index_t<M> dim{dimensions<std::remove_cvref_t<M>>::_dim};

template <class M>
inline constexpr index_t<M> rows{dimensions<std::remove_cvref_t<M>>::rows};
inline constexpr index_t<M> rows{dimensions<std::remove_cvref_t<M>>::_rows};

template <class M>
inline constexpr index_t<M> columns{
dimensions<std::remove_cvref_t<M>>::columns};
dimensions<std::remove_cvref_t<M>>::_columns};

template <class M>
inline constexpr index_t<M> rank{std::min(rows<M>, columns<M>)};
Expand All @@ -114,10 +114,10 @@ template <class M>
inline constexpr index_t<M> size{rows<M> * columns<M>};

template <class V>
inline constexpr bool is_vector{dimensions<std::remove_cvref_t<V>>::dim == 1};
inline constexpr bool is_vector{dimensions<std::remove_cvref_t<V>>::_dim == 1};

template <class M>
inline constexpr bool is_matrix{dimensions<std::remove_cvref_t<M>>::dim == 2};
inline constexpr bool is_matrix{dimensions<std::remove_cvref_t<M>>::_dim == 2};

template <class M>
inline constexpr bool is_square{(rows<M> == columns<M>)};
Expand Down Expand Up @@ -148,7 +148,7 @@ template <typename T>
struct get_algebra<T> {
template <typename U>
using simd = typename T::template simd<U>;
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;
Expand All @@ -173,7 +173,7 @@ template <typename A, typename T>
using get_simd_t = typename traits::get_algebra<A>::template simd<T>;

template <typename A>
using get_size_t = typename traits::get_algebra<A>::size_type;
using get_size_t = typename traits::get_algebra<A>::index_type;

template <typename A>
using get_scalar_t = typename traits::get_algebra<A>::scalar;
Expand Down Expand Up @@ -207,32 +207,32 @@ using get_matrix_t = typename traits::get_algebra<A>::template matrix<R, C>;
\
template <typename T, auto N> \
struct index<A::vector_type<T, N>> { \
using type = algebra::A::size_type; \
using type = algebra::A::index_type; \
}; \
\
template <typename T, auto ROWS, auto COLS> \
struct index<A::matrix_type<T, ROWS, COLS>> { \
using type = algebra::A::size_type; \
using type = algebra::A::index_type; \
}; \
\
template <typename T, auto N> \
struct dimensions<A::vector_type<T, N>> { \
\
using size_type = index_t<A::vector_type<T, N>>; \
using index_type = index_t<A::vector_type<T, N>>; \
\
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 <typename T, auto ROWS, auto COLS> \
struct dimensions<A::matrix_type<T, ROWS, COLS>> { \
\
using size_type = index_t<A::matrix_type<T, ROWS, COLS>>; \
using index_type = index_t<A::matrix_type<T, ROWS, COLS>>; \
\
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 <typename T, auto N> \
Expand Down
Original file line number Diff line number Diff line change
@@ -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
*/
Expand All @@ -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 <array>
Expand Down Expand Up @@ -287,7 +287,7 @@ struct is_storage_vector : public std::false_type {};

template <std::size_t N, concepts::scalar scalar_t,
template <typename, std::size_t> class array_t>
struct is_storage_vector<storage::vector<N, scalar_t, array_t>>
struct is_storage_vector<algebra::storage::vector<N, scalar_t, array_t>>
: public std::true_type {};

template <typename T>
Expand Down
27 changes: 27 additions & 0 deletions generic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Algebra plugins library, part of the ACTS project (R&D line)
#
# (c) 2021-2026 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

# Set up the generic algebra library.
algebra_add_library(algebra_generic generic
"include/algebra/generic.hpp"
# impl include
"include/algebra/impl/generic_matrix.hpp"
"include/algebra/impl/generic_transform3.hpp"
"include/algebra/impl/generic_vector.hpp"
# algorithms include
"include/algebra/algorithms/matrix/decomposition/partial_pivot_lud.hpp"
"include/algebra/algorithms/matrix/determinant/cofactor.hpp"
"include/algebra/algorithms/matrix/determinant/hard_coded.hpp"
"include/algebra/algorithms/matrix/determinant/partial_pivot_lud.hpp"
"include/algebra/algorithms/matrix/inverse/cofactor.hpp"
"include/algebra/algorithms/matrix/inverse/hard_coded.hpp"
"include/algebra/algorithms/matrix/inverse/partial_pivot_lud.hpp"
"include/algebra/algorithms/utils/algorithm_selector.hpp"
)
target_link_libraries(algebra_generic INTERFACE algebra::common algebra::utils)
algebra_test_public_headers( algebra_generic
"algebra/generic.hpp"
)
Loading