Cuda battery library
Loading...
Searching...
No Matches
battery Namespace Reference

Classes

class  atomic_memory
 
class  bitset
 
class  dynamic_bitset
 
struct  limits
 
class  memory
 
class  pool_allocator
 
class  root_ptr
 
class  shared_ptr
 
class  standard_allocator
 
class  statistics_allocator
 
class  string
 
class  unique_ptr
 
struct  variant
 
class  vector
 

Typedefs

using local_memory = memory<false>
 
using read_only_memory = memory<true>
 

Functions

template<class Seq , class Compare >
CUDA NI void sort (Seq &seq, Compare comp)
 
template<class Seq , class Compare >
CUDA NI void sorti (Seq &seq, Compare comp)
 
template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > operator& (const bitset< N, M1, T > &lhs, const bitset< N, M2, T > &rhs)
 
template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > operator| (const bitset< N, M1, T > &lhs, const bitset< N, M2, T > &rhs)
 
template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > operator^ (const bitset< N, M1, T > &lhs, const bitset< N, M2, T > &rhs)
 
template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > operator& (const dynamic_bitset< Mem, Alloc, T > &lhs, const dynamic_bitset< Mem, Alloc, T > &rhs)
 
template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > operator| (const dynamic_bitset< Mem, Alloc, T > &lhs, const dynamic_bitset< Mem, Alloc, T > &rhs)
 
template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > operator^ (const dynamic_bitset< Mem, Alloc, T > &lhs, const dynamic_bitset< Mem, Alloc, T > &rhs)
 
template<class T , class Alloc , class... Args>
CUDA NI root_ptr< T, Alloc > allocate_root (const Alloc &alloc, Args &&... args)
 
template<class T , class Alloc , class... Args>
CUDA root_ptr< T, Alloc > make_root (Args &&... args)
 
template<class T , class Alloc , class... Args>
CUDA NI shared_ptr< T, Alloc > allocate_shared (const Alloc &alloc, Args &&... args)
 
template<class T , class Alloc , class... Args>
CUDA NI shared_ptr< T, Alloc > make_shared (Args &&... args)
 
template<class Alloc1 , class Alloc2 >
CUDA bool operator== (const string< Alloc1 > &lhs, const string< Alloc2 > &rhs)
 
template<class Allocator >
CUDA bool operator== (const char *lhs, const string< Allocator > &rhs)
 
template<class Allocator >
CUDA bool operator== (const string< Allocator > &lhs, const char *rhs)
 
template<class Allocator >
CUDA string< Allocator > operator+ (const string< Allocator > &lhs, const string< Allocator > &rhs)
 
template<class Allocator >
CUDA string< Allocator > operator+ (const char *lhs, const string< Allocator > &rhs)
 
template<class Allocator >
CUDA string< Allocator > operator+ (const string< Allocator > &lhs, const char *rhs)
 
template<class T , class Alloc , class... Args>
CUDA NI unique_ptr< T, Alloc > allocate_unique (const Alloc &alloc, Args &&... args)
 
template<class T , class Alloc , class... Args>
CUDA unique_ptr< T, Alloc > make_unique (Args &&... args)
 
template<class T >
CUDA constexpr void swap (T &a, T &b)
 
CUDA size_t strlen (const char *str)
 
CUDA int strcmp (const char *s1, const char *s2)
 
template<class T >
CUDA INLINE constexpr T min (T a, T b)
 
template<class T >
CUDA INLINE constexpr T max (T a, T b)
 
template<class T >
CUDA constexpr T isnan (T a)
 
CUDA CONSTEXPR_NEXTAFTER float nextafter (float f, float dir)
 
CUDA CONSTEXPR_NEXTAFTER double nextafter (double f, double dir)
 
template<class To , class From , bool map_limits = true>
CUDA NI constexpr To ru_cast (From x)
 
template<class To , class From , bool map_limits = true>
CUDA NI constexpr To rd_cast (From x)
 
template<class T >
CUDA NI constexpr int popcount (T x)
 
template<class T >
CUDA NI constexpr int countl_zero (T x)
 
template<class T >
CUDA NI constexpr int countl_one (T x)
 
template<class T >
CUDA NI constexpr int countr_zero (T x)
 
template<class T >
CUDA NI constexpr int countr_one (T x)
 
template<class T >
CUDA constexpr int signum (T val)
 
template<class T >
CUDA NI constexpr T ipow (T a, T b)
 
template<class T >
CUDA constexpr T add_up (T x, T y)
 
template<class T >
CUDA constexpr T add_down (T x, T y)
 
template<class T >
CUDA constexpr T sub_up (T x, T y)
 
template<class T >
CUDA constexpr T sub_down (T x, T y)
 
template<class T >
CUDA constexpr T mul_up (T x, T y)
 
template<class T >
CUDA constexpr T mul_down (T x, T y)
 
template<class T >
CUDA constexpr T div_up (T x, T y)
 
template<class T >
CUDA constexpr T div_down (T x, T y)
 
template<class T >
CUDA constexpr T tdiv (T x, T y)
 
template<class T >
CUDA constexpr T tmod (T x, T y)
 
template<class T >
CUDA constexpr T fdiv (T x, T y)
 
template<class T >
CUDA constexpr T fmod (T x, T y)
 
template<class T >
CUDA constexpr T cdiv (T x, T y)
 
template<class T >
CUDA constexpr T cmod (T x, T y)
 
template<class T >
CUDA constexpr T ediv (T x, T y)
 
template<class T >
CUDA constexpr T emod (T x, T y)
 
template<typename T >
CUDA NI void print (const T &t)
 
template<>
CUDA NI void print (const bool &x)
 
template<>
CUDA NI void print (const char &x)
 
template<>
CUDA NI void print (const short &x)
 
template<>
CUDA NI void print (const int &x)
 
template<>
CUDA NI void print (const long long int &x)
 
template<>
CUDA NI void print (const long int &x)
 
template<>
CUDA NI void print (const unsigned char &x)
 
template<>
CUDA NI void print (const unsigned short &x)
 
template<>
CUDA NI void print (const unsigned int &x)
 
template<>
CUDA NI void print (const unsigned long &x)
 
template<>
CUDA NI void print (const unsigned long long &x)
 
template<>
CUDA NI void print (const float &x)
 
template<>
CUDA NI void print (const double &x)
 
template<>
CUDA NI void print (char const *const &x)
 
template<size_t i, typename... Ts>
CUDA impl::variant_alternative< i, Ts... >::type & get (variant< Ts... > &v)
 
template<size_t i, typename... Ts>
CUDA const impl::variant_alternative< i, Ts... >::type & get (const variant< Ts... > &v)
 
template<typename... Ts>
CUDA NI bool operator== (const variant< Ts... > &lhs, const variant< Ts... > &rhs)
 
template<class T1 , class Alloc1 , class T2 , class Alloc2 >
CUDA NI bool operator== (const vector< T1, Alloc1 > &lhs, const vector< T2, Alloc2 > &rhs)
 

Typedef Documentation

◆ local_memory

using battery::local_memory = memory<false>

◆ read_only_memory

Function Documentation

◆ sort()

template<class Seq , class Compare >
CUDA NI void battery::sort ( Seq & seq,
Compare comp )

Sort the sequence seq in-place. The underlying algorithm is an iterative version of quicksort.

  • comp(a, b) returns true whenever a < b, and false otherwise.

◆ sorti()

template<class Seq , class Compare >
CUDA NI void battery::sorti ( Seq & seq,
Compare comp )

Similar to sort, but the comparison function is takes indexes instead of elements themselves.

  • comp(i, j) returns true whenever seq[i] < seq[j], and false otherwise.

◆ operator&() [1/2]

template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > battery::operator& ( const bitset< N, M1, T > & lhs,
const bitset< N, M2, T > & rhs )
constexpr

◆ operator|() [1/2]

template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > battery::operator| ( const bitset< N, M1, T > & lhs,
const bitset< N, M2, T > & rhs )
constexpr

◆ operator^() [1/2]

template<size_t N, class M1 , class M2 , class T >
CUDA constexpr bitset< N, local_memory, T > battery::operator^ ( const bitset< N, M1, T > & lhs,
const bitset< N, M2, T > & rhs )
constexpr

◆ operator&() [2/2]

template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > battery::operator& ( const dynamic_bitset< Mem, Alloc, T > & lhs,
const dynamic_bitset< Mem, Alloc, T > & rhs )
constexpr

◆ operator|() [2/2]

template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > battery::operator| ( const dynamic_bitset< Mem, Alloc, T > & lhs,
const dynamic_bitset< Mem, Alloc, T > & rhs )
constexpr

◆ operator^() [2/2]

template<class Mem , class Alloc , class T >
CUDA constexpr dynamic_bitset< Mem, Alloc, T > battery::operator^ ( const dynamic_bitset< Mem, Alloc, T > & lhs,
const dynamic_bitset< Mem, Alloc, T > & rhs )
constexpr

◆ allocate_root()

template<class T , class Alloc , class... Args>
CUDA NI root_ptr< T, Alloc > battery::allocate_root ( const Alloc & alloc,
Args &&... args )

◆ make_root()

template<class T , class Alloc , class... Args>
CUDA root_ptr< T, Alloc > battery::make_root ( Args &&... args)

Similar to allocate_root but with an default-constructed allocator.

◆ allocate_shared()

template<class T , class Alloc , class... Args>
CUDA NI shared_ptr< T, Alloc > battery::allocate_shared ( const Alloc & alloc,
Args &&... args )

◆ make_shared()

template<class T , class Alloc , class... Args>
CUDA NI shared_ptr< T, Alloc > battery::make_shared ( Args &&... args)

Similar to allocate_shared but with an default-constructed allocator.

◆ operator==() [1/5]

template<class Alloc1 , class Alloc2 >
CUDA bool battery::operator== ( const string< Alloc1 > & lhs,
const string< Alloc2 > & rhs )

◆ operator==() [2/5]

template<class Allocator >
CUDA bool battery::operator== ( const char * lhs,
const string< Allocator > & rhs )

◆ operator==() [3/5]

template<class Allocator >
CUDA bool battery::operator== ( const string< Allocator > & lhs,
const char * rhs )

◆ operator+() [1/3]

template<class Allocator >
CUDA string< Allocator > battery::operator+ ( const string< Allocator > & lhs,
const string< Allocator > & rhs )

◆ operator+() [2/3]

template<class Allocator >
CUDA string< Allocator > battery::operator+ ( const char * lhs,
const string< Allocator > & rhs )

◆ operator+() [3/3]

template<class Allocator >
CUDA string< Allocator > battery::operator+ ( const string< Allocator > & lhs,
const char * rhs )

◆ allocate_unique()

template<class T , class Alloc , class... Args>
CUDA NI unique_ptr< T, Alloc > battery::allocate_unique ( const Alloc & alloc,
Args &&... args )

◆ make_unique()

template<class T , class Alloc , class... Args>
CUDA unique_ptr< T, Alloc > battery::make_unique ( Args &&... args)

Similar to allocate_unique but with an default-constructed allocator.

◆ swap()

template<class T >
CUDA constexpr void battery::swap ( T & a,
T & b )
inlineconstexpr

◆ strlen()

CUDA size_t battery::strlen ( const char * str)
inline

◆ strcmp()

CUDA int battery::strcmp ( const char * s1,
const char * s2 )
inline

◆ min()

template<class T >
CUDA INLINE constexpr T battery::min ( T a,
T b )
constexpr

◆ max()

template<class T >
CUDA INLINE constexpr T battery::max ( T a,
T b )
constexpr

◆ isnan()

template<class T >
CUDA constexpr T battery::isnan ( T a)
constexpr

◆ nextafter() [1/2]

CUDA CONSTEXPR_NEXTAFTER float battery::nextafter ( float f,
float dir )
inline

◆ nextafter() [2/2]

CUDA CONSTEXPR_NEXTAFTER double battery::nextafter ( double f,
double dir )
inline

◆ ru_cast()

template<class To , class From , bool map_limits = true>
CUDA NI constexpr To battery::ru_cast ( From x)
constexpr

Cast the variable x from type From to type To following upper rounding rule (cast in the direction of infinity). Minimal and maximal values of From are interpreted as infinities, and are therefore mapped to the infinities of the new types accordingly (e.g., float INF maps to int MAX_INT).

  • On CPU: Rounding mode is UPWARD after this operation.
  • On GPU: CUDA intrinsics are used.

Overflow: Nothing is done to prevent overflow, it mostly behaves as with static_cast.

◆ rd_cast()

template<class To , class From , bool map_limits = true>
CUDA NI constexpr To battery::rd_cast ( From x)
constexpr

Cast the variable x from type From to type To following down rounding rule (cast in the direction of negative infinity). Minimal and maximal values of From are interpreted as infinities, and are therefore mapped to the infinities of the new types accordingly (e.g., float INF maps to int MAX_INT).

  • On CPU: Rounding mode is DOWNWARD after this operation.
  • On GPU: CUDA intrinsics are used.

Overflow: Nothing is done to prevent overflow, it mostly behaves as with static_cast.

◆ popcount()

template<class T >
CUDA NI constexpr int battery::popcount ( T x)
constexpr

◆ countl_zero()

template<class T >
CUDA NI constexpr int battery::countl_zero ( T x)
constexpr

◆ countl_one()

template<class T >
CUDA NI constexpr int battery::countl_one ( T x)
constexpr

◆ countr_zero()

template<class T >
CUDA NI constexpr int battery::countr_zero ( T x)
constexpr

◆ countr_one()

template<class T >
CUDA NI constexpr int battery::countr_one ( T x)
constexpr

◆ signum()

template<class T >
CUDA constexpr int battery::signum ( T val)
constexpr

◆ ipow()

template<class T >
CUDA NI constexpr T battery::ipow ( T a,
T b )
constexpr

Precondition: T is an integer with b >= 0.

◆ add_up()

template<class T >
CUDA constexpr T battery::add_up ( T x,
T y )
constexpr

◆ add_down()

template<class T >
CUDA constexpr T battery::add_down ( T x,
T y )
constexpr

◆ sub_up()

template<class T >
CUDA constexpr T battery::sub_up ( T x,
T y )
constexpr

◆ sub_down()

template<class T >
CUDA constexpr T battery::sub_down ( T x,
T y )
constexpr

◆ mul_up()

template<class T >
CUDA constexpr T battery::mul_up ( T x,
T y )
constexpr

◆ mul_down()

template<class T >
CUDA constexpr T battery::mul_down ( T x,
T y )
constexpr

◆ div_up()

template<class T >
CUDA constexpr T battery::div_up ( T x,
T y )
constexpr

◆ div_down()

template<class T >
CUDA constexpr T battery::div_down ( T x,
T y )
constexpr

◆ tdiv()

template<class T >
CUDA constexpr T battery::tdiv ( T x,
T y )
constexpr

◆ tmod()

template<class T >
CUDA constexpr T battery::tmod ( T x,
T y )
constexpr

◆ fdiv()

template<class T >
CUDA constexpr T battery::fdiv ( T x,
T y )
constexpr

◆ fmod()

template<class T >
CUDA constexpr T battery::fmod ( T x,
T y )
constexpr

◆ cdiv()

template<class T >
CUDA constexpr T battery::cdiv ( T x,
T y )
constexpr

◆ cmod()

template<class T >
CUDA constexpr T battery::cmod ( T x,
T y )
constexpr

◆ ediv()

template<class T >
CUDA constexpr T battery::ediv ( T x,
T y )
constexpr

◆ emod()

template<class T >
CUDA constexpr T battery::emod ( T x,
T y )
constexpr

◆ print() [1/15]

template<typename T >
CUDA NI void battery::print ( const T & t)

◆ print() [2/15]

template<>
CUDA NI void battery::print ( const bool & x)
inline

◆ print() [3/15]

template<>
CUDA NI void battery::print ( const char & x)
inline

◆ print() [4/15]

template<>
CUDA NI void battery::print ( const short & x)
inline

◆ print() [5/15]

template<>
CUDA NI void battery::print ( const int & x)
inline

◆ print() [6/15]

template<>
CUDA NI void battery::print ( const long long int & x)
inline

◆ print() [7/15]

template<>
CUDA NI void battery::print ( const long int & x)
inline

◆ print() [8/15]

template<>
CUDA NI void battery::print ( const unsigned char & x)
inline

◆ print() [9/15]

template<>
CUDA NI void battery::print ( const unsigned short & x)
inline

◆ print() [10/15]

template<>
CUDA NI void battery::print ( const unsigned int & x)
inline

◆ print() [11/15]

template<>
CUDA NI void battery::print ( const unsigned long & x)
inline

◆ print() [12/15]

template<>
CUDA NI void battery::print ( const unsigned long long & x)
inline

◆ print() [13/15]

template<>
CUDA NI void battery::print ( const float & x)
inline

◆ print() [14/15]

template<>
CUDA NI void battery::print ( const double & x)
inline

◆ print() [15/15]

template<>
CUDA NI void battery::print ( char const *const & x)
inline

◆ get() [1/2]

template<size_t i, typename... Ts>
CUDA impl::variant_alternative< i, Ts... >::type & battery::get ( variant< Ts... > & v)

◆ get() [2/2]

template<size_t i, typename... Ts>
CUDA const impl::variant_alternative< i, Ts... >::type & battery::get ( const variant< Ts... > & v)

◆ operator==() [4/5]

template<typename... Ts>
CUDA NI bool battery::operator== ( const variant< Ts... > & lhs,
const variant< Ts... > & rhs )

◆ operator==() [5/5]

template<class T1 , class Alloc1 , class T2 , class Alloc2 >
CUDA NI bool battery::operator== ( const vector< T1, Alloc1 > & lhs,
const vector< T2, Alloc2 > & rhs )