Provides additional utility functionality used by multiple modules.
More...
|
| Bloom Filter |
| Provides seqan3:bloom_filter.
|
|
| Builtin Character Operations |
| Provides various operations on character types.
|
|
| Concept |
| Provides various general purpose concepts.
|
|
| Container |
| Provides various general purpose container and concepts.
|
|
| Parallel |
| This module contains types and utilities for concurrent execution of algorithms in SeqAn.
|
|
| Range |
| The range module provides general purpose range concepts.
|
|
| SIMD |
| The simd module contains a unified interface to provide simd types and functions used in seqan3.
|
|
| Tuple |
| Additional helper utilities for "tuple" types like std::tuple, std::pair, seqan3::pod_tuple that are not specific to a SeqAn module.
|
|
| Type List |
| Provides seqan3::type_list and metaprogramming utilities for working on type lists.
|
|
| Type Pack |
| Provides metaprogramming utilities for working on template parameter packs.
|
|
| Type Traits |
| Provides various type traits and their shortcuts.
|
|
| Views |
| Views are "lazy range combinators" that offer modified views onto other ranges.
|
|
|
template<std::unsigned_integral unsigned_t> |
constexpr unsigned_t | seqan3::detail::ceil_log2 (unsigned_t const n) noexcept |
| Computes the ceil of the logarithm to the base of two for unsigned integers.
|
|
template<std::unsigned_integral unsigned_t> |
constexpr unsigned_t | seqan3::detail::floor_log2 (unsigned_t const n) noexcept |
| Computes the floor of the logarithm to the base of two for unsigned integers.
|
|
template<typename base_t , std::unsigned_integral exp_t>
requires (std::same_as<base_t, uint64_t> || std::same_as<base_t, int64_t>) |
base_t | seqan3::pow (base_t base, exp_t exp) |
| Computes the value of base raised to the power exp .
|
|
template<std::integral type> |
constexpr type | seqan3::detail::to_little_endian (type const in) noexcept |
| Convert the byte encoding of integer values to little-endian byte order.
|
|
Provides additional utility functionality used by multiple modules.
The utility module contains concepts, functions, traits and classes that are independent of the remaining modules in SeqAn. These implementations are considered external functionality, i.e. they could have been outsourced into their own libraries.
The utility module has no dependency to any other module except the Core module.
◆ ceil_log2()
template<std::unsigned_integral unsigned_t>
constexpr unsigned_t seqan3::detail::ceil_log2 |
( |
unsigned_t const |
n | ) |
|
|
constexprnoexcept |
Computes the ceil of the logarithm to the base of two for unsigned integers.
- Parameters
-
[in] | n | An unsigned integer. |
- Attention
- n = 0 is a special case and is undefined.
- Returns
- \( \lceil log_2(n) \rceil \).
The difference to std::ceil(std::log2(n))
is that everything is computed exactly (without precision loss due to promoting to double
)
Example
int main()
{
return 0;
}
Provides seqan3::debug_stream and related types.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:37
constexpr unsigned_t ceil_log2(unsigned_t const n) noexcept
Computes the ceil of the logarithm to the base of two for unsigned integers.
Definition math.hpp:85
Provides math related functionality.
Exception
No-throw guarantee.
Thread-safety
Thread safe.
Complexity
Constant.
◆ floor_log2()
template<std::unsigned_integral unsigned_t>
constexpr unsigned_t seqan3::detail::floor_log2 |
( |
unsigned_t const |
n | ) |
|
|
constexprnoexcept |
Computes the floor of the logarithm to the base of two for unsigned integers.
- Parameters
-
[in] | n | An unsigned integer. |
- Attention
- n = 0 is a special case and is undefined.
- Returns
- \( \lfloor log_2(n) \rfloor \).
The difference to std::floor(std::log2(n))
is that everything is computed exactly (without precision loss due to promoting to double
)
Example
int main()
{
return 0;
}
constexpr unsigned_t floor_log2(unsigned_t const n) noexcept
Computes the floor of the logarithm to the base of two for unsigned integers.
Definition math.hpp:51
Exception
No-throw guarantee.
Thread-safety
Thread safe.
Complexity
Constant.
◆ pow()
template<typename base_t , std::unsigned_integral exp_t>
requires (std::same_as<base_t, uint64_t> || std::same_as<base_t, int64_t>)
base_t seqan3::pow |
( |
base_t |
base, |
|
|
exp_t |
exp |
|
) |
| |
Computes the value of base
raised to the power exp
.
- Parameters
-
[in] | base | The base to compute the power for. |
[in] | exp | The power to raise base to. |
- Returns
- \( base^{exp} \).
- Exceptions
-
- See also
- https://en.cppreference.com/w/cpp/numeric/math/pow
The difference to std::pow
is that the powers of an integer base
are computed exact (without precision loss due to promoting to double
) iff exp_t
models std::unsigned_integral
and
base_t
models std::unsigned_integral
(returns uint64_t
)
base_t
models std::integral
, but not std::unsigned_integral
(returns int64_t
)
In all other cases the return value and type is equivalent to that of std::pow
.
Example
int main()
{
seqan3::debug_stream << static_cast<uint64_t>(
std::pow(5u, 25u)) <<
'\n';
}
base_t pow(base_t base, exp_t exp)
Computes the value of base raised to the power exp.
Definition math.hpp:119
◆ to_little_endian()
template<std::integral type>
constexpr type seqan3::detail::to_little_endian |
( |
type const |
in | ) |
|
|
constexprnoexcept |
Convert the byte encoding of integer values to little-endian byte order.
- Template Parameters
-
type | The type of the value to convert; must model std::integral. |
- Parameters
-
in | The input value to convert. |
- Returns
- the converted value in little-endian byte-order.
This function swaps the bytes if the host system uses big endian. In this case only 1, 2, 4, or 8 byte big integral types are allowed as input. On host systems with little endian this function is a no-op and returns the unchanged input value. Other systems with mixed endianness are not supported.
◆ bits_of
template<typename type_t >
constexpr auto seqan3::detail::bits_of = min_viable_uint_v<CHAR_BIT * sizeof(type_t)> |
|
constexpr |
How many bits has a type?
- Template Parameters
-
type_t | The type to determine the number of bits. |
◆ min_viable_uint_v
template<uint64_t value>
constexpr auto seqan3::detail::min_viable_uint_v = static_cast<min_viable_uint_t<value>>(value) |
|
constexpr |
Given a value, cast the value as the smallest unsigned integer that can hold it.
- See also
- seqan3::min_viable_uint_t
◆ size_in_values_v
template<typename int_t >
constexpr size_t seqan3::detail::size_in_values_v |
|
constexpr |
Initial value:
Return the number of values an integral type can have, i.e. the difference between min and max.
◆ type_name_as_string
Defines the human-readable name of the given type using the typeid operator.
- Template Parameters
-
type | The type to get the human-readable name for. |
On gcc and clang std::type_info only returns a mangled name. The mangled name can be converted to human-readable form using implementation-specific API such as abi::__cxa_demangle. In other implementations the name returned is already human-readable.
- Note
- The returned name is implementation defined and might change between different tool chains.