C(++)ECCO
C++ Error Control COding: a header-only library for ECC simulations and experiments, modeling complete coding systems across arbitrary finite fields and complex inter-field relationships - Christian Senger <senger@inue.uni-stuttgart.de>
Loading...
Searching...
No Matches
helpers.hpp File Reference

Utility functions and mathematical helpers. More...

#include <algorithm>
#include <atomic>
#include <cmath>
#include <cstdint>
#include <functional>
#include <limits>
#include <mutex>
#include <new>
#include <optional>
#include <random>
#include <stdexcept>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include "InfInt.hpp"
Include dependency graph for helpers.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CECCO::RNG
 Thread-local random number generator with shared seeding policy. More...
struct  CECCO::details::CacheEntry< ID, T >
 Cache entry specification. More...
class  CECCO::details::Cache< ENTRIES >
 Heterogeneous cache indexed by entry ID. More...
class  CECCO::details::OnceCache< T >
 Thread-safe single-value cache. More...

Namespaces

namespace  CECCO
 Provides a framework for error correcting codes.
namespace  CECCO::details
 Contains implementation details not to be exposed to the user. Functions and classes here may change without notice.

Functions

std::mt19937 & CECCO::gen ()
 Current thread's random number generator.
template<class T>
std::vector< size_t > CECCO::find_maxima (const std::vector< T > &v)
 Indices of all maximum elements.
template<class T>
constexpr bool CECCO::is_prime (T a) noexcept
 Primality test by trial division.
template<class T>
constexpr T CECCO::GCD (T a, T b, T *s=nullptr, T *t=nullptr) noexcept
 Greatest common divisor and optional Bézout coefficients.
template<uint16_t p, class T>
constexpr T CECCO::modinv (T a) noexcept
 Multiplicative inverse modulo a prime.
template<class T>
CECCO::fac (T a) noexcept
 Factorial a!
template<class T>
CECCO::bin (const T &n, T k) noexcept
 Binomial coefficient C(n,k).
template<>
InfInt CECCO::bin (const InfInt &n, InfInt k) noexcept
 Binomial coefficient specialization for InfInt.
template<class T>
constexpr T CECCO::sqm (T b, int e)
 Exponentiation by square-and-multiply.
template<class T>
constexpr T CECCO::daa (T b, int m)
 Scalar multiplication by double-and-add.
constexpr double CECCO::details::floor_constexpr (double x)
 Constexpr floor function.
std::string CECCO::details::basename (const char *path)

Variables

static const uint8_t CECCO::details::colormap [64][3]

Detailed Description

Utility functions and mathematical helpers.

Author
Christian Senger senge.nosp@m.r@in.nosp@m.ue.un.nosp@m.i-st.nosp@m.uttga.nosp@m.rt.d.nosp@m.e
Version
2.1.1
Date
2026

Licensed for noncommercial use only, including academic teaching, research, and personal non-profit purposes. Commercial use is prohibited without a separate commercial license. See the LICENSE file in the repository root for full terms and how to request a commercial license.

Description

This header collects small utilities used by the algebraic types: random number generation, integer arithmetic, square-and-multiply exponentiation, double-and-add multiplication, caching, maxima, constexpr floor, and divisibility tests.

Definition in file helpers.hpp.