Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Namespaces | Functions
math.hpp File Reference
#include "shambase/integer.hpp"
#include "shambase/type_traits.hpp"
#include "shambackends/sycl.hpp"
#include "shambackends/vec.hpp"
#include <vector>
+ Include dependency graph for math.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  sham
 namespace for backends this one is named only sham since shambackends is too long to write
 

Functions

template<class T >
constexpr T sham::product_accumulate (T v) noexcept
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr T sham::product_accumulate (sycl::vec< T, n > v) noexcept
 
template<class T >
constexpr T sham::sum_accumulate (T v) noexcept
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr T sham::sum_accumulate (sycl::vec< T, n > v) noexcept
 
template<class T , std::enable_if_t< std::is_signed< T >::value, int > = 0>
constexpr bool sham::all_component_are_negative (T a)
 
template<class T , int n, std::enable_if_t< n==2 &&std::is_signed< T >::value, int > = 0>
constexpr bool sham::all_component_are_negative (sycl::vec< T, n > v) noexcept
 
template<class T >
constexpr bool sham::vec_compare_geq (T a, T b)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::vec_compare_geq (sycl::vec< T, n > v, sycl::vec< T, n > w) noexcept
 
template<class T >
constexpr bool sham::vec_compare_leq (T a, T b)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::vec_compare_leq (sycl::vec< T, n > v, sycl::vec< T, n > w) noexcept
 
template<class T >
constexpr bool sham::vec_compare_g (T a, T b)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::vec_compare_g (sycl::vec< T, n > v, sycl::vec< T, n > w) noexcept
 
template<class T >
constexpr bool sham::component_have_a_zero (T a)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::component_have_a_zero (sycl::vec< T, n > v) noexcept
 
template<class T >
constexpr bool sham::component_have_only_one_zero (T a)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::component_have_only_one_zero (sycl::vec< T, n > v) noexcept
 
template<class T >
constexpr bool sham::component_have_at_most_one_zero (T a)
 
template<class T , int n, std::enable_if_t< n==2, int > = 0>
constexpr bool sham::component_have_at_most_one_zero (sycl::vec< T, n > v) noexcept
 
template<class T >
sham::details::g_sycl_min (T a, T b)
 
template<class T >
sham::details::g_sycl_max (T a, T b)
 
template<class T >
sham::details::g_sycl_abs (T a)
 
template<class T >
shambase::VecComponent< T > sham::details::g_sycl_dot (T a, T b)
 
template<class T >
constexpr bool sham::details::vec_equals (sycl::vec< T, 2 > a, sycl::vec< T, 2 > b) noexcept
 
template<class T >
constexpr bool sham::details::vec_equals (sycl::vec< T, 3 > a, sycl::vec< T, 3 > b) noexcept
 
template<class T >
constexpr bool sham::details::vec_equals (sycl::vec< T, 4 > a, sycl::vec< T, 4 > b) noexcept
 
template<class T >
constexpr bool sham::details::vec_equals (sycl::vec< T, 8 > a, sycl::vec< T, 8 > b) noexcept
 
template<class T >
constexpr bool sham::details::vec_equals (sycl::vec< T, 16 > a, sycl::vec< T, 16 > b) noexcept
 
template<class T >
constexpr bool sham::details::vec_equals (T a, T b) noexcept
 
template<class T >
sham::min (T a, T b)
 
template<class T >
sham::max (T a, T b)
 
template<class T >
shambase::VecComponent< T > sham::max_component (T a)
 
template<class T >
shambase::VecComponent< T > sham::dot (T a, T b)
 
template<class T >
shambase::VecComponent< T > sham::length2 (T a)
 
template<class T >
sham::max_8points (T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7)
 
template<class T >
sham::min_8points (T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7)
 
template<class T >
sham::abs (T a)
 
template<class T >
sham::positive_part (T a)
 
template<class T >
sham::negative_part (T a)
 
template<class T >
bool sham::equals (T a, T b)
 
template<class T >
bool sham::equals (const std::vector< T > &a, const std::vector< T > &b)
 overload of equals for std::vector
 
auto sham::pack32 (u32 a, u32 b) -> u64
 
auto sham::unpack32 (u64 v) -> sycl::vec< u32, 2 >
 
template<class T >
sham::m1pown (u32 n)
 
template<class T >
bool sham::has_nan (T v)
 
template<class T >
bool sham::has_inf (T v)
 
template<class T >
bool sham::has_nan_or_inf (T v)
 
template<class T , int n>
bool sham::has_nan (sycl::vec< T, n > v)
 return true if vector has a nan
 
template<class T , int n>
bool sham::has_inf (sycl::vec< T, n > v)
 return true if vector has a inf
 
template<class T , int n>
bool sham::has_nan_or_inf (sycl::vec< T, n > v)
 return true if vector has a nan or a inf
 
template<i32 power, class T >
constexpr T sham::pow_constexpr (T a) noexcept
 generalized pow constexpr
 
template<class T >
constexpr T sham::clz (T a) noexcept
 
template<class T , std::enable_if_t< std::is_integral_v< T >, int > = 0>
constexpr T sham::clz_xor (T a, T b) noexcept
 give the length of the common prefix
 
template<class T , std::enable_if_t< std::is_integral_v< T >, int > = 0>
constexpr T sham::log2_pow2_num (T v) noexcept
 compute the log2 of the number v being a power of 2
 
template<class T , std::enable_if_t< std::is_integral_v< T >||(!std::is_signed_v< T >), int > = 0>
constexpr T sham::roundup_pow2_clz (T v) noexcept
 round up to the next power of two 0 is rounded up to 1 as it is not a pow of 2 every input above the maximum power of 2 returns 0
 
template<class Acc >
i32 sham::karras_delta (i32 x, i32 y, u32 morton_length, Acc m) noexcept
 delta operator defined in Karras 2012
 
template<class T >
sham::inv_sat_positive (T v, T minvsat=T{1e-9}, T satval=T{0.}) noexcept
 inverse saturated (positive numbers only)
 
template<class T >
sham::inv_sat (T v, T minvsat=T{1e-9}, T satval=T{0.}) noexcept
 inverse saturated
 
template<class T >
sham::inv_sat_zero (T v, T satval=T{0.}) noexcept
 inverse saturated (zero version)
 
template<class Tdest , class Tsource >
Tdest sham::details::convert_internal (Tsource coord)
 
template<class Tdest , class Tsource , int N>
sycl::vec< Tdest, N > sham::details::convert_internal (sycl::vec< Tsource, N > coord)
 
template<class Tdest , class Tsource >
Tdest sham::convert (Tsource coord)
 Helper to avoid differences between SYCL implementations of convert, it always static cast.
 

Detailed Description

Author
Anass Serhani (anass.nosp@m..ser.nosp@m.hani@.nosp@m.cnrs.nosp@m..fr)
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file math.hpp.

Function Documentation

◆ convert_internal() [1/2]

template<class Tdest , class Tsource , int N>
sycl::vec< Tdest, N > sham::details::convert_internal ( sycl::vec< Tsource, N >  coord)
inline

Definition at line 882 of file math.hpp.

◆ convert_internal() [2/2]

template<class Tdest , class Tsource >
Tdest sham::details::convert_internal ( Tsource  coord)
inline

Definition at line 877 of file math.hpp.

◆ g_sycl_abs()

template<class T >
T sham::details::g_sycl_abs ( a)
inline

Definition at line 420 of file math.hpp.

◆ g_sycl_dot()

template<class T >
shambase::VecComponent< T > sham::details::g_sycl_dot ( a,
b 
)
inline

Definition at line 434 of file math.hpp.

◆ g_sycl_max()

template<class T >
T sham::details::g_sycl_max ( a,
b 
)
inline

Definition at line 406 of file math.hpp.

◆ g_sycl_min()

template<class T >
T sham::details::g_sycl_min ( a,
b 
)
inline

Definition at line 392 of file math.hpp.

◆ vec_equals() [1/6]

template<class T >
constexpr bool sham::details::vec_equals ( sycl::vec< T, 16 >  a,
sycl::vec< T, 16 >  b 
)
inlineconstexprnoexcept

Definition at line 488 of file math.hpp.

◆ vec_equals() [2/6]

template<class T >
constexpr bool sham::details::vec_equals ( sycl::vec< T, 2 >  a,
sycl::vec< T, 2 >  b 
)
inlineconstexprnoexcept

Definition at line 451 of file math.hpp.

◆ vec_equals() [3/6]

template<class T >
constexpr bool sham::details::vec_equals ( sycl::vec< T, 3 >  a,
sycl::vec< T, 3 >  b 
)
inlineconstexprnoexcept

Definition at line 458 of file math.hpp.

◆ vec_equals() [4/6]

template<class T >
constexpr bool sham::details::vec_equals ( sycl::vec< T, 4 >  a,
sycl::vec< T, 4 >  b 
)
inlineconstexprnoexcept

Definition at line 466 of file math.hpp.

◆ vec_equals() [5/6]

template<class T >
constexpr bool sham::details::vec_equals ( sycl::vec< T, 8 >  a,
sycl::vec< T, 8 >  b 
)
inlineconstexprnoexcept

Definition at line 475 of file math.hpp.

◆ vec_equals() [6/6]

template<class T >
constexpr bool sham::details::vec_equals ( a,
b 
)
inlineconstexprnoexcept

Definition at line 512 of file math.hpp.