LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mtrace_merge.h File Reference

Superposes two single-class traces into one marked trace, labelling the events of the first stream 1 and those of the second 2. More...

#include <algorithm>
#include <cstddef>
#include <vector>
#include "line/api/trace/trace_types.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for mtrace_merge.h:

Go to the source code of this file.

Classes

struct  line::trace::MtraceMergeResult< T >
 Return value of mtrace_merge, mirroring [T, L]. More...

Namespaces

namespace  line
namespace  line::trace

Functions

template<class T>
MtraceMergeResult< T > line::trace::mtrace_merge (const std::vector< T > &t1, const std::vector< T > &t2)
 Superposes two single-class traces into one marked trace, labelling the events of the first stream 1 and those of the second 2.

Detailed Description

Superposes two single-class traces into one marked trace, labelling the events of the first stream 1 and those of the second 2.

Templated port of matlab/lib/m3a/m3a/mtrace/mtrace_merge.m, cross-checked against jar/src/main/java/jline/api/trace/Mtrace_merge.java (identical; the JAR carries an explicit comment that the single shared time origin sort([0; cumsum(t1); cumsum(t2)]) matters, since merging the two cumulative-sum vectors with separate origins injects a spurious zero-length interval).

Ties are broken in favour of the first stream, which is MATLAB's stable sort and is reproduced with std::stable_sort.

ARITHMETIC: a merge and pairwise differences, exact in Rational.

Definition in file mtrace_merge.h.