Commit 19cfb571 authored by ESTERIE Pierre's avatar ESTERIE Pierre
Browse files

Fix roots problem in chebychev

parent b3682271
......@@ -27,11 +27,11 @@ namespace scalfmm::container
template<typename Arithmetic, std::size_t Dim = 3, typename Enable = void>
struct point
{
static_assert(std::is_arithmetic<Arithmetic>::value, "Point's inner type should be arithmetic!");
static_assert(meta::is_arithmetic<Arithmetic>::value, "Point's inner type should be arithmetic!");
};
template<typename Arithmetic, std::size_t Dim>
struct point<Arithmetic, Dim, typename std::enable_if<std::is_arithmetic<Arithmetic>::value>::type>
struct point<Arithmetic, Dim, typename std::enable_if<meta::is_arithmetic<Arithmetic>::value>::type>
: public std::array<Arithmetic, Dim>
{
public:
......
......@@ -80,14 +80,14 @@ namespace scalfmm::interpolation
auto operator=(chebyshev_interpolator&&) noexcept -> chebyshev_interpolator& = default;
~chebyshev_interpolator() = default;
[[nodiscard]] inline auto roots_impl(std::size_t order) const
[[nodiscard]] inline auto roots_impl(std::size_t order) const -> xt::xarray<value_type>
{
const value_type coeff = value_type(3.14159265358979323846264338327950) / (value_type(order));
// xfunction xt::cos
std::cout << " cos(n) " << (xt::cos(coeff * (xt::arange(int(order - 1), int(-1), -1) + 0.5))) << std::endl;
// const auto p = xt::eval(xt::cos(coeff * (xt::arange(int(order - 1), int(-1), -1) + 0.5)));
// return xt::cos(coeff * (xt::arange(int(order - 1), int(-1), -1) + 0.5));
return xt::linspace(value_type(-1.), value_type(1), order);
return xt::cos(coeff * (xt::arange(int(order - 1), int(-1), -1) + 0.5));
//return xt::linspace(value_type(-1.), value_type(1), order);
}
/**
* Chebyshev polynomials of first kind \f$ T_n(x) = \cos(n \arccos(x)) \f$
......@@ -127,6 +127,10 @@ namespace scalfmm::interpolation
return value_type(n * (sin(n * acos(x))) / sqrt(1 - x * x));
}
inline auto generate_interactions_matrixes_impl(value_type width, std::size_t tree_height) -> void
{}
template<typename TensorViewX, typename TensorViewY>
[[nodiscard]] inline auto generate_matrix_k_impl(TensorViewX&& X, TensorViewY&& Y, std::size_t order,
matrix_kernel_type const& far_field, std::size_t n,
......
......@@ -286,10 +286,11 @@ namespace scalfmm::meta
{
};
} // namespace scalfmm::meta
template<typename T>
struct is_arithmetic : std::is_arithmetic<T> {};
template<typename T>
struct is_integral : std::is_integral<T> {};
namespace std
{
template<typename T, std::size_t N>
struct is_arithmetic<xsimd::batch<T, N>> : is_arithmetic<T>
{
......@@ -299,6 +300,6 @@ namespace std
struct is_integral<xsimd::batch<T, N>> : is_integral<T>
{
};
} // namespace std
} // namespace scalfmm::meta
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment