Skip to content

Commit b6634f1

Browse files
committed
fix pre-commit
1 parent 31337cc commit b6634f1

File tree

7 files changed

+54
-23
lines changed

7 files changed

+54
-23
lines changed

include/xtensor/core/xmath.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ namespace xt
4040
struct numeric_constants
4141
{
4242
static constexpr T PI = std::numbers::pi_v<T>;
43-
static constexpr T PI_2 = 0.5*PI;
44-
static constexpr T PI_4 = 0.25*PI;
43+
static constexpr T PI_2 = 0.5 * PI;
44+
static constexpr T PI_4 = 0.25 * PI;
4545
static constexpr T D_1_PI = std::numbers::inv_pi_v<T>;
46-
static constexpr T D_2_PI = 2*std::numbers::inv_pi_v<T>;
47-
static constexpr T D_2_SQRTPI = 2*std::numbers::inv_sqrtpi_v<T>;
46+
static constexpr T D_2_PI = 2 * std::numbers::inv_pi_v<T>;
47+
static constexpr T D_2_SQRTPI = 2 * std::numbers::inv_sqrtpi_v<T>;
4848
static constexpr T SQRT2 = std::numbers::sqrt2_v<T>;
49-
static constexpr T SQRT1_2 = 0.5*std::numbers::sqrt2_v<T>;
49+
static constexpr T SQRT1_2 = 0.5 * std::numbers::sqrt2_v<T>;
5050
static constexpr T E = std::numbers::e_v<T>;
5151
static constexpr T LOG2E = std::numbers::log2e_v<T>;
5252
static constexpr T LOG10E = std::numbers::log10e_v<T>;

include/xtensor/generators/xbuilder.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
#include "../core/xfunction.hpp"
3030
#include "../core/xoperation.hpp"
3131
#include "../generators/xgenerator.hpp"
32-
#include "../views/xbroadcast.hpp"
3332
#include "../utils/xutils.hpp"
34-
33+
#include "../views/xbroadcast.hpp"
3534

3635
namespace xt
3736
{

include/xtensor/misc/xfft.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include "../core/xnoalias.hpp"
1111
#include "../generators/xbuilder.hpp"
1212
#include "../misc/xcomplex.hpp"
13+
#include "../utils/xutils.hpp"
1314
#include "../views/xaxis_slice_iterator.hpp"
1415
#include "../views/xview.hpp"
1516
#include "./xtl_concepts.hpp"
16-
#include "../utils/xutils.hpp"
1717

1818
namespace xt
1919
{
@@ -62,7 +62,7 @@ namespace xt
6262
auto odd = radix2(xt::view(ev, xt::range(1, _, 2)));
6363
#endif
6464

65-
auto range = xt::arange<double>(0.5*static_cast<double>(N));
65+
auto range = xt::arange<double>(0.5 * static_cast<double>(N));
6666
auto exp = xt::exp(static_cast<value_type>(-2i) * pi * range / static_cast<precision>(N));
6767
auto t = exp * odd;
6868
auto first_half = even + t;
@@ -91,7 +91,10 @@ namespace xt
9191
xt::xtensor<std::size_t, 1> i = xt::pow(xt::linspace<std::size_t>(0, n - 1, n), 2);
9292
i %= (n * 2);
9393

94-
auto angles = xt::eval(static_cast<precision>(3.141592653589793238463) * xt::cast<precision>(i) / static_cast<precision>(n));
94+
auto angles = xt::eval(
95+
static_cast<precision>(3.141592653589793238463) * xt::cast<precision>(i)
96+
/ static_cast<precision>(n)
97+
);
9598
auto j = std::complex<precision>(0, 1);
9699
exp_table = xt::exp(-angles * j);
97100

include/xtensor/views/index_mapper.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#ifndef XTENSOR_INDEX_MAPPER_HPP
1111
#define XTENSOR_INDEX_MAPPER_HPP
1212

13-
#include "xview.hpp"
1413
#include "../utils/xutils.hpp"
14+
#include "xview.hpp"
1515

1616
namespace xt
1717
{
@@ -401,8 +401,9 @@ namespace xt
401401
{
402402
constexpr size_t n_indices_full = n_indices_full_v<FirstIndice, OtherIndices...>;
403403

404-
constexpr auto underlying_n_dimensions = static_cast<std::size_t>(xt::static_dimension<
405-
typename std::decay_t<UnderlyingContainer>::shape_type>::value);
404+
constexpr auto underlying_n_dimensions = static_cast<std::size_t>(
405+
xt::static_dimension<typename std::decay_t<UnderlyingContainer>::shape_type>::value
406+
);
406407

407408
// If there is too many indices, we need to drop the first ones.
408409
// If the number of dimensions of the underlying container is known at compile time we can drop them

test/test_xexpression.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,25 @@ namespace xt
104104
auto sexpr1 = make_xshared(std::move(expr1));
105105
using expr_type = decltype(sexpr1);
106106
using strides_type = typename expr_type::strides_type;
107-
static_assert(std::is_same_v<strides_type, xt::svector<long, 4>>, "strides_type should be svector<long, 4>");
107+
static_assert(
108+
std::is_same_v<strides_type, xt::svector<long, 4>>,
109+
"strides_type should be svector<long, 4>"
110+
);
108111
using inner_strides_type = typename expr_type::inner_strides_type;
109-
static_assert(std::is_same_v<inner_strides_type, xt::svector<long, 4>>, "inner_strides_type should be svector<long, 4>");
112+
static_assert(
113+
std::is_same_v<inner_strides_type, xt::svector<long, 4>>,
114+
"inner_strides_type should be svector<long, 4>"
115+
);
110116
using backstrides_type = typename expr_type::backstrides_type;
111-
static_assert(std::is_same_v<backstrides_type, xt::svector<long, 4>>, "backstrides_type should be svector<long, 4>");
117+
static_assert(
118+
std::is_same_v<backstrides_type, xt::svector<long, 4>>,
119+
"backstrides_type should be svector<long, 4>"
120+
);
112121
using inner_strides_tybackstrides_typepe = typename expr_type::inner_backstrides_type;
113-
static_assert(std::is_same_v<inner_strides_tybackstrides_typepe, xt::svector<long, 4>>, "inner_backstrides_type should be svector<long, 4>");
122+
static_assert(
123+
std::is_same_v<inner_strides_tybackstrides_typepe, xt::svector<long, 4>>,
124+
"inner_backstrides_type should be svector<long, 4>"
125+
);
114126
}
115127

116128
TEST(xexpression, shared_expr_return)

test/test_xfft.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ namespace xt
1111
size_t n = 8192;
1212
float A = 10;
1313
auto x = xt::linspace<float>(0, static_cast<float>(n - 1), n);
14-
xt::xarray<float> y = A * xt::sin(2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k) / static_cast<float>(n));
14+
xt::xarray<float> y = A
15+
* xt::sin(
16+
2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k)
17+
/ static_cast<float>(n)
18+
);
1519
auto res = xt::fft::fft(y) / (0.5 * static_cast<float>(n));
1620
REQUIRE(A == doctest::Approx(std::abs(res(k))).epsilon(.0001));
1721
}
@@ -22,7 +26,11 @@ namespace xt
2226
size_t n = 8;
2327
float A = 10;
2428
auto x = xt::linspace<float>(0, static_cast<float>(n - 1), n);
25-
xt::xarray<float> y = A * xt::sin(2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k) / static_cast<float>(n));
29+
xt::xarray<float> y = A
30+
* xt::sin(
31+
2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k)
32+
/ static_cast<float>(n)
33+
);
2634
auto res = xt::fft::ifft(y) / (0.5 * static_cast<float>(n));
2735
REQUIRE(A == doctest::Approx(std::abs(res(k))).epsilon(.0001));
2836
}
@@ -48,7 +56,11 @@ namespace xt
4856
float A = 1;
4957
size_t dim = 10;
5058
auto x = xt::linspace<float>(0, static_cast<float>(n - 1), n) * xt::ones<float>({dim, n});
51-
xt::xarray<float> y = A * xt::sin(2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k) / static_cast<float>(n));
59+
xt::xarray<float> y = A
60+
* xt::sin(
61+
2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k)
62+
/ static_cast<float>(n)
63+
);
5264
y = xt::transpose(y);
5365
auto res = xt::fft::fft(y, 0) / (0.5 * static_cast<float>(n));
5466
REQUIRE(A == doctest::Approx(std::abs(res(k, 0))).epsilon(.0001));
@@ -62,7 +74,11 @@ namespace xt
6274
float A = 1;
6375
size_t dim = 2;
6476
auto x = xt::linspace<float>(0, static_cast<float>(n - 1), n) * xt::ones<float>({dim, n});
65-
xt::xarray<float> y = A * xt::sin(2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k) / static_cast<float>(n));
77+
xt::xarray<float> y = A
78+
* xt::sin(
79+
2 * xt::numeric_constants<float>::PI * x * static_cast<float>(k)
80+
/ static_cast<float>(n)
81+
);
6682
auto res = xt::fft::fft(y) / (0.5 * static_cast<float>(n));
6783
REQUIRE(A == doctest::Approx(std::abs(res(0, k))).epsilon(.0001));
6884
REQUIRE(A == doctest::Approx(std::abs(res(1, k))).epsilon(.0001));

test/test_xreducer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
namespace xt
3535
{
3636

37-
#define CHECK_RESULT_TYPE(EXPRESSION, EXPECTED_TYPE) \
38-
{ \
37+
#define CHECK_RESULT_TYPE(EXPRESSION, EXPECTED_TYPE) \
38+
{ \
3939
using result_t = typename std::decay_t<decltype(EXPRESSION)>::value_type; \
4040
EXPECT_TRUE((std::is_same<result_t, EXPECTED_TYPE>::value)); \
4141
}

0 commit comments

Comments
 (0)