Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 0e84602

Browse files
committed
cleanup
1 parent ec0e35b commit 0e84602

55 files changed

Lines changed: 111 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ endif()
243243

244244
# Set up the Algebra Plugin libraries.
245245
add_subdirectory(common)
246-
add_subdirectory(frontend)
246+
add_subdirectory(plugins)
247247
add_subdirectory(generic)
248248
add_subdirectory(utils)
249249

common/include/algebra/type_traits.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ struct dimensions {
8080
using size_type = int;
8181

8282
// Error case
83-
static constexpr size_type dim{-1};
84-
static constexpr size_type rows{-1};
85-
static constexpr size_type columns{-1};
83+
static constexpr size_type _dim{-1};
84+
static constexpr size_type _rows{-1};
85+
static constexpr size_type _columns{-1};
8686
};
8787

8888
/// Specilization for scalar types
@@ -92,20 +92,20 @@ struct dimensions<M> {
9292

9393
using size_type = std::size_t;
9494

95-
static constexpr size_type dim{0};
96-
static constexpr size_type rows{1};
97-
static constexpr size_type columns{1};
95+
static constexpr size_type _dim{0};
96+
static constexpr size_type _rows{1};
97+
static constexpr size_type _columns{1};
9898
};
9999

100100
template <class M>
101-
inline constexpr index_t<M> dim{dimensions<std::remove_cvref_t<M>>::sim};
101+
inline constexpr index_t<M> dim{dimensions<std::remove_cvref_t<M>>::_dim};
102102

103103
template <class M>
104-
inline constexpr index_t<M> rows{dimensions<std::remove_cvref_t<M>>::rows};
104+
inline constexpr index_t<M> rows{dimensions<std::remove_cvref_t<M>>::_rows};
105105

106106
template <class M>
107107
inline constexpr index_t<M> columns{
108-
dimensions<std::remove_cvref_t<M>>::columns};
108+
dimensions<std::remove_cvref_t<M>>::_columns};
109109

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

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

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

122122
template <class M>
123123
inline constexpr bool is_square{(rows<M> == columns<M>)};
@@ -220,19 +220,19 @@ using get_matrix_t = typename traits::get_algebra<A>::template matrix<R, C>;
220220
\
221221
using size_type = index_t<A::vector_type<T, N>>; \
222222
\
223-
static constexpr size_type dim{1}; \
224-
static constexpr size_type rows{N}; \
225-
static constexpr size_type columns{1}; \
223+
static constexpr size_type _dim{1}; \
224+
static constexpr size_type _rows{N}; \
225+
static constexpr size_type _columns{1}; \
226226
}; \
227227
\
228228
template <typename T, auto ROWS, auto COLS> \
229229
struct dimensions<A::matrix_type<T, ROWS, COLS>> { \
230230
\
231231
using size_type = index_t<A::matrix_type<T, ROWS, COLS>>; \
232232
\
233-
static constexpr size_type dim{2}; \
234-
static constexpr size_type rows{ROWS}; \
235-
static constexpr size_type columns{COLS}; \
233+
static constexpr size_type _dim{2}; \
234+
static constexpr size_type _rows{ROWS}; \
235+
static constexpr size_type _columns{COLS}; \
236236
}; \
237237
\
238238
template <typename T, auto N> \

generic/include/algebra/algorithms/matrix/determinant/cofactor.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ struct cofactor {
3232
return determinant_getter_helper<algebra::traits::rank<matrix_t>>()(m);
3333
}
3434

35-
template <size_type N, typename Enable = void>
35+
template <size_type N>
3636
struct determinant_getter_helper;
3737

3838
template <size_type N>
39-
struct determinant_getter_helper<N, typename std::enable_if_t<N == 1>> {
39+
requires(N == 1)
40+
struct determinant_getter_helper<N> {
4041
template <class input_matrix_type>
4142
ALGEBRA_HOST_DEVICE constexpr scalar_type operator()(
4243
const input_matrix_type &m) const {
@@ -45,7 +46,8 @@ struct cofactor {
4546
};
4647

4748
template <size_type N>
48-
struct determinant_getter_helper<N, typename std::enable_if_t<N != 1>> {
49+
requires(N != 1)
50+
struct determinant_getter_helper<N> {
4951

5052
template <class input_matrix_type>
5153
ALGEBRA_HOST_DEVICE constexpr scalar_type operator()(

generic/include/algebra/algorithms/matrix/inverse/cofactor.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ struct cofactor {
3434
return adjoint_getter_helper<algebra::traits::rank<matrix_t>>()(m);
3535
}
3636

37-
template <size_type N, typename Enable = void>
37+
template <size_type N>
3838
struct adjoint_getter_helper;
3939

4040
template <size_type N>
41-
struct adjoint_getter_helper<N, typename std::enable_if_t<N == 1>> {
41+
requires(N == 1)
42+
struct adjoint_getter_helper<N> {
4243
ALGEBRA_HOST_DEVICE constexpr matrix_t operator()(
4344
const matrix_t & /*m*/) const {
4445
matrix_t ret;
@@ -48,7 +49,8 @@ struct cofactor {
4849
};
4950

5051
template <size_type N>
51-
struct adjoint_getter_helper<N, typename std::enable_if_t<N != 1>> {
52+
requires(N != 1)
53+
struct adjoint_getter_helper<N> {
5254

5355
using determinant_getter =
5456
determinant::cofactor<matrix_t, element_getter_t>;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# Mozilla Public License Version 2.0
66

77
# Set up all enabled libraries.
8-
add_subdirectory(array)
8+
if(ALGEBRA_PLUGINS_INCLUDE_ARRAY)
9+
add_subdirectory(array)
10+
endif()
911

1012
if(ALGEBRA_PLUGINS_INCLUDE_EIGEN)
1113
add_subdirectory(eigen)
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace algebra {
2121
/// @name Operators on @c algebra::array::storage_type
2222
/// @{
2323

24-
using algebra::cmath::operator*;
25-
using algebra::cmath::operator-;
26-
using algebra::cmath::operator+;
24+
using algebra::array::operator*;
25+
using algebra::array::operator-;
26+
using algebra::array::operator+;
2727

2828
/// @}
2929

@@ -32,10 +32,10 @@ namespace getter {
3232
/// @name Getter functions on @c algebra::array::storage_type
3333
/// @{
3434

35-
using cmath::storage::block;
36-
using cmath::storage::element;
37-
using cmath::storage::set_block;
38-
using cmath::storage::vector;
35+
using array::storage::block;
36+
using array::storage::element;
37+
using array::storage::set_block;
38+
using array::storage::vector;
3939

4040
/// @}
4141

@@ -47,16 +47,16 @@ namespace vector {
4747
/// @{
4848

4949
// array specific implementations
50-
using cmath::dot;
51-
using cmath::normalize;
50+
using array::dot;
51+
using array::normalize;
5252

5353
// generic implementations
54-
using cmath::cross;
55-
using cmath::eta;
56-
using cmath::norm;
57-
using cmath::perp;
58-
using cmath::phi;
59-
using cmath::theta;
54+
using array::cross;
55+
using array::eta;
56+
using array::norm;
57+
using array::perp;
58+
using array::phi;
59+
using array::theta;
6060

6161
/// @}
6262

@@ -89,15 +89,15 @@ namespace matrix {
8989
/// @name Matrix functions on @c algebra::array::storage_type
9090
/// @{
9191

92-
using cmath::identity;
93-
using cmath::set_identity;
94-
using cmath::set_zero;
95-
using cmath::zero;
92+
using array::identity;
93+
using array::set_identity;
94+
using array::set_zero;
95+
using array::zero;
9696

9797
// Uses generic implementation in the background
98-
using cmath::determinant;
99-
using cmath::inverse;
100-
using cmath::transpose;
98+
using array::determinant;
99+
using array::inverse;
100+
using array::transpose;
101101

102102
using generic::math::set_inplace_product_left;
103103
using generic::math::set_inplace_product_left_transpose;
@@ -114,7 +114,7 @@ using generic::math::transposed_product;
114114

115115
namespace array {
116116

117-
/// @name cmath based transforms on @c algebra::array
117+
/// @name array based transforms on @c algebra::array
118118
/// @{
119119

120120
template <concepts::scalar T>

frontend/array/include/algebra/impl/array_getter.hpp renamed to plugins/array/include/algebra/impl/array_getter.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <cstddef>
1818
#include <type_traits>
1919

20-
namespace algebra::cmath::storage {
20+
namespace algebra::array::storage {
2121

2222
/// "Element getter", assuming a simple 2D array access
2323
struct element_getter {
@@ -236,4 +236,4 @@ ALGEBRA_HOST_DEVICE constexpr void set_block(input_matrix_type &m,
236236
}
237237
}
238238

239-
} // namespace algebra::cmath::storage
239+
} // namespace algebra::array::storage

frontend/array/include/algebra/impl/array_matrix.hpp renamed to plugins/array/include/algebra/impl/array_matrix.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "algebra/math.hpp"
1414
#include "algebra/qualifiers.hpp"
1515

16-
namespace algebra::cmath {
16+
namespace algebra::array {
1717

1818
/// @returns zero matrix of type @tparam matrix_t
1919
template <concepts::matrix matrix_t>
@@ -83,4 +83,4 @@ ALGEBRA_HOST_DEVICE constexpr auto inverse(
8383
return algebra::generic::math::inverse(m);
8484
}
8585

86-
} // namespace algebra::cmath
86+
} // namespace algebra::array

frontend/array/include/algebra/impl/array_operators.hpp renamed to plugins/array/include/algebra/impl/array_operators.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <cstddef>
1616
#include <type_traits>
1717

18-
namespace algebra::cmath {
18+
namespace algebra::array {
1919

2020
/// @name Operators on 2-element arrays
2121
/// @{
@@ -213,4 +213,4 @@ ALGEBRA_HOST_DEVICE constexpr array_t<scalar_t, ROWS> operator*(
213213

214214
/// @}
215215

216-
} // namespace algebra::cmath
216+
} // namespace algebra::array

0 commit comments

Comments
 (0)