LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::mc Namespace Reference

Classes

struct  BicgstabMultiResult
struct  BicgstabResult
struct  BlkDecompResult
struct  CourtoisResult
struct  CtmcGateResult
 The gate verdict, plus the message the caller reports either way. More...
struct  CtmcPath
 One simulated sample path: the state visited at each step and its holding time. More...
struct  CtmcSizeOptions
 Options the estimator reads; only the cutoff matters. More...
struct  FauResult
struct  FoxGlynnResult
struct  GmresMultiResult
struct  GmresResult
struct  KmsResult
class  LcgUniform
 Deterministic uniform [0,1) source, so that a caller who does not have one still has no reason to reach for a global stream. More...
struct  MultiResult
struct  PassageCurve
 A passage-time law on a grid. More...
struct  PassageMoments
 Per-source and pi0-weighted passage moments. More...
struct  PassagePh
 The phase-type form of a first passage time. More...
struct  PerronState
 Perron root of A(theta) with its first two derivatives and the amplitude. More...
struct  PseudoStochCompResult
 Blocks of the partition together with the pseudo complement over I. More...
struct  RandomizationResult
struct  ReducibleResult
struct  SaddlepointResult
 One entry per (t,k) pair. More...
struct  SccResult
struct  StochCompResult
struct  TakahashiResult
struct  TimeAverageResult
struct  TransientResult
struct  TransientSensResult
struct  UniformizationResult
struct  WeakCompResult
 Number of weakly connected components and the per-node label (weaklyconncomp.m). More...

Enumerations

enum  SaddlepointMethod { SADDLEPOINT_DANIELS2 = 0 , SADDLEPOINT_DANIELS = 1 , SADDLEPOINT_PLAIN = 2 }
 Which term of the steepest-descent expansion to stop at. More...

Functions

template<class T>
BicgstabResult< T > ctmc_bicgstab (const Matrix< T > &A, const std::vector< T > &b, double tol=1e-12, long maxit=0, const std::vector< T > &x0=std::vector< T >())
 Preconditioned stabilized biconjugate gradients, for the linear systems a generator produces.
template<class T>
BicgstabMultiResult< T > ctmc_bicgstab_multi (const Matrix< T > &A, const Matrix< T > &B, double tol=1e-12, long maxit=0)
 Every column of B solved against the SAME equilibration, reordering and ILUT factorization, each column starting from the previous column's solution.
template<class T>
CourtoisResult< T > ctmc_courtois (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS, const T &q)
 Courtois decomposition of a nearly completely decomposable (NCD) CTMC.
template<class T>
CourtoisResult< T > ctmc_courtois (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS)
 Overload deriving the rate as MATLAB does, q = (21/20) max|Qperm|.
template<class T>
FauResult< T > ctmc_fau (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double epsilon=1e-6, double delta=1e-12, long maxsteps=-1)
 Transient distribution of a CTMC by fast adaptive uniformization.
template<class T>
FoxGlynnResult< T > ctmc_foxglynn (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double tol=1e-12, long maxiter=-1)
 Transient distribution of a CTMC by uniformization with Fox-Glynn Poisson weights.
template<class T>
GmresResult< T > ctmc_gmres (const Matrix< T > &A, const std::vector< T > &b, double tol=1e-12, long restart=0, long maxit=0, const std::vector< T > &x0=std::vector< T >())
 Restarted GMRES with an ILUT preconditioner, for the linear systems a generator produces.
template<class T>
GmresMultiResult< T > ctmc_gmres_multi (const Matrix< T > &A, const Matrix< T > &B, double tol=1e-12, long restart=0, long maxit=0)
 Restarted GMRES for a block of right-hand sides sharing one coefficient matrix.
template<class T>
bool ctmc_isfeasible (const Matrix< T > &Q, const T &tol)
 True when Q is square, has nonnegative off-diagonals, nonpositive diagonal and zero row sums.
template<class T>
bool ctmc_isfeasible (const Matrix< T > &Q)
 Default tolerance 1e-10, matching the MATLAB signature.
template<class T>
int dtmc_isfeasible (const Matrix< T > &P)
 Largest precision level 1..15 at which P is stochastic, or 0 when none holds.
template<class T>
KmsResult< T > ctmc_kms (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS, std::size_t numSteps)
 Koury-McAllister-Stewart aggregation-disaggregation for a nearly completely decomposable CTMC.
double ctmc_available_memory_bytes ()
 Available physical memory in bytes.
CtmcGateResult ctmc_memory_gate (double log_nstates, bool force=false, double safety_fraction=CTMC_DEFAULT_SAFETY_FRACTION)
 Decide whether a state space of log-size log_nstates can be solved here.
template<class T>
MultiResult< T > ctmc_multi (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS, const std::vector< std::vector< std::size_t > > &MSS, const T &q)
 Two-level multigrid aggregation-disaggregation for a nearly completely decomposable CTMC.
template<class T>
MultiResult< T > ctmc_multi (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS, const std::vector< std::vector< std::size_t > > &MSS)
 Overload deriving the rate as MATLAB does, q = (21/20) max|Qperm|.
template<class T>
PassagePh< T > ctmc_passage_ph (const Matrix< T > &Q, const std::vector< T > &pi0, const std::vector< std::size_t > &target)
 Phase-type representation of the first passage time from pi0 into target.
template<class T>
std::vector< std::complex< double > > ctmc_passage_lst (const Matrix< T > &Q, const std::vector< T > &pi0, const std::vector< std::size_t > &target, const std::vector< std::complex< double > > &s)
 L(s) = alpha (sI-S)^{-1} s0 + atom at the (complex) points s.
template<class T>
PassageMoments< T > ctmc_passage_moments (const Matrix< T > &Q, const std::vector< T > &pi0, const std::vector< std::size_t > &target, std::size_t nmax=1)
 Moments of order 1..nmax of the first passage time into target.
template<class T>
std::vector< T > ctmc_hitting_time (const Matrix< T > &Q, const std::vector< std::size_t > &target)
 Mean time to reach any state in target from each state of a CTMC.
template<class T>
PassageCurve< T > ctmc_passage_time (const Matrix< T > &Q, const std::vector< T > &pi0, const std::vector< std::size_t > &target, const std::vector< double > &tset, const std::string &method="expm", const std::string &lti_method="euler")
 CDF and density of the first passage time on the grid tset: F(t) = 1 - alpha exp(St) 1 and f(t) = alpha exp(St) s0.
template<class T>
PassageMoments< T > smp_passage_moments (const Matrix< T > &P, const Matrix< T > &hmom, const std::vector< T > &pi0, const std::vector< std::size_t > &target, std::size_t nmax=1)
 Moments of the semi-Markov first passage time from the per-state holding moments m_i(r), Eq.
template<class T>
std::vector< std::complex< double > > smp_passage_lst (const Matrix< T > &P, const std::vector< std::function< std::complex< double >(std::complex< double >)> > &hlst, const std::vector< T > &pi0, const std::vector< std::size_t > &target, const std::vector< std::complex< double > > &s)
 L(s) of the semi-Markov first passage time, Eqs.
template<class T>
PassageCurve< T > smp_passage_time (const Matrix< T > &P, const std::vector< std::function< std::complex< double >(std::complex< double >)> > &hlst, const std::vector< T > &pi0, const std::vector< std::size_t > &target, const std::vector< double > &tset, const std::string &lti_method="euler")
 CDF and density of the semi-Markov first passage time, by inverting smp_passage_lst through api/lti.
template<class T>
PseudoStochCompResult< T > ctmc_pseudostochcomp (const Matrix< T > &Q, const std::vector< std::size_t > &keep)
 Pseudo stochastic complement of a CTMC partition.
template<class T>
PseudoStochCompResult< T > ctmc_pseudostochcomp (const Matrix< T > &Q)
 Default partition: the first ceil(n/2) states.
template<class T, class Gen>
Matrix< T > ctmc_rand (std::size_t n, Gen &gen)
 Random infinitesimal generator of a CTMC.
template<class T>
ctmc_maxabs (const Matrix< T > &Q)
 Largest magnitude of any entry of Q; equals max_i |q_ii| for a generator.
template<class T>
RandomizationResult< T > ctmc_randomization (const Matrix< T > &Q, const T &q)
 Uniformization (randomization) of a CTMC: the embedded DTMC P = I + Q/q.
template<class T>
RandomizationResult< T > ctmc_randomization (const Matrix< T > &Q)
 Deterministic default rate (21/20) max|Q|; see the defect note above.
template<class T>
std::vector< T > ctmc_relsolve (const Matrix< T > &Qin, std::size_t refstate)
 Stationary measure scaled so that entry refstate equals one.
template<class T>
std::vector< T > ctmc_relsolve (const Matrix< T > &Q)
 Reference state 1 in the MATLAB numbering, i.e.
template<class T>
PerronState< T > ctmc_saddlepoint_perron (const Matrix< T > &D0, const Matrix< T > &D1, const std::vector< T > &pi0, const T &th)
 Perron root of A(th) = D0 + exp(th)*D1 with deta, d2eta and the amplitude.
template<class T>
SaddlepointResult< T > ctmc_saddlepoint (const Matrix< T > &D0, const Matrix< T > &D1, const std::vector< T > &t, const std::vector< long > &k, SaddlepointMethod method=SADDLEPOINT_DANIELS2, const std::vector< T > &pi0=std::vector< T >())
 Pr{N(t)=k} over arrays of horizons and counts.
template<class T>
ctmc_saddlepoint (const Matrix< T > &D0, const Matrix< T > &D1, const T &t, long k, SaddlepointMethod method=SADDLEPOINT_DANIELS2)
 Pr{N(t)=k} at a single (t,k), with the default method.
template<class T>
std::vector< T > ctmc_sens (const Matrix< T > &Q, const Matrix< T > &dQ, const std::vector< T > &pi)
 Sensitivity of the steady-state distribution of a CTMC to a scalar parameter.
template<class T>
std::vector< T > ctmc_sens (const Matrix< T > &Q, const Matrix< T > &dQ)
 Overload computing the steady-state vector itself, as MATLAB does.
template<class T>
std::vector< T > ctmc_simulate_reference_initial_law (const std::vector< T > &pi0)
 The initial-state law that ctmc_simulate.m actually realizes for a given pi0, as opposed to pi0 itself.
template<class T>
CtmcPath< T > ctmc_simulate (const Matrix< T > &Q, const std::vector< T > &pi0, std::size_t n, pfqn::McRng &rng)
 Simulate n steps of the CTMC with generator Q.
template<class T>
Matrix< T > ctmc_makeinfgen (const Matrix< T > &Q)
 Set the diagonal so that every row sums to zero (ctmc_makeinfgen).
template<class T>
std::vector< T > ctmc_solve (const Matrix< T > &Qin)
 Steady-state distribution of a continuous-time Markov chain.
template<class T>
ReducibleResult< T > ctmc_solve_reducible (const Matrix< T > &Q, const std::vector< T > &pi0, double zeroColTol=1e-12)
 Limiting distribution of a CTMC whose generator may be reducible.
template<class T>
ReducibleResult< T > ctmc_solve_reducible (const Matrix< T > &Q, double zeroColTol=1e-12)
 Overload without an initial vector.
template<class T>
BlkDecompResult< T > ctmc_solve_reducible_blkdecomp (const Matrix< T > &Qin, const std::vector< T > &pin, double reachTol=1e-15, double zeroColTol=1e-12)
 Limiting distribution of a reducible CTMC by direct block decomposition of the generator.
template<class T>
BlkDecompResult< T > ctmc_solve_reducible_blkdecomp (const Matrix< T > &Q, double reachTol=1e-15, double zeroColTol=1e-12)
 Overload without an initial vector.
double log_ordered_joint (const std::vector< std::vector< int > > &caps_per, const std::vector< double > &cap_tot, const std::vector< int > &njobs, std::size_t m_rem)
 Log count of (placement, ordering) configurations over ALL order-preserving stations at once, POPULATION CONSERVED.
template<class T>
double ctmc_state_space_logsize (const qn::NetworkStruct< T > &sn, const CtmcSizeOptions &opt=CtmcSizeOptions())
 Worst-case log state-space size of sn.
template<class T>
Matrix< T > dtmc_stmonotone (const Matrix< T > &P)
template<class T>
Matrix< T > ctmc_stmonotone (const Matrix< T > &Q)
 Stochastically monotone upper bound of a Markov chain.
template<class T>
TakahashiResult< T > ctmc_takahashi (const Matrix< T > &Q, const std::vector< std::vector< std::size_t > > &MS, std::size_t numSteps, double massTol=1e-14)
 Takahashi's aggregation-disaggregation for a nearly completely decomposable CTMC.
template<class T>
bool ctmc_testpf_kolmogorov (const Matrix< T > &Qin)
 Kolmogorov reversibility criterion, used as a product-form test.
template<class T>
Matrix< T > ctmc_timereverse (const Matrix< T > &Q)
 Generator of the time-reversed CTMC.
template<class T>
Matrix< T > dtmc_timereverse (const Matrix< T > &P)
 Transition matrix of the time-reversed DTMC.
template<class T>
TransientResult< T > ctmc_transient (const Matrix< T > &Q, const std::vector< T > &pi0, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6)
 Transient distribution of a CTMC over a time interval, by integrating the forward equations d pi/dt = pi Q.
template<class T>
TransientResult< T > ctmc_transient (const Matrix< T > &Q, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6)
 Overload starting from the uniform distribution, as MATLAB's short forms do.
template<class T>
TransientResult< T > ctmc_transient_on_grid (const Matrix< T > &Q, const TransientResult< T > &r, const std::vector< T > &grid)
 Resample an adaptive transient onto the uniform grid t0 : dt : t1.
template<class T>
TransientResult< T > ctmc_transient_on_grid (const Matrix< T > &Q, const TransientResult< T > &r, const T &t0, const T &t1, const T &dt)
template<class T>
TransientSensResult< T > ctmc_transient_sens (const Matrix< T > &Q, const Matrix< T > &dQ, const std::vector< T > &pi0, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6)
 Sensitivity of the transient distribution of a CTMC to a scalar parameter.
template<class T>
TransientSensResult< T > ctmc_transient_sens (const Matrix< T > &Q, const Matrix< T > &dQ, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6)
 Overload starting from the uniform distribution, as MATLAB's short forms do.
template<class T>
UniformizationResult< T > ctmc_uniformization (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double tol=1e-12, long maxiter=-1)
 Transient distribution of a CTMC by uniformization (Jensen's method), and the time-averaged distribution over [0, t].
template<class T>
TimeAverageResult< T > ctmc_timeaverage (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double tol=1e-12, long maxiter=-1)
 Time-averaged distribution (1/t) int_0^t pi(u) du, plus pi(t) itself.
template<class T>
Matrix< T > dtmc_makestochastic (const Matrix< T > &Pin)
 Normalize a non-negative matrix into a stochastic transition matrix.
template<class T, class Gen>
Matrix< T > dtmc_rand (std::size_t n, Gen &gen)
 Random stochastic matrix, the uniformization of a random generator.
template<class T, class Gen>
std::vector< std::size_t > dtmc_simulate (const Matrix< T > &P, const std::vector< T > &pi0, std::size_t n, Gen &gen)
 Sample path of a DTMC, n states starting from pi0.
template<class T>
WeakCompResult< T > weaklyconncomp (const Matrix< T > &G)
 Weakly connected components of the graph whose adjacency is the support of G.
template<class T>
std::vector< T > dtmc_solve (const Matrix< T > &P)
 Stationary distribution of a stochastic matrix P.
template<class T>
StochCompResult< T > ctmc_stochcomp (const Matrix< T > &Q, const std::vector< std::size_t > &I)
template<class T>
StochCompResult< T > ctmc_stochcomp (const Matrix< T > &Q)
 Default subset: the first ceil(n/2) states, as in MATLAB.
template<class T>
ReducibleResult< T > dtmc_solve_reducible (const Matrix< T > &P, const std::vector< T > &pin, double zeroColTol=1e-12)
 Limiting distribution of a discrete-time Markov chain whose transition matrix may be reducible.
template<class T>
ReducibleResult< T > dtmc_solve_reducible (const Matrix< T > &P, double zeroColTol=1e-12)
 Overload without an initial vector.
template<class T>
Matrix< T > dtmc_stochcomp (const Matrix< T > &P, const std::vector< std::size_t > &keep)
 Stochastic complement of a DTMC partition, a port of matlab/lib/kpctoolbox/mc/dtmc_stochcomp.m.
template<class T>
Matrix< T > dtmc_transient (const Matrix< T > &P, const std::vector< T > &pi0, std::size_t steps)
 Trajectory of the law over steps transitions, row k holding pi0 P^k.
template<class T>
Matrix< T > dtmc_transient (const Matrix< T > &P)
 Uniform initial law and one step, matching the one-argument MATLAB call.
template<class T>
std::vector< T > dtmc_hitting_time (const Matrix< T > &P, const std::vector< std::size_t > &target)
 Expected number of steps to reach the target set, zero on the target set itself.
template<class T>
UniformizationResult< T > dtmc_uniformization (const std::vector< T > &pi0, const Matrix< T > &P, const T &t, double tol=1e-12, long maxiter=-1)
 Transient law of a DTMC through the uniformized generator of P.
template<class T>
SccResult stronglyconncomp (const Matrix< T > &A)
 Strongly connected components of a directed graph, and which of them are recurrent (closed under the successor relation).
template<class T>
tx_exp (const T &x)
 exp/log/isfinite through ADL, the idiom the rest of api/mc uses: using std::exp then an unqualified call, so a Real<D> or Rational picks up its own overload.
template<class T>
tx_log (const T &x)
template<class T>
bool tx_finite (const T &x)

Variables

constexpr long FAU_MAX_STEPS = 1000000
 Default cap on birth steps, so a pathological horizon reports truncation.
constexpr std::size_t GMRES_MIN_STATES = 6000
 Order above which the direct sparse factorization is abandoned in favour of the Krylov path.
constexpr double CTMC_BYTES_PER_NZ = 16.0
 8 bytes of value plus 8 amortized for the index, per stored nonzero.
constexpr double CTMC_DEFAULT_SAFETY_FRACTION = 0.6
 Fraction of available memory the solver may target.
constexpr double CTMC_FALLBACK_ALPHA = CTMC_BYTES_PER_NZ * 8.0
 Fallback power-law coefficients, identical to MATLAB and Python.
constexpr double CTMC_FALLBACK_BETA = 1.3
constexpr double CTMC_FALLBACK_AVAIL_BYTES = 1.0 * 1024.0 * 1024.0 * 1024.0
 Conservative available-memory default when the host probe fails.
static const double CTMC_SADDLEPOINT_K2_MIN = 5.0
 Below this value of K2 = t*eta''(theta*) the expansion is out of its regime.
constexpr double kOrderGridMax = 1.0e6
 Largest (m_1..m_K) box the exact ordered-buffer DP will walk.

Enumeration Type Documentation

◆ SaddlepointMethod

Which term of the steepest-descent expansion to stop at.

Enumerator
SADDLEPOINT_DANIELS2 

second order, error O(1/K2^2) – the DEFAULT

SADDLEPOINT_DANIELS 

first order with the Perron amplitude, O(1/K2)

SADDLEPOINT_PLAIN 

bare first order, amplitude set to 1

Definition at line 98 of file ctmc_saddlepoint.h.

Function Documentation

◆ ctmc_available_memory_bytes()

double line::mc::ctmc_available_memory_bytes ( )
inline

Available physical memory in bytes.

Never throws: a probe failure returns the conservative fallback, because a gate that cannot measure the host must not thereby become permissive.

Definition at line 75 of file ctmc_memory_gate.h.

References ctmc_available_memory_bytes(), and CTMC_FALLBACK_AVAIL_BYTES.

Referenced by ctmc_available_memory_bytes(), and ctmc_memory_gate().

◆ ctmc_bicgstab()

template<class T>
BicgstabResult< T > line::mc::ctmc_bicgstab ( const Matrix< T > & A,
const std::vector< T > & b,
double tol = 1e-12,
long maxit = 0,
const std::vector< T > & x0 = std::vector<T>() )

Preconditioned stabilized biconjugate gradients, for the linear systems a generator produces.

Parameters
Acoefficient matrix, already assembled
bright-hand side
tolrelative residual tolerance (default 1e-12)
maxitcomplete iterations; <= 0 selects min(n, 200)
x0initial guess; empty selects the uniform vector ones(n)/n

Definition at line 234 of file ctmc_bicgstab.h.

References line::Matrix< T >::cols(), ctmc_bicgstab(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by ctmc_bicgstab(), ctmc_solve(), and ctmc_takahashi().

◆ ctmc_bicgstab_multi()

template<class T>
BicgstabMultiResult< T > line::mc::ctmc_bicgstab_multi ( const Matrix< T > & A,
const Matrix< T > & B,
double tol = 1e-12,
long maxit = 0 )

Every column of B solved against the SAME equilibration, reordering and ILUT factorization, each column starting from the previous column's solution.

FLAG is zero only when every column converged; on any other value the result matrix is empty and the caller must fall back, a partially converged block leaving the fallback ambiguous.

Parameters
Acoefficient matrix
Bright-hand sides, one per column
tolrelative residual tolerance (default 1e-12)
maxitcomplete iterations per column; <= 0 selects min(n, 200)

Definition at line 264 of file ctmc_bicgstab.h.

References line::Matrix< T >::cols(), ctmc_bicgstab_multi(), line::mc::BicgstabMultiResult< T >::flag, line::mc::BicgstabResult< T >::flag, line::InputError::InputError(), line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), line::mc::BicgstabMultiResult< T >::X, and line::mc::BicgstabResult< T >::x.

Referenced by ctmc_bicgstab_multi().

◆ ctmc_courtois() [1/2]

template<class T>
CourtoisResult< T > line::mc::ctmc_courtois ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS )

Overload deriving the rate as MATLAB does, q = (21/20) max|Qperm|.

Definition at line 516 of file ctmc_courtois.h.

References ctmc_courtois().

◆ ctmc_courtois() [2/2]

template<class T>
CourtoisResult< T > line::mc::ctmc_courtois ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS,
const T & q )

◆ ctmc_fau()

template<class T>
FauResult< T > line::mc::ctmc_fau ( const std::vector< T > & pi0,
const Matrix< T > & Q,
const T & t,
double epsilon = 1e-6,
double delta = 1e-12,
long maxsteps = -1 )

Transient distribution of a CTMC by fast adaptive uniformization.

Parameters
pi0initial distribution (row vector)
Qgenerator
ttime horizon, t >= 0
epsilonbirth-process truncation tolerance (MATLAB default 1e-6)
deltaoccupancy threshold below which a state is dropped (default 1e-12)
maxstepscap on birth steps; <= 0 for the default cap

Definition at line 256 of file ctmc_fau.h.

References line::mc::FauResult< T >::absorbed, line::Matrix< T >::cols(), ctmc_fau(), line::mc::FauResult< T >::droppedMass, line::mc::FauResult< T >::errorBound, FAU_MAX_STEPS, line::InputError::InputError(), line::mc::FauResult< T >::lambdaMax, line::mc::FauResult< T >::lambdaMin, line::mc::FauResult< T >::pit, line::Matrix< T >::rows(), line::mc::FauResult< T >::steps, line::mc::FauResult< T >::supportFinal, line::mc::FauResult< T >::supportMax, line::mc::FauResult< T >::truncated, line::mc::FauResult< T >::uniformRate, line::mc::FauResult< T >::weightTail, and line::mc::FauResult< T >::weightWindow.

Referenced by ctmc_fau().

◆ ctmc_foxglynn()

template<class T>
FoxGlynnResult< T > line::mc::ctmc_foxglynn ( const std::vector< T > & pi0,
const Matrix< T > & Q,
const T & t,
double tol = 1e-12,
long maxiter = -1 )

Transient distribution of a CTMC by uniformization with Fox-Glynn Poisson weights.

Parameters
pi0initial distribution (row vector)
Qgenerator
ttime horizon
toltotal Poisson tail mass discarded (MATLAB default 1e-12)
maxitercap on the right truncation point; <= 0 leaves it uncapped

Definition at line 172 of file ctmc_foxglynn.h.

References line::Matrix< T >::cols(), ctmc_foxglynn(), line::InputError::InputError(), line::mc::FoxGlynnResult< T >::left, line::num_abs(), line::mc::FoxGlynnResult< T >::pi, line::mc::FoxGlynnResult< T >::right, line::Matrix< T >::rows(), and line::mc::FoxGlynnResult< T >::w.

Referenced by line::lang::processes::chain_transient_at(), and ctmc_foxglynn().

◆ ctmc_gmres()

template<class T>
GmresResult< T > line::mc::ctmc_gmres ( const Matrix< T > & A,
const std::vector< T > & b,
double tol = 1e-12,
long restart = 0,
long maxit = 0,
const std::vector< T > & x0 = std::vector<T>() )

Restarted GMRES with an ILUT preconditioner, for the linear systems a generator produces.

Parameters
Acoefficient matrix, already assembled
bright-hand side
tolrelative residual tolerance (default 1e-12)
restartrestart length; <= 0 selects min(n, 50)
maxitouter cycles; <= 0 selects ceil(n / restart)
x0initial guess; empty selects the uniform vector ones(n)/n

Definition at line 653 of file ctmc_gmres.h.

References line::Matrix< T >::cols(), ctmc_gmres(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by ctmc_gmres(), ctmc_solve(), and ctmc_takahashi().

◆ ctmc_gmres_multi()

template<class T>
GmresMultiResult< T > line::mc::ctmc_gmres_multi ( const Matrix< T > & A,
const Matrix< T > & B,
double tol = 1e-12,
long restart = 0,
long maxit = 0 )

Restarted GMRES for a block of right-hand sides sharing one coefficient matrix.

Parameters
Acoefficient matrix
Bright-hand sides, one per column
tolrelative residual tolerance (default 1e-12)
restartrestart length; <= 0 selects min(n, 50)
maxitouter cycles; <= 0 selects ceil(n / restart)

Definition at line 59 of file ctmc_gmres_multi.h.

References line::Matrix< T >::cols(), ctmc_gmres_multi(), line::mc::GmresMultiResult< T >::flag, line::mc::GmresResult< T >::flag, line::InputError::InputError(), line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), line::mc::GmresMultiResult< T >::X, and line::mc::GmresResult< T >::x.

Referenced by ctmc_gmres_multi().

◆ ctmc_hitting_time()

template<class T>
std::vector< T > line::mc::ctmc_hitting_time ( const Matrix< T > & Q,
const std::vector< std::size_t > & target )

Mean time to reach any state in target from each state of a CTMC.

Continuous-time twin of dtmc_hitting_time and the first-moment special case of ctmc_passage_moments: (-S) h = 1 on the non-target block, where dtmc_hitting_time solves (I - P_NT) h = 1. Unreachable states give infinity.

Definition at line 368 of file ctmc_passage.h.

References ctmc_hitting_time(), ctmc_passage_moments(), line::mc::PassageMoments< T >::mall, and line::Matrix< T >::rows().

Referenced by ctmc_hitting_time(), and line::lang::processes::hitting_time().

◆ ctmc_isfeasible() [1/2]

template<class T>
bool line::mc::ctmc_isfeasible ( const Matrix< T > & Q)

Default tolerance 1e-10, matching the MATLAB signature.

Definition at line 52 of file ctmc_isfeasible.h.

References ctmc_isfeasible().

◆ ctmc_isfeasible() [2/2]

template<class T>
bool line::mc::ctmc_isfeasible ( const Matrix< T > & Q,
const T & tol )

True when Q is square, has nonnegative off-diagonals, nonpositive diagonal and zero row sums.

Definition at line 35 of file ctmc_isfeasible.h.

References line::Matrix< T >::cols(), ctmc_isfeasible(), line::num_abs(), and line::Matrix< T >::rows().

Referenced by ctmc_isfeasible(), ctmc_isfeasible(), and line::lang::processes::is_feasible().

◆ ctmc_kms()

template<class T>
KmsResult< T > line::mc::ctmc_kms ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS,
std::size_t numSteps )

Koury-McAllister-Stewart aggregation-disaggregation for a nearly completely decomposable CTMC.

Parameters
Qgenerator
MSmacro-states partitioning 0..n-1
numStepsnumber of aggregation-disaggregation sweeps

Definition at line 100 of file ctmc_kms.h.

References line::Matrix< T >::cols(), ctmc_kms(), dtmc_solve(), line::mc::KmsResult< T >::eps, line::mc::KmsResult< T >::epsMAX, line::InputError::InputError(), line::NumericError::NumericError(), line::mc::KmsResult< T >::p, line::mc::KmsResult< T >::p_1, line::mc::KmsResult< T >::pcourt, line::mc::KmsResult< T >::Qperm, and line::Matrix< T >::rows().

Referenced by line::lang::processes::aggregate(), ctmc_kms(), and line::env::env_ctmc_decompose().

◆ ctmc_makeinfgen()

◆ ctmc_maxabs()

template<class T>
T line::mc::ctmc_maxabs ( const Matrix< T > & Q)

Largest magnitude of any entry of Q; equals max_i |q_ii| for a generator.

Definition at line 48 of file ctmc_randomization.h.

References line::Matrix< T >::cols(), ctmc_maxabs(), line::num_abs(), and line::Matrix< T >::rows().

Referenced by ctmc_maxabs(), ctmc_randomization(), ctmc_stmonotone(), and ctmc_takahashi().

◆ ctmc_memory_gate()

CtmcGateResult line::mc::ctmc_memory_gate ( double log_nstates,
bool force = false,
double safety_fraction = CTMC_DEFAULT_SAFETY_FRACTION )
inline

Decide whether a state space of log-size log_nstates can be solved here.

Parameters
log_nstatesnatural log of the worst-case state count
forcetrue downgrades a refusal to a warning
safety_fractionfraction of available memory the solve may target

Definition at line 92 of file ctmc_memory_gate.h.

References line::mc::CtmcGateResult::budget_gb, ctmc_available_memory_bytes(), CTMC_DEFAULT_SAFETY_FRACTION, CTMC_FALLBACK_ALPHA, CTMC_FALLBACK_BETA, ctmc_memory_gate(), line::mc::CtmcGateResult::message, line::mc::CtmcGateResult::ok, and line::mc::CtmcGateResult::predicted_gb.

Referenced by ctmc_memory_gate(), and line::ctmc::solve_struct().

◆ ctmc_multi() [1/2]

template<class T>
MultiResult< T > line::mc::ctmc_multi ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS,
const std::vector< std::vector< std::size_t > > & MSS )

Overload deriving the rate as MATLAB does, q = (21/20) max|Qperm|.

Definition at line 93 of file ctmc_multi.h.

References ctmc_multi().

◆ ctmc_multi() [2/2]

template<class T>
MultiResult< T > line::mc::ctmc_multi ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS,
const std::vector< std::vector< std::size_t > > & MSS,
const T & q )

Two-level multigrid aggregation-disaggregation for a nearly completely decomposable CTMC.

Parameters
Qgenerator
MSmacro-states partitioning 0..n-1
MSSmacro-macro-states partitioning 0..|MS|-1, the coarse partition
quniformization rate for the fine level

Definition at line 61 of file ctmc_multi.h.

References line::Matrix< T >::cols(), ctmc_courtois(), ctmc_multi(), line::mc::MultiResult< T >::eps, line::mc::MultiResult< T >::epsMAX, line::InputError::InputError(), line::mc::MultiResult< T >::p, line::mc::MultiResult< T >::pcourt, line::mc::MultiResult< T >::Qperm, and line::Matrix< T >::rows().

Referenced by line::lang::processes::aggregate_multi(), ctmc_multi(), ctmc_multi(), and line::env::env_ctmc_decompose().

◆ ctmc_passage_lst()

template<class T>
std::vector< std::complex< double > > line::mc::ctmc_passage_lst ( const Matrix< T > & Q,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
const std::vector< std::complex< double > > & s )

L(s) = alpha (sI-S)^{-1} s0 + atom at the (complex) points s.

Eqs. 1-2: one linear system per value of s.

ONE SOLVE PER s, NOT PER (s,t) PAIR. The saving over a dense matrix exponential is that the solves are sparse, so this route reaches chains a dense expm cannot hold. It is NOT a saving in the number of time points: every Abate-Whitt inverter places its nodes at s = beta/t, so a grid of T points costs T*|beta| solves.

Definition at line 243 of file ctmc_passage.h.

References line::mc::PassagePh< T >::alpha, line::mc::PassagePh< T >::atom, ctmc_passage_lst(), ctmc_passage_ph(), line::mc::PassagePh< T >::S, and line::mc::PassagePh< T >::s0.

Referenced by ctmc_passage_lst(), and ctmc_passage_time().

◆ ctmc_passage_moments()

template<class T>
PassageMoments< T > line::mc::ctmc_passage_moments ( const Matrix< T > & Q,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
std::size_t nmax = 1 )

Moments of order 1..nmax of the first passage time into target.

This is Eq. 3, -q_ii M_i(n) = sum_{k not in B} q_ik M_k(n) + n M_i(n-1), i.e. (-S) M(n) = n M(n-1) with M(0) = 1: nmax linear solves and no transform inversion at all. The equivalent closed form n! alpha (-S)^{-n} 1 is NOT how it is evaluated – forming the inverse of the sub-generator destroys the sparsity the recursion preserves.

Definition at line 284 of file ctmc_passage.h.

References line::mc::PassagePh< T >::alpha, ctmc_passage_moments(), ctmc_passage_ph(), line::InputError::InputError(), line::mc::PassagePh< T >::keep, line::mc::PassageMoments< T >::m, line::mc::PassageMoments< T >::mall, line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), line::mc::PassagePh< T >::S, and line::solve().

Referenced by line::ctmc::ctmc_firstpasst_moments(), ctmc_hitting_time(), and ctmc_passage_moments().

◆ ctmc_passage_ph()

template<class T>
PassagePh< T > line::mc::ctmc_passage_ph ( const Matrix< T > & Q,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target )

Phase-type representation of the first passage time from pi0 into target.

Parameters
pi0empty selects the conditional stationary law on the complement
target0-based state indices (1-based in the MATLAB reference)

Definition at line 170 of file ctmc_passage.h.

References line::mc::PassagePh< T >::alpha, line::mc::PassagePh< T >::atom, line::Matrix< T >::cols(), ctmc_passage_ph(), ctmc_solve(), line::InputError::InputError(), line::mc::PassagePh< T >::keep, line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), line::mc::PassagePh< T >::S, and line::mc::PassagePh< T >::s0.

Referenced by ctmc_passage_lst(), ctmc_passage_moments(), ctmc_passage_ph(), and ctmc_passage_time().

◆ ctmc_passage_time()

template<class T>
PassageCurve< T > line::mc::ctmc_passage_time ( const Matrix< T > & Q,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
const std::vector< double > & tset,
const std::string & method = "expm",
const std::string & lti_method = "euler" )

CDF and density of the first passage time on the grid tset: F(t) = 1 - alpha exp(St) 1 and f(t) = alpha exp(St) s0.

method is "expm" (default) or "lt". The transform route exists for chains whose non-target block is too large for a dense exp(St), not because it needs fewer time points; on a small chain "expm" is both faster and more accurate, which is why it is the default.

Definition at line 398 of file ctmc_passage.h.

References line::mc::PassagePh< T >::alpha, line::mc::PassageCurve< T >::atom, line::mc::PassagePh< T >::atom, ctmc_passage_lst(), ctmc_passage_ph(), ctmc_passage_time(), line::expm(), line::mc::PassageCurve< T >::F, line::mc::PassageCurve< T >::f, line::InputError::InputError(), line::lti::laplace_invert_cdf(), line::lti::laplace_invert_pdf(), line::lti::laplace_method(), line::mc::PassagePh< T >::S, line::mc::PassagePh< T >::s0, and line::mc::PassageCurve< T >::t.

Referenced by line::ctmc::ctmc_cdf_firstpasst(), and ctmc_passage_time().

◆ ctmc_pseudostochcomp() [1/2]

template<class T>
PseudoStochCompResult< T > line::mc::ctmc_pseudostochcomp ( const Matrix< T > & Q)

Default partition: the first ceil(n/2) states.

Definition at line 126 of file ctmc_pseudostochcomp.h.

References ctmc_pseudostochcomp().

◆ ctmc_pseudostochcomp() [2/2]

template<class T>
PseudoStochCompResult< T > line::mc::ctmc_pseudostochcomp ( const Matrix< T > & Q,
const std::vector< std::size_t > & keep )

◆ ctmc_rand()

template<class T, class Gen>
Matrix< T > line::mc::ctmc_rand ( std::size_t n,
Gen & gen )

Random infinitesimal generator of a CTMC.

Parameters
norder of the generator
gencallable returning a uniform variate in [0,1); n*n draws are made

Definition at line 71 of file ctmc_rand.h.

References ctmc_makeinfgen(), ctmc_rand(), and line::InputError::InputError().

Referenced by ctmc_rand(), dtmc_rand(), and line::lang::processes::rand_process().

◆ ctmc_randomization() [1/2]

template<class T>
RandomizationResult< T > line::mc::ctmc_randomization ( const Matrix< T > & Q)

Deterministic default rate (21/20) max|Q|; see the defect note above.

Definition at line 84 of file ctmc_randomization.h.

References ctmc_maxabs(), and ctmc_randomization().

◆ ctmc_randomization() [2/2]

template<class T>
RandomizationResult< T > line::mc::ctmc_randomization ( const Matrix< T > & Q,
const T & q )

Uniformization (randomization) of a CTMC: the embedded DTMC P = I + Q/q.

Parameters
Qgenerator
quniformization rate, which must satisfy q >= max_i |q_ii|

Definition at line 66 of file ctmc_randomization.h.

References line::Matrix< T >::cols(), ctmc_randomization(), dtmc_makestochastic(), line::InputError::InputError(), line::mc::RandomizationResult< T >::P, and line::Matrix< T >::rows().

Referenced by ctmc_randomization(), ctmc_randomization(), ctmc_solve_reducible(), ctmc_stmonotone(), ctmc_takahashi(), and dtmc_rand().

◆ ctmc_relsolve() [1/2]

template<class T>
std::vector< T > line::mc::ctmc_relsolve ( const Matrix< T > & Q)

Reference state 1 in the MATLAB numbering, i.e.

index 0 here.

Definition at line 82 of file ctmc_relsolve.h.

References ctmc_relsolve().

◆ ctmc_relsolve() [2/2]

template<class T>
std::vector< T > line::mc::ctmc_relsolve ( const Matrix< T > & Qin,
std::size_t refstate )

◆ ctmc_saddlepoint() [1/2]

template<class T>
SaddlepointResult< T > line::mc::ctmc_saddlepoint ( const Matrix< T > & D0,
const Matrix< T > & D1,
const std::vector< T > & t,
const std::vector< long > & k,
SaddlepointMethod method = SADDLEPOINT_DANIELS2,
const std::vector< T > & pi0 = std::vector<T>() )
inline

Pr{N(t)=k} over arrays of horizons and counts.

Parameters
D0generator of the phase process with the counted transitions removed
D1rates of the counted transitions; D0+D1 must be an irreducible generator
ttime horizons; length 1 broadcasts against k
kevent counts; length 1 broadcasts against t
methodSADDLEPOINT_DANIELS2 (the default), SADDLEPOINT_DANIELS or SADDLEPOINT_PLAIN
pi0initial phase distribution; empty selects the stationary distribution of D0+D1

Definition at line 359 of file ctmc_saddlepoint.h.

References line::mc::PerronState< T >::ampl, line::mc::SaddlepointResult< T >::ampl, line::Matrix< T >::cols(), line::mc::SaddlepointResult< T >::corr, ctmc_saddlepoint(), CTMC_SADDLEPOINT_K2_MIN, ctmc_saddlepoint_perron(), ctmc_solve(), line::mc::PerronState< T >::d2eta, line::mc::SaddlepointResult< T >::d2eta, line::mc::PerronState< T >::deta, line::mc::SaddlepointResult< T >::deta, line::mc::PerronState< T >::eta, line::mc::SaddlepointResult< T >::eta, line::mc::SaddlepointResult< T >::exact, line::expm(), line::InputError::InputError(), line::mc::SaddlepointResult< T >::iter, line::mc::SaddlepointResult< T >::k2, line::mc::SaddlepointResult< T >::lambda, line::mc::SaddlepointResult< T >::logp, line::num_abs(), line::NumericError::NumericError(), line::mc::SaddlepointResult< T >::out_of_regime, line::mc::SaddlepointResult< T >::p, line::Matrix< T >::rows(), SADDLEPOINT_DANIELS2, SADDLEPOINT_PLAIN, line::mc::SaddlepointResult< T >::theta, tx_exp(), tx_log(), line::mc::SaddlepointResult< T >::worst_k, line::mc::SaddlepointResult< T >::worst_k2, and line::mc::SaddlepointResult< T >::worst_t.

Referenced by ctmc_saddlepoint(), and ctmc_saddlepoint().

◆ ctmc_saddlepoint() [2/2]

template<class T>
T line::mc::ctmc_saddlepoint ( const Matrix< T > & D0,
const Matrix< T > & D1,
const T & t,
long k,
SaddlepointMethod method = SADDLEPOINT_DANIELS2 )
inline

Pr{N(t)=k} at a single (t,k), with the default method.

Definition at line 549 of file ctmc_saddlepoint.h.

References ctmc_saddlepoint(), and SADDLEPOINT_DANIELS2.

◆ ctmc_saddlepoint_perron()

template<class T>
PerronState< T > line::mc::ctmc_saddlepoint_perron ( const Matrix< T > & D0,
const Matrix< T > & D1,
const std::vector< T > & pi0,
const T & th )
inline

Perron root of A(th) = D0 + exp(th)*D1 with deta, d2eta and the amplitude.

Only EIGENVALUES are taken from the eigensolver; the Perron vectors come from bordered solves, the idiom ctmc_solve already uses. That keeps all four codebases on ONE algorithm: eig.h exposes values only, and the JAR's commons-math hands back Schur blocks rather than eigenvectors as soon as a complex pair appears, so neither can supply a left eigenvector.

Definition at line 189 of file ctmc_saddlepoint.h.

References line::mc::PerronState< T >::ampl, ctmc_saddlepoint_perron(), line::mc::PerronState< T >::d2eta, line::mc::PerronState< T >::deta, line::eig_values(), line::mc::PerronState< T >::eta, line::Matrix< T >::rows(), and tx_exp().

Referenced by ctmc_saddlepoint(), and ctmc_saddlepoint_perron().

◆ ctmc_sens() [1/2]

template<class T>
std::vector< T > line::mc::ctmc_sens ( const Matrix< T > & Q,
const Matrix< T > & dQ )

Overload computing the steady-state vector itself, as MATLAB does.

Definition at line 80 of file ctmc_sens.h.

References ctmc_sens(), and ctmc_solve().

◆ ctmc_sens() [2/2]

template<class T>
std::vector< T > line::mc::ctmc_sens ( const Matrix< T > & Q,
const Matrix< T > & dQ,
const std::vector< T > & pi )

Sensitivity of the steady-state distribution of a CTMC to a scalar parameter.

Parameters
Qgenerator
dQderivative of the generator with respect to theta, same size
pisteady-state distribution; must sum to one
Returns
dpi/dtheta as a row vector of length n, summing to zero

Definition at line 52 of file ctmc_sens.h.

References line::Matrix< T >::cols(), ctmc_sens(), line::InputError::InputError(), line::Matrix< T >::rows(), and line::solve().

Referenced by line::lang::processes::chain_sens(), ctmc_sens(), ctmc_sens(), and line::ctmc::solver_ctmc_sensitivity().

◆ ctmc_simulate()

template<class T>
CtmcPath< T > line::mc::ctmc_simulate ( const Matrix< T > & Q,
const std::vector< T > & pi0,
std::size_t n,
pfqn::McRng & rng )

Simulate n steps of the CTMC with generator Q.

Parameters
Q(m x m) generator, negative diagonal and zero row sums
pi0initial distribution; empty draws it uniformly at random and normalizes, as the reference does
nnumber of steps
rnggenerator, advanced by the call

Definition at line 158 of file ctmc_simulate.h.

References line::Matrix< T >::cols(), ctmc_simulate(), line::InputError::InputError(), line::pfqn::mc_uniform(), line::NumericError::NumericError(), line::Matrix< T >::rows(), line::mc::CtmcPath< T >::sojourn, and line::mc::CtmcPath< T >::states.

Referenced by line::lang::processes::chain_sample(), and ctmc_simulate().

◆ ctmc_simulate_reference_initial_law()

template<class T>
std::vector< T > line::mc::ctmc_simulate_reference_initial_law ( const std::vector< T > & pi0)

The initial-state law that ctmc_simulate.m actually realizes for a given pi0, as opposed to pi0 itself.

Provided so a caller can measure the reference defect documented above rather than take it on trust; it is not used by the simulation.

Definition at line 109 of file ctmc_simulate.h.

References ctmc_simulate_reference_initial_law(), and line::InputError::InputError().

Referenced by ctmc_simulate_reference_initial_law().

◆ ctmc_solve()

◆ ctmc_solve_reducible() [1/2]

template<class T>
ReducibleResult< T > line::mc::ctmc_solve_reducible ( const Matrix< T > & Q,
const std::vector< T > & pi0,
double zeroColTol = 1e-12 )

Limiting distribution of a CTMC whose generator may be reducible.

Parameters
Qgenerator
pi0initial distribution; empty to let the routine pick one
zeroColTolcolumn-sum threshold below which a state counts as unreachable

Definition at line 47 of file ctmc_solve_reducible.h.

References line::Matrix< T >::cols(), ctmc_randomization(), ctmc_solve_reducible(), dtmc_solve_reducible(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by line::lang::processes::chain_solve(), ctmc_solve_reducible(), ctmc_solve_reducible(), line::env::Environment< T >::init(), and line::ctmc::solver_ctmc_chain().

◆ ctmc_solve_reducible() [2/2]

template<class T>
ReducibleResult< T > line::mc::ctmc_solve_reducible ( const Matrix< T > & Q,
double zeroColTol = 1e-12 )

Overload without an initial vector.

Definition at line 56 of file ctmc_solve_reducible.h.

References ctmc_solve_reducible().

◆ ctmc_solve_reducible_blkdecomp() [1/2]

template<class T>
BlkDecompResult< T > line::mc::ctmc_solve_reducible_blkdecomp ( const Matrix< T > & Q,
double reachTol = 1e-15,
double zeroColTol = 1e-12 )

Overload without an initial vector.

Definition at line 223 of file ctmc_solve_reducible_blkdecomp.h.

References ctmc_solve_reducible_blkdecomp().

◆ ctmc_solve_reducible_blkdecomp() [2/2]

template<class T>
BlkDecompResult< T > line::mc::ctmc_solve_reducible_blkdecomp ( const Matrix< T > & Qin,
const std::vector< T > & pin,
double reachTol = 1e-15,
double zeroColTol = 1e-12 )

◆ ctmc_state_space_logsize()

template<class T>
double line::mc::ctmc_state_space_logsize ( const qn::NetworkStruct< T > & sn,
const CtmcSizeOptions & opt = CtmcSizeOptions() )

Worst-case log state-space size of sn.

Parameters
snthe struct, ideally after sn_nonmarkov_toph, since a non-Markovian service becomes phases the raw struct does not carry
Returns
natural log of the worst-case state count

Definition at line 150 of file ctmc_state_space_logsize.h.

References ctmc_state_space_logsize(), kOrderGridMax, and log_ordered_joint().

Referenced by ctmc_state_space_logsize(), and line::ctmc::solve_struct().

◆ ctmc_stmonotone()

template<class T>
Matrix< T > line::mc::ctmc_stmonotone ( const Matrix< T > & Q)

Stochastically monotone upper bound of a Markov chain.

Parameters
Q(n x n) generator
Returns
the generator of the st-monotone upper bound of Q

Definition at line 81 of file ctmc_stmonotone.h.

References ctmc_makeinfgen(), ctmc_maxabs(), ctmc_randomization(), ctmc_stmonotone(), and dtmc_stmonotone().

Referenced by ctmc_stmonotone().

◆ ctmc_stochcomp() [1/2]

template<class T>
StochCompResult< T > line::mc::ctmc_stochcomp ( const Matrix< T > & Q)

Default subset: the first ceil(n/2) states, as in MATLAB.

Definition at line 211 of file dtmc_solve.h.

References ctmc_stochcomp(), and line::Matrix< T >::rows().

◆ ctmc_stochcomp() [2/2]

◆ ctmc_takahashi()

template<class T>
TakahashiResult< T > line::mc::ctmc_takahashi ( const Matrix< T > & Q,
const std::vector< std::vector< std::size_t > > & MS,
std::size_t numSteps,
double massTol = 1e-14 )

◆ ctmc_testpf_kolmogorov()

template<class T>
bool line::mc::ctmc_testpf_kolmogorov ( const Matrix< T > & Qin)

Kolmogorov reversibility criterion, used as a product-form test.

Parameters
Qingenerator of an irreducible CTMC
Returns
true when Kolmogorov's criterion holds on every simple cycle

Definition at line 84 of file ctmc_testpf_kolmogorov.h.

References line::Matrix< T >::cols(), ctmc_makeinfgen(), ctmc_testpf_kolmogorov(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by ctmc_testpf_kolmogorov().

◆ ctmc_timeaverage()

template<class T>
TimeAverageResult< T > line::mc::ctmc_timeaverage ( const std::vector< T > & pi0,
const Matrix< T > & Q,
const T & t,
double tol = 1e-12,
long maxiter = -1 )

Time-averaged distribution (1/t) int_0^t pi(u) du, plus pi(t) itself.

Port of ctmc_timeaverage.m, which accumulates the Poisson survival weights max(1 - W_j, 0) rather than integrating pi(u) numerically.

Definition at line 175 of file ctmc_uniformization.h.

References line::Matrix< T >::cols(), ctmc_timeaverage(), line::InputError::InputError(), line::mc::TimeAverageResult< T >::kmax, line::mc::TimeAverageResult< T >::piExit, line::mc::TimeAverageResult< T >::piTimeAvg, and line::Matrix< T >::rows().

Referenced by ctmc_timeaverage(), and line::lang::processes::time_average().

◆ ctmc_timereverse()

template<class T>
Matrix< T > line::mc::ctmc_timereverse ( const Matrix< T > & Q)

◆ ctmc_transient() [1/2]

template<class T>
TransientResult< T > line::mc::ctmc_transient ( const Matrix< T > & Q,
const std::vector< T > & pi0,
const T & t0,
const T & t1,
double rtol = 1e-3,
double atol = 1e-6 )

Transient distribution of a CTMC over a time interval, by integrating the forward equations d pi/dt = pi Q.

Templated port of matlab/src/api/mc/ctmc_transient.m (and the richer kpctoolbox copy).

Parameters
Qgenerator
pi0initial distribution (row vector)
t0initial time
t1final time
rtolrelative tolerance of the integrator (MATLAB RelTol, 1e-3)
atolabsolute tolerance of the integrator (MATLAB AbsTol, 1e-6)

Definition at line 190 of file ctmc_transient.h.

References line::Matrix< T >::cols(), ctmc_transient(), line::InputError::InputError(), line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), and line::mc::TransientResult< T >::t.

Referenced by ctmc_transient(), ctmc_transient(), line::ctmc::solver_ctmc_chain_transient(), and line::ctmc::solver_ctmc_transient_analyzer().

◆ ctmc_transient() [2/2]

template<class T>
TransientResult< T > line::mc::ctmc_transient ( const Matrix< T > & Q,
const T & t0,
const T & t1,
double rtol = 1e-3,
double atol = 1e-6 )

Overload starting from the uniform distribution, as MATLAB's short forms do.

The initial time stays explicit: an overload taking (Q, pi0, t1) would be ambiguous with the four-argument form at T = double, since the tolerances are doubles too.

Definition at line 227 of file ctmc_transient.h.

References ctmc_transient(), line::InputError::InputError(), and line::Matrix< T >::rows().

◆ ctmc_transient_on_grid() [1/2]

template<class T>
TransientResult< T > line::mc::ctmc_transient_on_grid ( const Matrix< T > & Q,
const TransientResult< T > & r,
const std::vector< T > & grid )

Resample an adaptive transient onto the uniform grid t0 : dt : t1.

The same resampling onto an ARBITRARY grid, which a uniform step cannot express.

options.timestep of the reference. ctmc_transient.m passes the grid STRAIGHT INTO ode23 as its tspan, and MATLAB's integrator then reports the solution at exactly those points by evaluating its own dense output – it does not change the steps it takes, only where it reports them. This does the same thing explicitly: the adaptive solve is untouched, and the answer at a grid point is the cubic Hermite interpolant of the bracketing pair.

THE DERIVATIVES ARE EXACT AND NOT DIFFERENCED. d pi/dt = pi Q holds at every stored point, so the Hermite data is the solution and its true derivative rather than a secant estimate; that is what makes this the same order as ode23's own dense output instead of a linear interpolation dressed up as one.

t1 IS ALWAYS THE LAST POINT even when the step does not divide the horizon, as ctmc_transient.m appends it: a transient reported to 9.9 when 10 was asked for is a different answer, not a rounded one.

A caller that integrates a quantity AGAINST the trajectory needs the points its integrand asks for, not the points the step controller happened to stop at: the environment coupling forms a Riemann-Stieltjes sum of each stage's transient against the holding-time CDF, and the grid that resolves that CDF (refine_grid, 90% of its points under 5*E[S]) is not uniform. Resampling here rather than re-integrating keeps ONE integration behind every grid.

LINEAR, NOT HERMITE, AND DELIBERATELY THE LESS ACCURATE CHOICE. Every codebase resamples here rather than re-integrating, but MATLAB's refineForCdf_, the JAR's CdfGrid.on and native python all interpolate LINEARLY, and this port used a cubic Hermite built from the exact derivative y' = yQ. That is the better interpolant and it is what made renv_threestages_repairmen read Queue1 QLen 0.83092 where the other three read 0.83053: a 4.7e-4 disagreement that is entirely the difference between the two quadratures, on a row whose gate is 3.2e-4. Parity measures whether the codebases give the SAME answer, so the interpolant is aligned rather than the golden rebased onto the more accurate one. Changed 2026-08-13 on the user's decision; if this is ever revisited, note that the metrics read off pi(t) are LINEAR functionals of it, so interpolating pi linearly and interpolating each metric linearly are the same operation – which is why matching the reference here is enough to match it in every measure.

Definition at line 301 of file ctmc_transient.h.

References ctmc_transient_on_grid(), line::Matrix< T >::Matrix(), line::mc::TransientResult< T >::pi, line::Matrix< T >::rows(), and line::mc::TransientResult< T >::t.

Referenced by ctmc_transient_on_grid(), ctmc_transient_on_grid(), and line::ctmc::solver_ctmc_transient_analyzer().

◆ ctmc_transient_on_grid() [2/2]

template<class T>
TransientResult< T > line::mc::ctmc_transient_on_grid ( const Matrix< T > & Q,
const TransientResult< T > & r,
const T & t0,
const T & t1,
const T & dt )

◆ ctmc_transient_sens() [1/2]

template<class T>
TransientSensResult< T > line::mc::ctmc_transient_sens ( const Matrix< T > & Q,
const Matrix< T > & dQ,
const std::vector< T > & pi0,
const T & t0,
const T & t1,
double rtol = 1e-3,
double atol = 1e-6 )

Sensitivity of the transient distribution of a CTMC to a scalar parameter.

Parameters
Qgenerator
dQderivative of the generator with respect to theta, same size
pi0initial distribution (row vector)
t0initial time
t1final time
rtolrelative tolerance of the ODE integrator
atolabsolute tolerance of the ODE integrator

Definition at line 59 of file ctmc_transient_sens.h.

References line::Matrix< T >::cols(), ctmc_transient_sens(), line::InputError::InputError(), line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), and line::mc::TransientSensResult< T >::t.

Referenced by ctmc_transient_sens(), and ctmc_transient_sens().

◆ ctmc_transient_sens() [2/2]

template<class T>
TransientSensResult< T > line::mc::ctmc_transient_sens ( const Matrix< T > & Q,
const Matrix< T > & dQ,
const T & t0,
const T & t1,
double rtol = 1e-3,
double atol = 1e-6 )

Overload starting from the uniform distribution, as MATLAB's short forms do.

Definition at line 105 of file ctmc_transient_sens.h.

References ctmc_transient_sens(), line::InputError::InputError(), and line::Matrix< T >::rows().

◆ ctmc_uniformization()

template<class T>
UniformizationResult< T > line::mc::ctmc_uniformization ( const std::vector< T > & pi0,
const Matrix< T > & Q,
const T & t,
double tol = 1e-12,
long maxiter = -1 )

Transient distribution of a CTMC by uniformization (Jensen's method), and the time-averaged distribution over [0, t].

Parameters
pi0initial distribution (row vector)
Qgenerator
ttime horizon
tolPoisson-tail truncation tolerance (MATLAB default 1e-12)
maxiteriteration cap, <= 0 for the MATLAB heuristic

Definition at line 124 of file ctmc_uniformization.h.

References line::Matrix< T >::cols(), ctmc_uniformization(), line::InputError::InputError(), line::mc::UniformizationResult< T >::kmax, line::mc::UniformizationResult< T >::pi, and line::Matrix< T >::rows().

Referenced by line::lang::processes::chain_transient_at(), ctmc_uniformization(), and dtmc_uniformization().

◆ dtmc_hitting_time()

template<class T>
std::vector< T > line::mc::dtmc_hitting_time ( const Matrix< T > & P,
const std::vector< std::size_t > & target )

Expected number of steps to reach the target set, zero on the target set itself.

Definition at line 72 of file dtmc_transient.h.

References line::Matrix< T >::cols(), dtmc_hitting_time(), line::InputError::InputError(), line::Matrix< T >::rows(), and line::solve().

Referenced by dtmc_hitting_time(), and line::lang::processes::hitting_time().

◆ dtmc_isfeasible()

template<class T>
int line::mc::dtmc_isfeasible ( const Matrix< T > & P)

Largest precision level 1..15 at which P is stochastic, or 0 when none holds.

Definition at line 58 of file ctmc_isfeasible.h.

References line::Matrix< T >::cols(), dtmc_isfeasible(), and line::Matrix< T >::rows().

Referenced by dtmc_isfeasible(), and line::lang::processes::is_feasible().

◆ dtmc_makestochastic()

template<class T>
Matrix< T > line::mc::dtmc_makestochastic ( const Matrix< T > & Pin)

Normalize a non-negative matrix into a stochastic transition matrix.

Parameters
Pinmatrix with non-negative entries
Returns
row-stochastic matrix of the same size

Definition at line 44 of file dtmc_makestochastic.h.

References line::Matrix< T >::cols(), dtmc_makestochastic(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by line::lang::processes::MarkovChainModel< T >::chain(), ctmc_randomization(), dtmc_makestochastic(), and dtmc_solve_reducible().

◆ dtmc_rand()

template<class T, class Gen>
Matrix< T > line::mc::dtmc_rand ( std::size_t n,
Gen & gen )

Random stochastic matrix, the uniformization of a random generator.

Definition at line 45 of file dtmc_rand.h.

References ctmc_rand(), ctmc_randomization(), and dtmc_rand().

Referenced by dtmc_rand(), and line::lang::processes::rand_chain().

◆ dtmc_simulate()

template<class T, class Gen>
std::vector< std::size_t > line::mc::dtmc_simulate ( const Matrix< T > & P,
const std::vector< T > & pi0,
std::size_t n,
Gen & gen )

Sample path of a DTMC, n states starting from pi0.

An absorbing state ends the path early, exactly as the reference does: it returns the prefix rather than padding, so the returned length is at most n.

Definition at line 56 of file dtmc_rand.h.

References line::Matrix< T >::cols(), dtmc_simulate(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by line::lang::processes::chain_sample(), and dtmc_simulate().

◆ dtmc_solve()

◆ dtmc_solve_reducible() [1/2]

template<class T>
ReducibleResult< T > line::mc::dtmc_solve_reducible ( const Matrix< T > & P,
const std::vector< T > & pin,
double zeroColTol = 1e-12 )

◆ dtmc_solve_reducible() [2/2]

template<class T>
ReducibleResult< T > line::mc::dtmc_solve_reducible ( const Matrix< T > & P,
double zeroColTol = 1e-12 )

Overload without an initial vector.

Definition at line 238 of file dtmc_solve_reducible.h.

References dtmc_solve_reducible().

◆ dtmc_stmonotone()

template<class T>
Matrix< T > line::mc::dtmc_stmonotone ( const Matrix< T > & P)
Parameters
P(n x n) row-stochastic transition matrix
Returns
the st-monotone upper bound of P, itself row-stochastic

Definition at line 48 of file ctmc_stmonotone.h.

References line::Matrix< T >::cols(), dtmc_stmonotone(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by ctmc_stmonotone(), and dtmc_stmonotone().

◆ dtmc_stochcomp()

template<class T>
Matrix< T > line::mc::dtmc_stochcomp ( const Matrix< T > & P,
const std::vector< std::size_t > & keep )

Stochastic complement of a DTMC partition, a port of matlab/lib/kpctoolbox/mc/dtmc_stochcomp.m.

Parameters
P(n x n) row-stochastic transition matrix
keepthe 0-based indices of the states to retain (the set I)
Returns
the (|I| x |I|) stochastic complement S over the retained states, in the order given by keep

Definition at line 49 of file dtmc_stochcomp.h.

References line::Matrix< T >::cols(), dtmc_stochcomp(), line::InputError::InputError(), line::NumericError::NumericError(), and line::Matrix< T >::rows().

Referenced by line::qn::NetworkStruct< T >::da_recompute_visits_from_rtnodes(), dtmc_stochcomp(), line::fes::fes_aggregate(), line::fluid::fluid_diffusion(), line::fluid::fluid_matrix_system(), line::fluid::fluid_ode_system(), line::api::sn_rt_stations(), line::api::sn_rtnodes_to_rtorig(), line::mam::solver_mam_traffic(), line::mam::solver_mam_traffic_mmap(), and line::lang::processes::stoch_comp_full().

◆ dtmc_timereverse()

template<class T>
Matrix< T > line::mc::dtmc_timereverse ( const Matrix< T > & P)

◆ dtmc_transient() [1/2]

template<class T>
Matrix< T > line::mc::dtmc_transient ( const Matrix< T > & P)

Uniform initial law and one step, matching the one-argument MATLAB call.

Definition at line 66 of file dtmc_transient.h.

References dtmc_transient().

◆ dtmc_transient() [2/2]

template<class T>
Matrix< T > line::mc::dtmc_transient ( const Matrix< T > & P,
const std::vector< T > & pi0,
std::size_t steps )

Trajectory of the law over steps transitions, row k holding pi0 P^k.

Definition at line 45 of file dtmc_transient.h.

References line::Matrix< T >::cols(), dtmc_transient(), line::InputError::InputError(), and line::Matrix< T >::rows().

Referenced by line::lang::processes::chain_transient_steps(), dtmc_transient(), and dtmc_transient().

◆ dtmc_uniformization()

template<class T>
UniformizationResult< T > line::mc::dtmc_uniformization ( const std::vector< T > & pi0,
const Matrix< T > & P,
const T & t,
double tol = 1e-12,
long maxiter = -1 )

Transient law of a DTMC through the uniformized generator of P.

Definition at line 136 of file dtmc_transient.h.

References ctmc_makeinfgen(), ctmc_uniformization(), and dtmc_uniformization().

Referenced by line::lang::processes::chain_transient_unif(), and dtmc_uniformization().

◆ log_ordered_joint()

double line::mc::log_ordered_joint ( const std::vector< std::vector< int > > & caps_per,
const std::vector< double > & cap_tot,
const std::vector< int > & njobs,
std::size_t m_rem )
inline

Log count of (placement, ordering) configurations over ALL order-preserving stations at once, POPULATION CONSERVED.

caps_per[a][k] bounds class k at ordered station a, cap_tot[a] bounds the buffer TOTAL there (a finite station capacity is a slot count, not a per-class bound), njobs is the population to share out, and m_rem share stations take the leftovers.

Cutoff truncates an OPEN class's population in the network exactly as the plain stars-and-bars term treats it, so open classes are conserved too.

Definition at line 62 of file ctmc_state_space_logsize.h.

References log_ordered_joint().

Referenced by ctmc_state_space_logsize(), and log_ordered_joint().

◆ smp_passage_lst()

template<class T>
std::vector< std::complex< double > > line::mc::smp_passage_lst ( const Matrix< T > & P,
const std::vector< std::function< std::complex< double >(std::complex< double >)> ,
& hlst,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
const std::vector< std::complex< double > > & s )

L(s) of the semi-Markov first passage time, Eqs.

4-5:

L_i(s) = sum_{k not in B} r*_ik(s) L_k(s) + sum_{k in B} r*_ik(s),

so (I - R*_AA(s)) L_A(s) = R*_AB(s) 1, one linear system per value of s.

Parameters
hlstper-state sojourn transforms h*_i(s), so r*_ik(s) = P(i,k) h*_i(s) and the complex numbers stay on the DIAGONAL of the system

Definition at line 619 of file ctmc_passage.h.

References line::InputError::InputError(), line::Matrix< T >::rows(), and smp_passage_lst().

Referenced by smp_passage_lst(), and smp_passage_time().

◆ smp_passage_moments()

template<class T>
PassageMoments< T > line::mc::smp_passage_moments ( const Matrix< T > & P,
const Matrix< T > & hmom,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
std::size_t nmax = 1 )

Moments of the semi-Markov first passage time from the per-state holding moments m_i(r), Eq.

7 with the u_i(r) recurrence of Eq. 8:

u_i(r) = -sum_{j=1..r} C(r,j) m_i(j) u_i(r-j),   u_i(0) = 1,

which are the derivatives at the origin of 1/h*_i(s). Cheaper than Eq. 6 because it needs no per-pair moments.

Parameters
hmom(nstates x nmax): hmom(i,r-1) is the r-th moment of the sojourn in state i

Definition at line 526 of file ctmc_passage.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::mc::PassageMoments< T >::m, line::mc::PassageMoments< T >::mall, line::Matrix< T >::Matrix(), line::Matrix< T >::rows(), smp_passage_moments(), and line::solve().

Referenced by smp_passage_moments().

◆ smp_passage_time()

template<class T>
PassageCurve< T > line::mc::smp_passage_time ( const Matrix< T > & P,
const std::vector< std::function< std::complex< double >(std::complex< double >)> ,
& hlst,
const std::vector< T > & pi0,
const std::vector< std::size_t > & target,
const std::vector< double > & tset,
const std::string & lti_method = "euler" )

CDF and density of the semi-Markov first passage time, by inverting smp_passage_lst through api/lti.

There is no matrix-exponential route here: a semi-Markov chain has no generator to exponentiate, which is exactly the case uniformization does not reach and the transform does.

lti_method defaults to "euler" RATHER THAN "weeks". Semi-Markov passage densities are the case Sec. 4.2 singles out as slow-converging for a Laguerre series, and laplace_weeks_scaling then refuses by name rather than returning noise.

Definition at line 677 of file ctmc_passage.h.

References line::mc::PassageCurve< T >::atom, line::mc::PassageCurve< T >::F, line::mc::PassageCurve< T >::f, line::lti::laplace_invert_cdf(), line::lti::laplace_invert_pdf(), line::lti::laplace_method(), line::Matrix< T >::rows(), smp_passage_lst(), smp_passage_time(), and line::mc::PassageCurve< T >::t.

Referenced by smp_passage_time().

◆ stronglyconncomp()

template<class T>
SccResult line::mc::stronglyconncomp ( const Matrix< T > & A)

Strongly connected components of a directed graph, and which of them are recurrent (closed under the successor relation).

Parameters
Aadjacency matrix; an edge i -> j exists iff A(i,j) is non-zero

Definition at line 63 of file stronglyconncomp.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::mc::SccResult::members, line::mc::SccResult::recurrent, line::Matrix< T >::rows(), line::mc::SccResult::scc, and stronglyconncomp().

Referenced by line::qn::NetworkStruct< T >::chain_visits(), ctmc_solve_reducible_blkdecomp(), dtmc_solve_reducible(), line::sn::sn_is_routing_ergodic(), and stronglyconncomp().

◆ tx_exp()

template<class T>
T line::mc::detail::tx_exp ( const T & x)
inline

exp/log/isfinite through ADL, the idiom the rest of api/mc uses: using std::exp then an unqualified call, so a Real<D> or Rational picks up its own overload.

num_traits carries no transcendental entry points.

Definition at line 112 of file ctmc_saddlepoint.h.

References tx_exp().

Referenced by ctmc_saddlepoint(), ctmc_saddlepoint_perron(), and tx_exp().

◆ tx_finite()

template<class T>
bool line::mc::detail::tx_finite ( const T & x)
inline

Definition at line 124 of file ctmc_saddlepoint.h.

References tx_finite().

Referenced by tx_finite().

◆ tx_log()

template<class T>
T line::mc::detail::tx_log ( const T & x)
inline

Definition at line 118 of file ctmc_saddlepoint.h.

References tx_log().

Referenced by ctmc_saddlepoint(), and tx_log().

◆ weaklyconncomp()

template<class T>
WeakCompResult< T > line::mc::weaklyconncomp ( const Matrix< T > & G)

Weakly connected components of the graph whose adjacency is the support of G.

Definition at line 121 of file dtmc_rand.h.

References line::mc::WeakCompResult< T >::comp, line::mc::WeakCompResult< T >::count, line::Matrix< T >::rows(), and weaklyconncomp().

Referenced by weaklyconncomp().

Variable Documentation

◆ CTMC_BYTES_PER_NZ

double line::mc::CTMC_BYTES_PER_NZ = 16.0
constexpr

8 bytes of value plus 8 amortized for the index, per stored nonzero.

Definition at line 52 of file ctmc_memory_gate.h.

◆ CTMC_DEFAULT_SAFETY_FRACTION

double line::mc::CTMC_DEFAULT_SAFETY_FRACTION = 0.6
constexpr

Fraction of available memory the solver may target.

Definition at line 54 of file ctmc_memory_gate.h.

Referenced by ctmc_memory_gate().

◆ CTMC_FALLBACK_ALPHA

double line::mc::CTMC_FALLBACK_ALPHA = CTMC_BYTES_PER_NZ * 8.0
constexpr

Fallback power-law coefficients, identical to MATLAB and Python.

Definition at line 56 of file ctmc_memory_gate.h.

Referenced by ctmc_memory_gate().

◆ CTMC_FALLBACK_AVAIL_BYTES

double line::mc::CTMC_FALLBACK_AVAIL_BYTES = 1.0 * 1024.0 * 1024.0 * 1024.0
constexpr

Conservative available-memory default when the host probe fails.

Definition at line 59 of file ctmc_memory_gate.h.

Referenced by ctmc_available_memory_bytes().

◆ CTMC_FALLBACK_BETA

double line::mc::CTMC_FALLBACK_BETA = 1.3
constexpr

Definition at line 57 of file ctmc_memory_gate.h.

Referenced by ctmc_memory_gate().

◆ CTMC_SADDLEPOINT_K2_MIN

const double line::mc::CTMC_SADDLEPOINT_K2_MIN = 5.0
static

Below this value of K2 = t*eta''(theta*) the expansion is out of its regime.

Do NOT threshold on lambda*t: for Erlang(r) the count variance rate is lambda/r, so K2 = lambda*t/r, and lambda*t over-warns on Poisson-like processes while under-warning on low-variability ones.

Definition at line 95 of file ctmc_saddlepoint.h.

Referenced by ctmc_saddlepoint().

◆ FAU_MAX_STEPS

long line::mc::FAU_MAX_STEPS = 1000000
constexpr

Default cap on birth steps, so a pathological horizon reports truncation.

Definition at line 69 of file ctmc_fau.h.

Referenced by ctmc_fau().

◆ GMRES_MIN_STATES

std::size_t line::mc::GMRES_MIN_STATES = 6000
constexpr

Order above which the direct sparse factorization is abandoned in favour of the Krylov path.

The same number the other three codebases use (ctmc_solve.m, Ctmc_solve.GMRES_MIN_STATES, ctmc.py), so a model switches methods at the same size in all four.

Definition at line 75 of file ctmc_gmres.h.

Referenced by ctmc_solve(), and ctmc_takahashi().

◆ kOrderGridMax

double line::mc::kOrderGridMax = 1.0e6
inlineconstexpr

Largest (m_1..m_K) box the exact ordered-buffer DP will walk.

Definition at line 50 of file ctmc_state_space_logsize.h.

Referenced by ctmc_state_space_logsize().