![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
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 <i_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 <i_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> | |
| 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> | |
| 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> | |
| 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> | |
| 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. | |
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.
|
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().
| 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.
| A | coefficient matrix, already assembled |
| b | right-hand side |
| tol | relative residual tolerance (default 1e-12) |
| maxit | complete iterations; <= 0 selects min(n, 200) |
| x0 | initial 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().
| 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.
| A | coefficient matrix |
| B | right-hand sides, one per column |
| tol | relative residual tolerance (default 1e-12) |
| maxit | complete 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().
| 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().
| CourtoisResult< T > line::mc::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.
| Q | generator |
| MS | macro-states, MS[i] listing the states of macro-state i; the sets must partition 0..n-1 |
| q | uniformization rate |
Definition at line 482 of file ctmc_courtois.h.
References line::mc::CourtoisResult< T >::B, line::mc::CourtoisResult< T >::C, ctmc_courtois(), dtmc_solve(), line::mc::CourtoisResult< T >::eps, line::mc::CourtoisResult< T >::epsColMax, line::mc::CourtoisResult< T >::epsMAX, line::mc::CourtoisResult< T >::epsRowMax, line::mc::CourtoisResult< T >::P, line::mc::CourtoisResult< T >::p, line::mc::CourtoisResult< T >::q, line::mc::CourtoisResult< T >::Qdec, line::mc::CourtoisResult< T >::Qperm, line::Matrix< T >::rows(), and line::mc::CourtoisResult< T >::v.
Referenced by line::lang::processes::aggregate(), ctmc_courtois(), ctmc_courtois(), ctmc_multi(), and line::env::env_ctmc_decompose().
| 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.
| pi0 | initial distribution (row vector) |
| Q | generator |
| t | time horizon, t >= 0 |
| epsilon | birth-process truncation tolerance (MATLAB default 1e-6) |
| delta | occupancy threshold below which a state is dropped (default 1e-12) |
| maxsteps | cap 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().
| 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.
| pi0 | initial distribution (row vector) |
| Q | generator |
| t | time horizon |
| tol | total Poisson tail mass discarded (MATLAB default 1e-12) |
| maxiter | cap 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().
| 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.
| A | coefficient matrix, already assembled |
| b | right-hand side |
| tol | relative residual tolerance (default 1e-12) |
| restart | restart length; <= 0 selects min(n, 50) |
| maxit | outer cycles; <= 0 selects ceil(n / restart) |
| x0 | initial 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().
| 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.
| A | coefficient matrix |
| B | right-hand sides, one per column |
| tol | relative residual tolerance (default 1e-12) |
| restart | restart length; <= 0 selects min(n, 50) |
| maxit | outer 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().
| 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().
| 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().
| 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().
| 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.
| Q | generator |
| MS | macro-states partitioning 0..n-1 |
| numSteps | number 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().
Set the diagonal so that every row sums to zero (ctmc_makeinfgen).
Any pre-existing diagonal entry is discarded, as in MATLAB.
Definition at line 58 of file ctmc_solve.h.
References line::Matrix< T >::cols(), ctmc_makeinfgen(), line::InputError::InputError(), and line::Matrix< T >::rows().
Referenced by ctmc_makeinfgen(), ctmc_rand(), ctmc_relsolve(), ctmc_solve(), ctmc_solve_reducible_blkdecomp(), ctmc_stmonotone(), line::ctmc::ctmc_symbolic_generator(), ctmc_testpf_kolmogorov(), dtmc_uniformization(), line::env::env_compress(), line::mam::mam_bgchain_ctmc(), line::mdd::mdd_closedqn(), line::lang::processes::MarkovChainModel< T >::process(), and line::ag::solver_ag().
| 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().
|
inline |
Decide whether a state space of log-size log_nstates can be solved here.
| log_nstates | natural log of the worst-case state count |
| force | true downgrades a refusal to a warning |
| safety_fraction | fraction 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().
| 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().
| 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.
| Q | generator |
| MS | macro-states partitioning 0..n-1 |
| MSS | macro-macro-states partitioning 0..|MS|-1, the coarse partition |
| q | uniformization 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().
| 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().
| 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().
| 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.
| pi0 | empty selects the conditional stationary law on the complement |
| target | 0-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().
| 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().
| 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().
| PseudoStochCompResult< T > line::mc::ctmc_pseudostochcomp | ( | const Matrix< T > & | Q, |
| const std::vector< std::size_t > & | keep ) |
Pseudo stochastic complement of a CTMC partition.
| Q | (n x n) generator |
| keep | 0-based indices of the retained set I; empty selects the first ceil(n/2) states |
Definition at line 61 of file ctmc_pseudostochcomp.h.
References line::Matrix< T >::cols(), ctmc_pseudostochcomp(), ctmc_solve(), line::InputError::InputError(), line::Matrix< T >::Matrix(), line::NumericError::NumericError(), line::mc::PseudoStochCompResult< T >::Q11, line::mc::PseudoStochCompResult< T >::Q12, line::mc::PseudoStochCompResult< T >::Q21, line::mc::PseudoStochCompResult< T >::Q22, line::Matrix< T >::rows(), line::mc::PseudoStochCompResult< T >::S, and line::mc::PseudoStochCompResult< T >::Tm.
Referenced by ctmc_pseudostochcomp(), and ctmc_pseudostochcomp().
| Matrix< T > line::mc::ctmc_rand | ( | std::size_t | n, |
| Gen & | gen ) |
Random infinitesimal generator of a CTMC.
| n | order of the generator |
| gen | callable 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().
| 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().
| 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.
| Q | generator |
| q | uniformization 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().
| 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().
| std::vector< T > line::mc::ctmc_relsolve | ( | const Matrix< T > & | Qin, |
| std::size_t | refstate ) |
Stationary measure scaled so that entry refstate equals one.
Definition at line 39 of file ctmc_relsolve.h.
References line::Matrix< T >::cols(), ctmc_makeinfgen(), ctmc_relsolve(), ctmc_solve(), line::InputError::InputError(), line::Matrix< T >::rows(), and line::solve().
Referenced by ctmc_relsolve(), ctmc_relsolve(), and line::lang::processes::solve_relative().
|
inline |
Pr{N(t)=k} over arrays of horizons and counts.
| D0 | generator of the phase process with the counted transitions removed |
| D1 | rates of the counted transitions; D0+D1 must be an irreducible generator |
| t | time horizons; length 1 broadcasts against k |
| k | event counts; length 1 broadcasts against t |
| method | SADDLEPOINT_DANIELS2 (the default), SADDLEPOINT_DANIELS or SADDLEPOINT_PLAIN |
| pi0 | initial 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().
|
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.
|
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().
| 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().
| 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.
| Q | generator |
| dQ | derivative of the generator with respect to theta, same size |
| pi | steady-state distribution; must sum to one |
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().
| 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.
| Q | (m x m) generator, negative diagonal and zero row sums |
| pi0 | initial distribution; empty draws it uniformly at random and normalizes, as the reference does |
| n | number of steps |
| rng | generator, 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().
| 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().
| std::vector< T > line::mc::ctmc_solve | ( | const Matrix< T > & | Qin | ) |
Steady-state distribution of a continuous-time Markov chain.
| Qin | generator; the diagonal is recomputed, so an off-diagonal rate matrix is accepted directly |
Definition at line 122 of file ctmc_solve.h.
References line::Matrix< T >::cols(), ctmc_bicgstab(), ctmc_gmres(), ctmc_makeinfgen(), ctmc_solve(), line::mc::BicgstabResult< T >::flag, line::mc::GmresResult< T >::flag, GMRES_MIN_STATES, line::InputError::InputError(), line::NumericError::NumericError(), line::Matrix< T >::rows(), line::solve(), line::mc::BicgstabResult< T >::x, and line::mc::GmresResult< T >::x.
Referenced by ctmc_passage_ph(), ctmc_pseudostochcomp(), ctmc_relsolve(), ctmc_saddlepoint(), ctmc_sens(), ctmc_solve(), ctmc_solve_reducible_blkdecomp(), ctmc_timereverse(), dtmc_solve(), line::fes::fes_map_moments(), line::fes::fes_map_solve(), line::fj::fj_respt_bulk(), line::mam::mam_bgchain_ctmc(), line::mam::map_prob(), line::mdd::mdd_closedqn(), line::mam::mfq_fluflu_sojourn(), line::mam::mfq_prio_queue(), line::mmdp::mmdp_mean_rate(), line::mmdp::mmdp_scv(), line::mam::qbd_setupdelayoff_closed(), line::qsys::qsys_bmapm1(), line::ctmc::solver_ctmc_chain(), line::ctmc::solver_ctmc_waitq_analyzer(), and line::spn::spn_pf().
| 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.
| Q | generator |
| pi0 | initial distribution; empty to let the routine pick one |
| zeroColTol | column-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().
| 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().
| 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().
| 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 ) |
Limiting distribution of a reducible CTMC by direct block decomposition of the generator.
| Qin | generator; the diagonal is recomputed |
| pin | initial distribution; empty if not available |
| reachTol | probability below which a recurrent class counts as unreached |
| zeroColTol | column-sum threshold for a state with no incoming rate |
Definition at line 70 of file ctmc_solve_reducible_blkdecomp.h.
References line::Matrix< T >::cols(), ctmc_makeinfgen(), ctmc_solve(), ctmc_solve_reducible_blkdecomp(), line::InputError::InputError(), line::mc::BlkDecompResult< T >::isrec, line::lu_factor(), line::lu_solve(), line::Matrix< T >::Matrix(), line::mc::SccResult::members, line::num_abs(), line::NumericError::NumericError(), line::mc::SccResult::numSCC(), line::mc::BlkDecompResult< T >::pi, line::mc::BlkDecompResult< T >::pi0, line::mc::BlkDecompResult< T >::pis, line::mc::SccResult::recurrent, line::Matrix< T >::rows(), line::mc::BlkDecompResult< T >::scc, line::mc::SccResult::scc, and stronglyconncomp().
Referenced by ctmc_solve_reducible_blkdecomp(), ctmc_solve_reducible_blkdecomp(), and line::ctmc::ctmc_stationary().
| double line::mc::ctmc_state_space_logsize | ( | const qn::NetworkStruct< T > & | sn, |
| const CtmcSizeOptions & | opt = CtmcSizeOptions() ) |
Worst-case log state-space size of sn.
| sn | the struct, ideally after sn_nonmarkov_toph, since a non-Markovian service becomes phases the raw struct does not carry |
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().
Stochastically monotone upper bound of a Markov chain.
| Q | (n x n) generator |
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().
| 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().
| StochCompResult< T > line::mc::ctmc_stochcomp | ( | const Matrix< T > & | Q, |
| const std::vector< std::size_t > & | I ) |
| Q | generator |
| I | state subset to keep; defaults to the first ceil(n/2) states |
Definition at line 150 of file dtmc_solve.h.
References line::Matrix< T >::cols(), ctmc_stochcomp(), line::InputError::InputError(), line::lu_factor(), line::lu_solve(), line::Matrix< T >::Matrix(), line::mc::StochCompResult< T >::Q11, line::mc::StochCompResult< T >::Q12, line::mc::StochCompResult< T >::Q21, line::mc::StochCompResult< T >::Q22, line::Matrix< T >::rows(), line::mc::StochCompResult< T >::S, and line::mc::StochCompResult< T >::T12.
Referenced by line::ctmc::ctmc_eliminate_vanishing(), ctmc_stochcomp(), ctmc_stochcomp(), line::fluid::fluid_eliminate_immediate_matrix(), and line::lang::processes::stoch_comp_full().
| 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 ) |
Takahashi's aggregation-disaggregation for a nearly completely decomposable CTMC.
| Q | generator |
| MS | macro-states partitioning 0..n-1 |
| numSteps | number of aggregation-disaggregation sweeps |
| massTol | macro-state mass below which its contribution is dropped |
Definition at line 83 of file ctmc_takahashi.h.
References line::Matrix< T >::cols(), ctmc_bicgstab(), ctmc_gmres(), ctmc_maxabs(), ctmc_randomization(), ctmc_takahashi(), dtmc_solve(), line::mc::TakahashiResult< T >::eps, line::mc::TakahashiResult< T >::epsMAX, line::mc::BicgstabResult< T >::flag, line::mc::GmresResult< T >::flag, GMRES_MIN_STATES, line::InputError::InputError(), line::NumericError::NumericError(), line::mc::TakahashiResult< T >::p, line::mc::TakahashiResult< T >::p_1, line::mc::TakahashiResult< T >::pcourt, line::mc::TakahashiResult< T >::Qperm, line::Matrix< T >::rows(), line::solve(), line::mc::BicgstabResult< T >::x, and line::mc::GmresResult< T >::x.
Referenced by line::lang::processes::aggregate(), ctmc_takahashi(), and line::env::env_ctmc_decompose().
| bool line::mc::ctmc_testpf_kolmogorov | ( | const Matrix< T > & | Qin | ) |
Kolmogorov reversibility criterion, used as a product-form test.
| Qin | generator of an irreducible CTMC |
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().
| 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().
Generator of the time-reversed CTMC.
Definition at line 37 of file ctmc_timereverse.h.
References line::Matrix< T >::cols(), ctmc_solve(), ctmc_timereverse(), line::InputError::InputError(), and line::Matrix< T >::rows().
Referenced by ctmc_timereverse(), and line::lang::processes::to_time_reversed().
| 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).
| Q | generator |
| pi0 | initial distribution (row vector) |
| t0 | initial time |
| t1 | final time |
| rtol | relative tolerance of the integrator (MATLAB RelTol, 1e-3) |
| atol | absolute 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().
| 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().
| 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().
| 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 ) |
Definition at line 259 of file ctmc_transient.h.
References ctmc_transient_on_grid(), line::InputError::InputError(), and line::mc::TransientResult< T >::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.
| Q | generator |
| dQ | derivative of the generator with respect to theta, same size |
| pi0 | initial distribution (row vector) |
| t0 | initial time |
| t1 | final time |
| rtol | relative tolerance of the ODE integrator |
| atol | absolute 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().
| 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().
| 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].
| pi0 | initial distribution (row vector) |
| Q | generator |
| t | time horizon |
| tol | Poisson-tail truncation tolerance (MATLAB default 1e-12) |
| maxiter | iteration 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().
| 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().
| 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().
Normalize a non-negative matrix into a stochastic transition matrix.
| Pin | matrix with non-negative entries |
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().
| 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().
| 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().
| std::vector< T > line::mc::dtmc_solve | ( | const Matrix< T > & | P | ) |
Stationary distribution of a stochastic matrix P.
Definition at line 106 of file dtmc_solve.h.
References line::Matrix< T >::cols(), ctmc_solve(), dtmc_solve(), line::InputError::InputError(), and line::Matrix< T >::rows().
Referenced by line::cache::cache_lrum_map_levelstats(), line::qn::NetworkStruct< T >::chain_visits(), ctmc_courtois(), ctmc_kms(), ctmc_takahashi(), line::mam::dmap_compress_batch(), line::mam::dmap_lambda_batch(), line::mam::dmap_pie(), line::lang::dmap_refresh_moments(), dtmc_solve(), dtmc_solve_reducible(), dtmc_timereverse(), line::mam::mg1_dt_pi(), line::pfqn::pfqn_sdrvisits(), line::mam::ph2hyper(), line::mam::q_dt_map_map_1(), line::qsys::qsys_bmapm1(), line::qsys::qsys_mapg1k(), line::qsys::qsys_mg1k_loss(), line::ctmc::solver_ctmc_chain(), and line::qn::NetworkStruct< T >::visits_from_block().
| ReducibleResult< T > line::mc::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.
| P | transition matrix, possibly reducible |
| pin | initial distribution; empty to let the routine pick one |
| zeroColTol | column-sum threshold below which a state is treated as having no incoming mass (MATLAB 1e-12) |
Definition at line 120 of file dtmc_solve_reducible.h.
References line::Matrix< T >::cols(), dtmc_makestochastic(), dtmc_solve(), dtmc_solve_reducible(), line::InputError::InputError(), line::mc::ReducibleResult< T >::isrec, line::Matrix< T >::Matrix(), line::mc::SccResult::members, line::mc::SccResult::numSCC(), line::mc::ReducibleResult< T >::pi, line::mc::ReducibleResult< T >::pi0, line::mc::ReducibleResult< T >::pil, line::mc::ReducibleResult< T >::pis, line::mc::ReducibleResult< T >::Pl, line::mc::SccResult::recurrent, line::Matrix< T >::rows(), line::mc::ReducibleResult< T >::scc, line::mc::SccResult::scc, and stronglyconncomp().
Referenced by line::lang::processes::chain_solve(), line::qn::NetworkStruct< T >::chain_visits(), ctmc_solve_reducible(), dtmc_solve_reducible(), dtmc_solve_reducible(), line::ctmc::solver_ctmc_chain(), and line::qn::NetworkStruct< T >::visits_from_block().
| 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().
| P | (n x n) row-stochastic transition matrix |
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().
| 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.
| P | (n x n) row-stochastic transition matrix |
| keep | the 0-based indices of the states to retain (the set I) |
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().
Transition matrix of the time-reversed DTMC.
Definition at line 49 of file ctmc_timereverse.h.
References line::Matrix< T >::cols(), dtmc_solve(), dtmc_timereverse(), line::InputError::InputError(), and line::Matrix< T >::rows().
Referenced by dtmc_timereverse(), and line::lang::processes::to_time_reversed().
Uniform initial law and one step, matching the one-argument MATLAB call.
Definition at line 66 of file dtmc_transient.h.
References dtmc_transient().
| 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().
| 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().
|
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().
| 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.
| hlst | per-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().
| 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.
| 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().
| 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().
Strongly connected components of a directed graph, and which of them are recurrent (closed under the successor relation).
| A | adjacency 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().
|
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().
|
inline |
Definition at line 124 of file ctmc_saddlepoint.h.
References tx_finite().
Referenced by tx_finite().
|
inline |
Definition at line 118 of file ctmc_saddlepoint.h.
References tx_log().
Referenced by ctmc_saddlepoint(), and tx_log().
| 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().
|
constexpr |
8 bytes of value plus 8 amortized for the index, per stored nonzero.
Definition at line 52 of file ctmc_memory_gate.h.
|
constexpr |
Fraction of available memory the solver may target.
Definition at line 54 of file ctmc_memory_gate.h.
Referenced by ctmc_memory_gate().
|
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().
|
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().
|
constexpr |
Definition at line 57 of file ctmc_memory_gate.h.
Referenced by ctmc_memory_gate().
|
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().
|
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().
|
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().
|
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().