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
CECCO::Trellis< T >::Viterbi_Workspace< cost_t > Struct Template Reference

Workspace for Viterbi decoding on this trellis. More...

#include <trellises.hpp>

Public Member Functions

 Viterbi_Workspace (const Trellis &tr)
 Allocate metric arrays for tr.
void calculate_edge_costs (const Trellis &tr, const Vector< T > &r)
 Set hard-decision edge costs from received word r.
void calculate_edge_costs (const Trellis &tr, const Vector< double > &llrs)
 Set soft edge costs from binary LLRs.

Public Attributes

std::vector< cost_t > path_costs_prev
 Path costs from the previous layer.
std::vector< cost_t > path_costs_curr
 Path costs for the current layer.
std::vector< std::vector< const details::Edge< T > * > > backptrs
 Backpointer selected for each vertex and layer.
std::vector< uint16_t > tie_counts
 Number of equal-cost paths seen for randomized tie-breaking.
std::vector< std::vector< cost_t > > edge_costs
 Edge cost for each segment and edge index.
std::optional< std::variant< Vector< T >, Vector< double > > > v
 Optional received vector shown in TikZ output.

Static Public Attributes

static constexpr bool is_soft = std::is_floating_point_v<cost_t>
 True for floating-point soft metrics.
static constexpr cost_t init
 Initial path cost used for unreachable vertices.

Detailed Description

template<FieldType T>
template<typename cost_t>
requires std::integral<cost_t> || std::floating_point<cost_t>
struct CECCO::Trellis< T >::Viterbi_Workspace< cost_t >

Workspace for Viterbi decoding on this trellis.

Template Parameters
cost_tIntegral type for hard-decision costs or floating-point type for soft costs

Stores path metrics for two adjacent layers, edge costs, tie counts, and backpointers. Construct it from the trellis before calling the Viterbi routines in codes.hpp.

Definition at line 184 of file trellises.hpp.

Constructor & Destructor Documentation

◆ Viterbi_Workspace()

template<FieldType T>
template<typename cost_t>
CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::Viterbi_Workspace ( const Trellis & tr)
explicit

Allocate metric arrays for tr.

Parameters
trTrellis whose layer and edge sizes define the workspace

Definition at line 451 of file trellises.hpp.

Member Function Documentation

◆ calculate_edge_costs() [1/2]

template<FieldType T>
requires std::floating_point<cost_t> && std::is_same_v<T, Fp<2>>
template<typename cost_t>
requires std::floating_point<cost_t> && std::is_same_v<T, Fp<2>>
void CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::calculate_edge_costs ( const Trellis & tr,
const Vector< double > & llrs )

Set soft edge costs from binary LLRs.

Parameters
trBinary trellis whose edges define candidate bits
llrsLog-likelihood ratios; length must equal the number of segments
Exceptions
std::invalid_argumentif llrs.get_n() != tr.E.size()

Definition at line 483 of file trellises.hpp.

◆ calculate_edge_costs() [2/2]

template<FieldType T>
requires std::integral<cost_t>
template<typename cost_t>
requires std::integral<cost_t>
void CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::calculate_edge_costs ( const Trellis & tr,
const Vector< T > & r )

Set hard-decision edge costs from received word r.

Parameters
trTrellis whose edges define candidate symbols
rReceived word; length must equal the number of segments
Exceptions
std::invalid_argumentif r.get_n() != tr.E.size()

With erasure support, erased received symbols give cost 0 on all outgoing labels.

Definition at line 466 of file trellises.hpp.

Member Data Documentation

◆ backptrs

template<FieldType T>
template<typename cost_t>
std::vector<std::vector<const details::Edge<T>*> > CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::backptrs

Backpointer selected for each vertex and layer.

Definition at line 225 of file trellises.hpp.

◆ edge_costs

template<FieldType T>
template<typename cost_t>
std::vector<std::vector<cost_t> > CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::edge_costs

Edge cost for each segment and edge index.

Definition at line 229 of file trellises.hpp.

◆ init

template<FieldType T>
template<typename cost_t>
cost_t CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::init
staticconstexpr
Initial value:
=
is_soft ? std::numeric_limits<cost_t>::infinity() : std::numeric_limits<cost_t>::max()
static constexpr bool is_soft
True for floating-point soft metrics.

Initial path cost used for unreachable vertices.

Definition at line 188 of file trellises.hpp.

◆ is_soft

template<FieldType T>
template<typename cost_t>
bool CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::is_soft = std::is_floating_point_v<cost_t>
staticconstexpr

True for floating-point soft metrics.

Definition at line 186 of file trellises.hpp.

◆ path_costs_curr

template<FieldType T>
template<typename cost_t>
std::vector<cost_t> CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::path_costs_curr

Path costs for the current layer.

Definition at line 223 of file trellises.hpp.

◆ path_costs_prev

template<FieldType T>
template<typename cost_t>
std::vector<cost_t> CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::path_costs_prev

Path costs from the previous layer.

Definition at line 221 of file trellises.hpp.

◆ tie_counts

template<FieldType T>
template<typename cost_t>
std::vector<uint16_t> CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::tie_counts

Number of equal-cost paths seen for randomized tie-breaking.

Definition at line 227 of file trellises.hpp.

◆ v

template<FieldType T>
template<typename cost_t>
std::optional<std::variant<Vector<T>, Vector<double> > > CECCO::Trellis< T >::Viterbi_Workspace< cost_t >::v

Optional received vector shown in TikZ output.

Definition at line 231 of file trellises.hpp.


The documentation for this struct was generated from the following file: