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

Namespaces

namespace  ag
namespace  aoi
namespace  api
namespace  autosolver
namespace  ba
namespace  cache
namespace  ctmc
namespace  da
namespace  dpfqn
namespace  dqsys
namespace  env
namespace  fes
namespace  fj
namespace  fluid
namespace  http
namespace  infer
namespace  io
namespace  jmt
namespace  lang
namespace  ldes
namespace  ln
namespace  lossn
namespace  lp
namespace  lqn
namespace  lqns
namespace  lsn
namespace  lti
namespace  mam
namespace  mapqn
namespace  mc
namespace  mdd
namespace  me
namespace  mmdp
namespace  moment
namespace  mva
namespace  nc
namespace  npfqn
namespace  opt
namespace  perm
namespace  pfqn
namespace  polling
namespace  qn
namespace  qns
namespace  qsys
namespace  reg
namespace  retrieval
namespace  rng
namespace  sens
namespace  sim
namespace  smc
namespace  sn
namespace  snc
namespace  solvers
namespace  spn
namespace  ssa
namespace  sum
namespace  sym
namespace  tr
namespace  trace
namespace  uq
namespace  util
namespace  wf
namespace  workflow
namespace  ws
namespace  xml

Classes

struct  ApiEntry
struct  AugLagOptions
 Tuning of the outer multiplier iteration. More...
struct  AugLagResult
 Outcome of a constrained solve. More...
struct  AvgTable
 getAvgTable, one row per (station, class) that carries a metric. More...
struct  Bound
 Box constraint on one variable. More...
struct  BoundsTable
 SolverBA(model, method).getBoundsTable(). More...
class  Cache
 Cache(model, name, params). More...
struct  CdfCurve
 One response-time CDF curve: F the CDF value, t the time it is reached. More...
class  ClassSwitch
 ClassSwitch(model, name, C). More...
class  ClosedClass
 ClosedClass(model, name, njobs, refstat, prio). More...
class  Delay
 Delay(model, name): the infinite-server station. More...
class  Error
 Base error for the multiprecision C++ port. More...
class  Fork
 Fork(model, name). More...
class  InputError
 Malformed or inconsistent input (dimensions, negative populations, ...). More...
class  JobClass
 A job class: the index it was given, and the model that owns it. More...
class  Join
 Join(model, name, fork). More...
struct  LevmarOptions
 Tuning of the Levenberg-Marquardt iteration. More...
struct  LevmarResult
 Outcome of a least-squares solve. More...
struct  LsodaOptions
 Integration controls. More...
struct  LsodaSolution
 Result of an integration, mirroring OdeSolution in ode.h. More...
class  LsodaStepper
 One internal step at a time: ODEPACK's itask = 2. More...
struct  LstsqResult
 Outcome of lstsq: the solution and whether the system was rank deficient. More...
class  Matrix
class  MatrixView
struct  NelderMeadOptions
 Tuning of the simplex iteration. More...
struct  NelderMeadResult
 Outcome of a simplex minimization. More...
class  NetworkSolver
 The shared surface of every solver, Python's NetworkSolver. More...
struct  NoConstraints
 A constraint map that returns no constraints; the default for h or g. More...
class  Node
 A node of the model: the index it was given, and the model that owns it. More...
struct  num_traits
struct  num_traits< Complex >
struct  num_traits< double >
struct  num_traits< Rational >
struct  num_traits< Real< D > >
class  NumericError
 The algorithm cannot proceed on this instance (singular matrix, ...). More...
struct  OdeOptions
 Integration controls. More...
struct  OdeSolution
 Result of an integration. More...
class  OpenClass
 OpenClass(model, name, prio). More...
struct  pivot_mag
 The ordered type the pivot search compares in. More...
struct  pivot_mag< std::complex< R > >
 Partial pivoting compares moduli, since the complex field is unordered. More...
class  Place
 Place(model, name): a Petri-net place. More...
class  Queue
 Queue(model, name, strategy). More...
struct  RealSchur
 Real Schur factorization A = Z T Z^T, with Z orthogonal and T upper quasi-triangular: 1 x 1 diagonal blocks for real eigenvalues and 2 x 2 blocks for complex conjugate pairs. More...
struct  RootResult
 Outcome of a scalar solve. More...
class  Router
 Router(model, name): a stateless routing node. More...
class  SelfLoopingClass
 SelfLoopingClass(model, name, njobs, refstat, prio). More...
class  Sink
 Sink(model, name): the external departure node, which holds no jobs. More...
class  SolverBA
 SolverBA: the bounding solver, whose result is a bounds table. More...
class  SolverCTMC
 SolverCTMC: the average table plus the chain it was computed from. More...
class  SolverFLD
 SolverFLD: the fluid solver, which also answers a transient. More...
struct  SolverOptions
 The knobs a solver reads; a negative or empty field keeps the engine default. More...
class  Source
 Source(model, name): the external arrival station. More...
class  Station
 A node that holds jobs and serves them: MATLAB's Station. More...
struct  SvdFactors
 A = U diag(s) Vt, with U (m x m), s of length min(m,n) and Vt (n x n). More...
class  SylvesterFactor
 The Kronecker operator of a FIXED (A,B) pair, factorized once. More...
struct  TranAvg
 getTranAvg: the transient mean queue length per (station, class). More...
class  Transition
 Transition(model, name, params): a Petri-net transition. More...
class  UnsupportedError
 Requested feature or arithmetic mode is not ported yet. More...

Typedefs

typedef lang::Distrib< double > Distribution
typedef qn::Network< double > NetworkModel
typedef qn::RoutingMatrix< double > Routing
typedef lang::Distrib< double > Dist
using Complex = std::complex<double>
using Rational
using BigInt = boost::multiprecision::cpp_int
template<unsigned Digits10>
using Real = boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits10>>
using Real50 = Real<50>
 Precision tiers offered by the CLI's –arith real:<digits> flag.
using Real100 = Real<100>
using Real200 = Real<200>
typedef qn::Network< double > Network
 Network as a user names it: the double model, Python's Network.
typedef qn::RoutingMatrix< double > RoutingMatrix
 model.init_routing_matrix()'s type, Python's RoutingMatrix.
typedef SolverMVA MVA
typedef SolverNC NC
typedef SolverCTMC CTMC
typedef SolverSSA SSA
typedef SolverFLD FLD
typedef SolverFLD SolverFluid
typedef SolverMAM MAM
typedef SolverJMT JMT
typedef SolverLDES LDES
typedef SolverAUTO AUTO
typedef SolverBA BA
using LsodaRhs = std::function<void(double t, const double* y, double* dydt)>
 The right-hand side dy/dt = f(t, y).

Enumerations

enum class  Arith { Double , Exact , Real }

Functions

 LINE_DIST_CTOR (Exp)
 Exp(rate): the exponential law of the given RATE, as Python's Exp.
 LINE_DIST_CTOR (Erlang)
 Erlang(phase_rate, nphases).
 LINE_DIST_CTOR (HyperExp)
 HyperExp(p, lambda1, lambda2).
 LINE_DIST_CTOR (Coxian)
 Coxian(mu, phi).
 LINE_DIST_CTOR (Cox2)
 Cox2(mu1, mu2, phi1).
 LINE_DIST_CTOR (PH)
 PH(alpha, A): a general phase-type law.
 LINE_DIST_CTOR (APH)
 APH(alpha, A): the acyclic phase-type law.
 LINE_DIST_CTOR (MAP)
 MAP(D0, D1).
 LINE_DIST_CTOR (Det)
 Det(t): the deterministic law.
 LINE_DIST_CTOR (Immediate)
 Immediate(): a zero-time transition.
 LINE_DIST_CTOR (Disabled)
 Disabled(): the class is not served here.
 LINE_DIST_CTOR (Uniform)
 Uniform(a, b).
 LINE_DIST_CTOR (Pareto)
 Pareto(shape, scale).
 LINE_DIST_CTOR (Gamma)
 Gamma(shape, scale).
 LINE_DIST_CTOR (Weibull)
 Weibull(scale, shape).
 LINE_DIST_CTOR (Lognormal)
 Lognormal(logmean, logsigma).
 LINE_DIST_CTOR (Normal)
 Normal(mu, sigma).
 LINE_DIST_CTOR (Geometric)
 Geometric(p).
 LINE_DIST_CTOR (Bernoulli)
 Bernoulli(p).
 LINE_DIST_CTOR (Binomial)
 Binomial(n, p).
 LINE_DIST_CTOR (Poisson)
 Poisson(lambda).
 LINE_DIST_CTOR (DiscreteUniform)
 DiscreteUniform(a, b).
 LINE_DIST_CTOR (Zipf)
 Zipf(s, n).
 LINE_DIST_CTOR (DiscreteSampler)
 DiscreteSampler(p, x).
 LINE_DIST_CTOR (Replayer)
 Replayer(samples) / Replayer(samples, path): the trace-driven law.
void serial_routing (Routing &P, std::size_t r, std::size_t s, const std::vector< std::size_t > &nodes)
 Network.serialRouting(nodes) for one class pair: 1 -> 2 -> ... -> n.
void serial_routing (Routing &P, std::size_t r, const std::vector< std::size_t > &nodes)
 Network.serialRouting(nodes) on one class of a model.
void cyclic_routing (Routing &P, std::size_t r, const std::vector< std::size_t > &nodes)
 The same chain closed into a cycle, which is how a closed model circulates.
double log_bigint (const BigInt &v)
 log(v) for a positive arbitrary-precision integer.
template<class T>
num_abs (const T &v)
template<>
double num_abs< double > (const double &v)
template<class T>
num_factorial (unsigned n)
 Factorial as a value of T.
template<class T>
num_pow_int (const T &base, unsigned e)
 Integer power, valid in any field (no transcendental requirement).
const char * arith_name (Arith a)
const std::vector< ApiEntry > & api_registry ()
 The registry is a function-local static, not a global object, so there is no static-initialization order issue and no mutable global state to guard when the library is called from Python with the GIL released.
const ApiEntryfind_api (const std::string &name)
bool api_supports (const ApiEntry &e, Arith a)
 LINE_DECLARE_SOLVER (SolverMVA, "MVA")
 LINE_DECLARE_SOLVER (SolverNC, "NC")
 LINE_DECLARE_SOLVER (SolverMAM, "MAM")
 LINE_DECLARE_SOLVER (SolverSSA, "SSA")
 LINE_DECLARE_SOLVER (SolverJMT, "JMT")
 LINE_DECLARE_SOLVER (SolverLDES, "LDES")
 LINE_DECLARE_SOLVER (SolverAUTO, "AUTO")
template<class T>
AugLagOptions< T > auglag_defaults ()
 Defaults: rho0 = 10, growth 10, feasibility 1e-10, 50 outer iterations.
template<class T, class F, class H, class G>
AugLagResult< T > auglag (F f, H h, G g, const std::vector< T > &x0, const std::vector< Bound< T > > &bounds, const AugLagOptions< T > &opt)
 Augmented Lagrangian with a scalar objective and a simplex inner solver.
template<class T, class F, class H, class G>
AugLagResult< T > auglag (F f, H h, G g, const std::vector< T > &x0, const std::vector< Bound< T > > &bounds)
 auglag with the default tuning.
template<class T, class R, class H, class G>
AugLagResult< T > auglag_ls (R r, std::size_t m, H h, G g, const std::vector< T > &x0, const AugLagOptions< T > &opt)
 Augmented Lagrangian with a least-squares objective and levmar as the inner solver.
template<class T, class R, class H, class G>
AugLagResult< T > auglag_ls (R r, std::size_t m, H h, G g, const std::vector< T > &x0)
 auglag_ls with the default tuning.
Rational rational_from_decimal (const std::string &s)
 The literal as an exact rational, num/10^k with no rounding.
template<class T>
num_from_decimal (const std::string &s)
 Parse a decimal literal into T.
template<>
Rational num_from_decimal< Rational > (const std::string &s)
double dbl_from_decimal (const std::string &s, double fallback)
 Parse a decimal literal as a plain double (multiplicities, populations, tolerances).
std::vector< std::complex< double > > eig_values (const Matrix< double > &A)
 Eigenvalues of a general real square matrix, in LAPACK's order.
double spectral_radius (const Matrix< double > &A)
 Largest modulus over the spectrum, i.e.
double subdominant_modulus (const Matrix< double > &A)
 Second largest modulus over the spectrum.
std::vector< double > svd_values (const Matrix< double > &A)
 Singular values in descending order.
RealSchur schur_decomposition (const Matrix< double > &A)
 Real Schur factorization of a general square matrix (LAPACK dgees, unsorted).
RealSchur schur_reorder (const RealSchur &s, const std::vector< double > &key)
 Reorder the diagonal blocks of a real Schur form into DESCENDING key order, stably, updating Z so that A = Z T Z^T still holds.
std::size_t matrix_rank (const Matrix< double > &A)
 Numerical rank at the standard max(m,n) eps sigma_1 threshold.
template<class T>
Matrix< T > expm (const Matrix< T > &A)
 Matrix exponential exp(A).
template<class T>
Matrix< T > expm (const Matrix< T > &A, const T &t)
 exp(t A), the form every MAP descriptor actually needs.
void dft (std::vector< std::complex< double > > &a, bool inverse)
 In-place DFT of a.
template<class T>
LevmarOptions< T > levmar_defaults ()
 MINPACK-like defaults, with a central-difference step of eps^(1/3).
template<class T, class F>
Matrix< T > levmar_jacobian_fd (F f, const std::vector< T > &x, std::size_t m, const T &diff_step)
 Central-difference Jacobian of r at x.
template<class T, class F, class J>
LevmarResult< T > levmar_jac (F f, J jac, const std::vector< T > &x0, std::size_t m, const LevmarOptions< T > &opt)
 Levenberg-Marquardt with a caller-supplied Jacobian.
template<class T, class F>
LevmarResult< T > levmar (F f, const std::vector< T > &x0, std::size_t m, const LevmarOptions< T > &opt)
 Levenberg-Marquardt with a central-difference Jacobian.
template<class T, class F>
LevmarResult< T > levmar (F f, const std::vector< T > &x0, std::size_t m)
 levmar with the default tuning.
template<class T>
Matrix< T > eye (std::size_t n)
 Identity of order n.
template<class T>
Matrix< T > matmul (const Matrix< T > &A, const Matrix< T > &B)
 Matrix product A B.
template<class T>
std::vector< T > vecmul (const std::vector< T > &v, const Matrix< T > &A)
 Row vector times matrix, v A.
template<class T>
std::vector< T > mulvec (const Matrix< T > &A, const std::vector< T > &v)
 Matrix times column vector, A v.
template<class T>
Matrix< T > inverse (const Matrix< T > &A)
 Inverse by LU with one factorization and n back substitutions.
template<class T>
Matrix< T > matpow (const Matrix< T > &A, unsigned k)
 Integer matrix power, by repeated squaring.
template<class T>
std::vector< T > ones (std::size_t n)
 Column vector of ones, the ubiquitous e in MAP algebra.
LsodaSolution lsoda_integrate_stepwise (const LsodaRhs &f, const std::vector< double > &y0, const std::vector< double > &t_eval, const LsodaOptions &opt)
 Integrate dy/dt = f(t, y) from t_eval.front() through every later entry of t_eval, returning the state at each.
LsodaSolution lsoda_integrate (const LsodaRhs &f, const std::vector< double > &y0, const std::vector< double > &t_eval, const LsodaOptions &opt=LsodaOptions())
std::vector< double > lsoda_final (const LsodaRhs &f, const std::vector< double > &y0, double t0, double t1, const LsodaOptions &opt=LsodaOptions())
 Convenience form: integrate from t0 to t1 and report only the end state.
template<class T>
std::vector< std::size_t > rref (Matrix< T > &A, const T &tol)
 Reduced row echelon form of A, in place, returning the pivot columns.
template<class T>
LstsqResult< T > lstsq (const Matrix< T > &A, const std::vector< T > &b, const T &tol)
 Least-squares solution of A x = b, minimum-norm when A is rank deficient.
template<class T>
LstsqResult< T > lstsq (const Matrix< T > &A, const std::vector< T > &b)
 Overload picking the default pivot threshold for the arithmetic in use.
template<class T>
std::vector< std::size_t > lu_factor (Matrix< T > &A)
 In-place LU of A (n x n).
template<class T>
void lu_solve (const Matrix< T > &LU, const std::vector< std::size_t > &piv, std::vector< T > &b)
 Solve LUx = Pb in place on b, using the factors from lu_factor.
template<class T>
lu_det (const Matrix< T > &A)
 Determinant of a square matrix, by the same partial-pivoting elimination.
template<class T>
std::vector< T > solve (const Matrix< T > &A, const std::vector< T > &b)
 Convenience: solve Ax = b, leaving A and b untouched.
template<class T, class S>
Matrix< T > matrix_from (const MatrixView< S > &v)
 Deep copy of a view into an owning matrix, converting the element type.
template<class T>
NelderMeadOptions< T > nelder_mead_defaults ()
 fminsearch's coefficients and initial simplex, with tighter tolerances.
template<class T>
Bound< T > bound_free ()
 Unbounded variable.
template<class T>
Bound< T > bound_lower (const T &lo)
 lo <= x.
template<class T>
Bound< T > bound_upper (const T &hi)
 x <= hi.
template<class T>
Bound< T > bound_box (const T &lo, const T &hi)
 lo <= x <= hi.
template<class T, class F>
NelderMeadResult< T > nelder_mead (F f, const std::vector< T > &x0, const NelderMeadOptions< T > &opt)
 Unconstrained simplex minimization.
template<class T, class F>
NelderMeadResult< T > nelder_mead (F f, const std::vector< T > &x0)
 nelder_mead with the default tuning.
template<class T, class F>
NelderMeadResult< T > nelder_mead_box (F f, const std::vector< T > &x0, const std::vector< Bound< T > > &bounds, const NelderMeadOptions< T > &opt)
 Box-constrained simplex minimization by the transformation described in the header comment.
template<class T, class F>
NelderMeadResult< T > nelder_mead_box (F f, const std::vector< T > &x0, const std::vector< Bound< T > > &bounds)
 nelder_mead_box with the default tuning.
template<class T, class F>
Matrix< T > ode_numeric_jacobian (const F &f, const T &t, const std::vector< T > &y, const std::vector< T > &fy)
 Numeric Jacobian by central differences.
template<class T, class F, class J>
OdeSolution< T > ode_rosenbrock4 (const F &f, const J &jac, const T &t0, const T &t1, const std::vector< T > &y0, const OdeOptions< T > &opt)
 Integrate y' = f(t,y) from t0 to t1 with an analytic Jacobian.
template<class T, class F>
OdeSolution< T > ode_rosenbrock4 (const F &f, const T &t0, const T &t1, const std::vector< T > &y0, const OdeOptions< T > &opt)
 Integrate y' = f(t,y) with a numeric Jacobian by central differences.
template<class T, class F>
std::vector< T > ode_rosenbrock4_endpoint (const F &f, const T &t0, const T &t1, const std::vector< T > &y0)
 Integrate with the default options and return only the state at t1.
std::vector< std::size_t > plane_sizes (const std::vector< int > &N)
 Mixed-radix plane sizes: prods[r] = prod_{s<r} (N[s]+1).
std::size_t population_count (const std::vector< int > &N)
 Number of population vectors n with 0 <= n <= N.
std::size_t pop_index (const std::vector< int > &n, const std::vector< std::size_t > &prods)
 Index of n in the lattice, 0-based (MATLAB hashpop is 1-based).
bool next_pop (std::vector< int > &n, const std::vector< int > &N)
 Advance n to the next population vector in the lattice 0 <= n <= N, odometer order with the last class varying fastest.
double nck (int n, int k)
 Binomial coefficient with a thread-local memo table (mp_pfqn util/nck.c).
double multichoose (int n, int k)
 Number of multisets of size k from n types, i.e.
template<class T>
num_nck (int n, int k)
 Binomial coefficient as a value of T, by the Pascal recurrence.
template<class T, class F>
RootResult< T > root_bisect (F f, const T &a, const T &b, const T &tol, unsigned maxiter=200)
 Bisection on a bracket with a sign change.
template<class T, class F>
RootResult< T > root_brent (F f, const T &a0, const T &b0, const T &tol, unsigned maxiter=200)
 Brent's method on a bracket with a sign change.
template<class T, class F, class DF>
RootResult< T > root_newton (F f, DF df, const T &x0, const T &tol, unsigned maxiter=200)
 Plain Newton from a starting point.
template<class T, class F, class DF>
RootResult< T > root_newton_safe (F f, DF df, const T &a0, const T &b0, const T &tol, unsigned maxiter=200)
 Newton safeguarded by a bracket with a sign change: the Newton step is used only when it stays inside the bracket and at least halves it, otherwise the step is a bisection.
template<class T, class F>
void bracket_expand (F f, const T &a, T &b, unsigned maxdoubling=200)
 Expand a bracket to the right until f changes sign, doubling the upper end.
SvdFactors svd_full (const Matrix< double > &A)
 Full SVD of a real matrix, singular values in descending order.
Matrix< double > pinv (const Matrix< double > &A)
 Moore-Penrose pseudo-inverse, A^+ = V diag(1/s_i) U^T over the singular values above max(m,n) eps sigma_1, which is MATLAB's default pinv tolerance.
template<class T>
Matrix< T > sylvester_solve (const Matrix< T > &A, const Matrix< T > &B, const Matrix< T > &C)
 Solve A X + X B = C for X.
template<class T>
Matrix< T > lyap_solve (const Matrix< T > &A, const Matrix< T > &B, const Matrix< T > &C)
 MATLAB lyap(A,B,C) solves A X + X B + C = 0, i.e.
Matrix< double > sylvester_schur (const Matrix< double > &A, const Matrix< double > &B, const Matrix< double > &C)
 A X + X B = C by Bartels-Stewart, at double.
Matrix< double > lyap_schur (const Matrix< double > &A, const Matrix< double > &B, const Matrix< double > &C)
 MATLAB lyap(A,B,C) at double via Bartels-Stewart: A X + X B + C = 0.

Typedef Documentation

◆ AUTO

typedef SolverAUTO line::AUTO

Definition at line 182 of file solver.h.

◆ BA

typedef SolverBA line::BA

Definition at line 183 of file solver.h.

◆ BigInt

using line::BigInt = boost::multiprecision::cpp_int

Definition at line 78 of file number.h.

◆ Complex

using line::Complex = std::complex<double>

Definition at line 43 of file complex_number.h.

◆ CTMC

Definition at line 175 of file solver.h.

◆ Dist

typedef lang::Distrib<double> line::Dist

Definition at line 53 of file nodes.h.

◆ Distribution

Definition at line 42 of file distributions.h.

◆ FLD

Definition at line 177 of file solver.h.

◆ JMT

typedef SolverJMT line::JMT

Definition at line 180 of file solver.h.

◆ LDES

typedef SolverLDES line::LDES

Definition at line 181 of file solver.h.

◆ LsodaRhs

using line::LsodaRhs = std::function<void(double t, const double* y, double* dydt)>

The right-hand side dy/dt = f(t, y).

y and dydt are plain 0-based arrays of length neq. The vendored solver keeps its state 1-based internally, as the Fortran original did, and hands the callback pointers already offset past the unused slot, so nothing here has to know about that.

Definition at line 54 of file lsoda.h.

◆ MAM

typedef SolverMAM line::MAM

Definition at line 179 of file solver.h.

◆ MVA

typedef SolverMVA line::MVA

Definition at line 173 of file solver.h.

◆ NC

typedef SolverNC line::NC

Definition at line 174 of file solver.h.

◆ Network

typedef qn::Network<double> line::Network

Network as a user names it: the double model, Python's Network.

Definition at line 53 of file solver.h.

◆ NetworkModel

Definition at line 51 of file nodes.h.

◆ Rational

Initial value:
boost::multiprecision::number<boost::multiprecision::cpp_rational_backend,
boost::multiprecision::et_off>

Definition at line 76 of file number.h.

◆ Real

template<unsigned Digits10>
using line::Real = boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits10>>

Definition at line 80 of file number.h.

◆ Real100

using line::Real100 = Real<100>

Definition at line 85 of file number.h.

◆ Real200

using line::Real200 = Real<200>

Definition at line 86 of file number.h.

◆ Real50

using line::Real50 = Real<50>

Precision tiers offered by the CLI's –arith real:<digits> flag.

Definition at line 84 of file number.h.

◆ Routing

Definition at line 52 of file nodes.h.

◆ RoutingMatrix

model.init_routing_matrix()'s type, Python's RoutingMatrix.

Definition at line 55 of file solver.h.

◆ SolverFluid

Definition at line 178 of file solver.h.

◆ SSA

typedef SolverSSA line::SSA

Definition at line 176 of file solver.h.

Enumeration Type Documentation

◆ Arith

enum class line::Arith
strong
Enumerator
Double 
Exact 
Real 

Definition at line 26 of file registry.h.

Function Documentation

◆ api_registry()

const std::vector< ApiEntry > & line::api_registry ( )
inline

The registry is a function-local static, not a global object, so there is no static-initialization order issue and no mutable global state to guard when the library is called from Python with the GIL released.

Definition at line 49 of file registry.h.

References api_registry(), Double, Exact, and Real.

Referenced by api_registry(), and find_api().

◆ api_supports()

bool line::api_supports ( const ApiEntry & e,
Arith a )
inline

Definition at line 1684 of file registry.h.

References api_supports(), and line::ApiEntry::arith.

Referenced by line::reg::api_invoke(), and api_supports().

◆ arith_name()

const char * line::arith_name ( Arith a)
inline

Definition at line 28 of file registry.h.

References arith_name(), Double, Exact, and Real.

Referenced by line::reg::api_invoke(), and arith_name().

◆ auglag() [1/2]

template<class T, class F, class H, class G>
AugLagResult< T > line::auglag ( F f,
H h,
G g,
const std::vector< T > & x0,
const std::vector< Bound< T > > & bounds )

auglag with the default tuning.

Definition at line 215 of file auglag.h.

References auglag(), and auglag_defaults().

◆ auglag() [2/2]

template<class T, class F, class H, class G>
AugLagResult< T > line::auglag ( F f,
H h,
G g,
const std::vector< T > & x0,
const std::vector< Bound< T > > & bounds,
const AugLagOptions< T > & opt )

Augmented Lagrangian with a scalar objective and a simplex inner solver.

Parameters
fobjective, x -> T
hequality constraints, x -> vector (empty for none)
ginequality constraints g(x) <= 0, x -> vector (empty for none)
x0starting point
boundsone Bound per variable; pass all-free bounds for none
opttuning

Definition at line 141 of file auglag.h.

References auglag(), line::AugLagResult< T >::converged, line::NelderMeadResult< T >::converged, line::AugLagResult< T >::fval, line::InputError::InputError(), line::AugLagResult< T >::lambda, line::AugLagResult< T >::mu, nelder_mead_box(), line::AugLagResult< T >::outer_iterations, line::AugLagResult< T >::violation, line::AugLagResult< T >::x, and line::NelderMeadResult< T >::x.

Referenced by line::mam::amap2_adjust_gamma(), auglag(), auglag(), line::mam::map_anfit_lsq(), and line::mam::maph2m_fit_multiclass().

◆ auglag_defaults()

◆ auglag_ls() [1/2]

template<class T, class R, class H, class G>
AugLagResult< T > line::auglag_ls ( R r,
std::size_t m,
H h,
G g,
const std::vector< T > & x0 )

auglag_ls with the default tuning.

Definition at line 320 of file auglag.h.

References auglag_defaults(), and auglag_ls().

◆ auglag_ls() [2/2]

template<class T, class R, class H, class G>
AugLagResult< T > line::auglag_ls ( R r,
std::size_t m,
H h,
G g,
const std::vector< T > & x0,
const AugLagOptions< T > & opt )

Augmented Lagrangian with a least-squares objective and levmar as the inner solver.

The augmented Lagrangian of a sum of squares is itself a sum of squares up to an additive constant, because lambda h + (rho/2) h^2 = (rho/2)(h + lambda/rho)^2 - lambda^2/(2 rho) (1/(2 rho)) max(0, mu + rho g)^2 = (rho/2) max(0, g + mu/rho)^2 so the inner problem is handed to levmar with the extended residual [ r(x) ; sqrt(rho/2) (h + lambda/rho) ; sqrt(rho/2) max(0, g + mu/rho) ]. The dropped constants do not move the minimizer. The max(.) makes the extended residual only piecewise smooth, which the finite-difference Jacobian tolerates because an inequality is either active or inactive over a whole differencing step except on a measure-zero set of iterates.

Bounds are NOT supported here (levmar is unconstrained): express them as inequality rows of g, which is what the callers in line/api/mam do.

Parameters
rresidual map, x -> vector of length m; the objective is sum r_i^2
mnumber of residuals
hequality constraints
ginequality constraints g(x) <= 0
x0starting point
opttuning

Definition at line 246 of file auglag.h.

References auglag_ls(), line::AugLagResult< T >::converged, line::LevmarResult< T >::converged, line::AugLagResult< T >::fval, line::InputError::InputError(), line::AugLagResult< T >::lambda, levmar(), line::AugLagResult< T >::mu, line::AugLagResult< T >::outer_iterations, line::AugLagResult< T >::violation, line::AugLagResult< T >::x, and line::LevmarResult< T >::x.

Referenced by line::mam::aph2_adjust_opt_char(), line::mam::aph2_adjust_opt_param(), auglag_ls(), auglag_ls(), and line::mam::mmpp2_fitc_approx().

◆ bound_box()

template<class T>
Bound< T > line::bound_box ( const T & lo,
const T & hi )

◆ bound_free()

template<class T>
Bound< T > line::bound_free ( )

Unbounded variable.

Definition at line 122 of file neldermead.h.

References line::Bound< T >::Bound(), and bound_free().

Referenced by bound_free().

◆ bound_lower()

template<class T>
Bound< T > line::bound_lower ( const T & lo)

lo <= x.

Definition at line 128 of file neldermead.h.

References bound_lower(), line::Bound< T >::has_lo, and line::Bound< T >::lo.

Referenced by line::mam::amap2_adjust_gamma(), and bound_lower().

◆ bound_upper()

template<class T>
Bound< T > line::bound_upper ( const T & hi)

x <= hi.

Definition at line 137 of file neldermead.h.

References bound_upper(), line::Bound< T >::has_hi, and line::Bound< T >::hi.

Referenced by bound_upper().

◆ bracket_expand()

template<class T, class F>
void line::bracket_expand ( F f,
const T & a,
T & b,
unsigned maxdoubling = 200 )

Expand a bracket to the right until f changes sign, doubling the upper end.

Used by the TTL cache fixed points, where the residual is monotone in the characteristic time but no upper bound is known a priori.

Exceptions
NumericErrorif no sign change is found before the cap

Definition at line 357 of file rootfind.h.

References bracket_expand(), and line::NumericError::NumericError().

Referenced by bracket_expand(), and line::cache::cache_t_lrum_map().

◆ cyclic_routing()

void line::cyclic_routing ( Routing & P,
std::size_t r,
const std::vector< std::size_t > & nodes )
inline

The same chain closed into a cycle, which is how a closed model circulates.

Definition at line 297 of file nodes.h.

References cyclic_routing(), serial_routing(), and line::qn::RoutingMatrix< T >::set().

Referenced by cyclic_routing().

◆ dbl_from_decimal()

double line::dbl_from_decimal ( const std::string & s,
double fallback )
inline

Parse a decimal literal as a plain double (multiplicities, populations, tolerances).

Definition at line 120 of file decimal.h.

References dbl_from_decimal().

Referenced by dbl_from_decimal(), and line::lqn::read_lqnx_model().

◆ dft()

void line::dft ( std::vector< std::complex< double > > & a,
bool inverse )
inline

In-place DFT of a.

inverse selects the +i sign and the 1/n scaling, so the pair matches MATLAB's fft and ifft.

Definition at line 120 of file fft.h.

References dft(), and inverse().

Referenced by dft().

◆ eig_values()

◆ expm() [1/2]

◆ expm() [2/2]

template<class T>
Matrix< T > line::expm ( const Matrix< T > & A,
const T & t )

exp(t A), the form every MAP descriptor actually needs.

Definition at line 198 of file expm.h.

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

◆ eye()

template<class T>
Matrix< T > line::eye ( std::size_t n)

◆ find_api()

const ApiEntry * line::find_api ( const std::string & name)
inline

Definition at line 1677 of file registry.h.

References api_registry(), and find_api().

Referenced by line::reg::api_invoke(), and find_api().

◆ inverse()

template<class T>
Matrix< T > line::inverse ( const Matrix< T > & A)

Inverse by LU with one factorization and n back substitutions.

Definition at line 72 of file linalg.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), inverse(), lu_factor(), lu_solve(), and line::Matrix< T >::rows().

Referenced by line::cache::cache_lrum_map_levelstats(), line::cache::cache_miss_rmf(), line::retrieval::cache_retrieval_inputs(), dft(), line::mam::dmap_geo_mul_sum(), line::mam::dmap_moment(), line::fj::fj_boundary_solve(), line::fj::fj_compute_pi(), line::fj::fj_compute_t_nare(), line::fj::fj_return_per(), line::fluid::fluid_eliminate_immediate(), line::fluid::fluid_refine_meanfield(), line::smc::gim1_pi_etaqa(), line::smc::gim1_qlen_etaqa(), inverse(), line::mam::map_acf(), line::mam::map_compute_R(), line::mam::map_compute_R_quadratic(), line::mam::map_embedded(), line::mam::map_geo_mul_sum(), line::mam::map_idc(), line::mam::map_isfeasible(), line::mam::map_joint(), line::mam::map_moment(), line::mam::map_stochcomp(), line::mapqn::mapqn_amva(), line::mam::mfq_fluflu_sojourn(), line::mam::mfq_fundamental(), line::mam::mfq_general_solve(), line::mam::mfq_ld_solve(), line::mam::mfq_multiregime(), line::mam::mfq_prio_queue(), line::mam::mfq_sojourn(), line::smc::mg1_cr(), line::smc::mg1_eg(), line::smc::mg1_fi(), line::mam::mmap3k_fit(), line::mam::mmap_backward_moment(), line::mam::mmap_cross_moment(), line::mam::mmap_forward_moment(), line::mam::mmap_pc(), line::mam::mmap_pie(), line::mam::mmapph1fcfs_stdistr_ph(), line::npfqn::npfqn_bnd_bpt(), line::npfqn::npfqn_traffic_rqt(), line::pfqn::pfqn_ls(), line::pfqn::pfqn_nre_full(), line::mam::ph2hyper(), line::mam::qbd_depproc_jointmom(), line::mam::qbd_fundmat(), line::mam::qbd_pi(), line::mam::qbd_qlen_factmoment(), line::mam::qbd_R(), line::mam::qbd_R_logred(), line::mam::qbd_rap(), line::qsys::qsys_bmapphnn_retrial(), line::qsys::qsys_mapd1(), line::qsys::qsys_mapdc(), line::qsys::qsys_mapg1k(), line::qsys::qsys_mapmc(), line::qsys::qsys_mapphc(), line::qsys::qsys_mmapgk1(), line::qsys::qsys_phmc(), line::retrieval::retrieval_fpi_latency(), line::ba::solver_ba_bpt(), line::ba::solver_ba_snc_envelopes(), line::mva::solver_mva_retrieval_analyzer(), and line::mva::solver_rqna().

◆ levmar() [1/2]

template<class T, class F>
LevmarResult< T > line::levmar ( F f,
const std::vector< T > & x0,
std::size_t m )

levmar with the default tuning.

Definition at line 320 of file levmar.h.

References levmar(), and levmar_defaults().

◆ levmar() [2/2]

template<class T, class F>
LevmarResult< T > line::levmar ( F f,
const std::vector< T > & x0,
std::size_t m,
const LevmarOptions< T > & opt )

Levenberg-Marquardt with a central-difference Jacobian.

Parameters
fresidual map, x -> vector of length m
x0starting point
mnumber of residuals
opttuning

Definition at line 301 of file levmar.h.

References line::LevmarResult< T >::evaluations, levmar(), levmar_jac(), and levmar_jacobian_fd().

Referenced by auglag_ls(), levmar(), and levmar().

◆ levmar_defaults()

◆ levmar_jac()

template<class T, class F, class J>
LevmarResult< T > line::levmar_jac ( F f,
J jac,
const std::vector< T > & x0,
std::size_t m,
const LevmarOptions< T > & opt )

Levenberg-Marquardt with a caller-supplied Jacobian.

Parameters
fresidual map, x -> vector of length m
jacJacobian map, x -> m x n Matrix
x0starting point
mnumber of residuals
opttuning

Definition at line 168 of file levmar.h.

References line::Matrix< T >::cols(), line::LevmarResult< T >::converged, line::LevmarResult< T >::evaluations, line::InputError::InputError(), line::LevmarResult< T >::iterations, levmar_jac(), num_abs(), line::LevmarResult< T >::residual, line::Matrix< T >::rows(), solve(), line::LevmarResult< T >::ssq, and line::LevmarResult< T >::x.

Referenced by levmar(), and levmar_jac().

◆ levmar_jacobian_fd()

template<class T, class F>
Matrix< T > line::levmar_jacobian_fd ( F f,
const std::vector< T > & x,
std::size_t m,
const T & diff_step )

Central-difference Jacobian of r at x.

The step for component j is diff_step * max(|x_j|, 1), so a variable of any magnitude gets a meaningful perturbation and a variable at zero still gets one.

Parameters
fresidual map, x -> vector of length m
xevaluation point
mnumber of residuals
diff_steprelative differencing step
Returns
the m x n Jacobian

Definition at line 133 of file levmar.h.

References line::InputError::InputError(), levmar_jacobian_fd(), and num_abs().

Referenced by levmar(), and levmar_jacobian_fd().

◆ LINE_DECLARE_SOLVER() [1/7]

line::LINE_DECLARE_SOLVER ( SolverAUTO ,
"AUTO"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DECLARE_SOLVER() [2/7]

line::LINE_DECLARE_SOLVER ( SolverJMT ,
"JMT"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DECLARE_SOLVER() [3/7]

line::LINE_DECLARE_SOLVER ( SolverLDES ,
"LDES"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DECLARE_SOLVER() [4/7]

line::LINE_DECLARE_SOLVER ( SolverMAM ,
"MAM"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DECLARE_SOLVER() [5/7]

◆ LINE_DECLARE_SOLVER() [6/7]

line::LINE_DECLARE_SOLVER ( SolverNC ,
"NC"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DECLARE_SOLVER() [7/7]

line::LINE_DECLARE_SOLVER ( SolverSSA ,
"SSA"  )

References LINE_DECLARE_SOLVER().

◆ LINE_DIST_CTOR() [1/25]

line::LINE_DIST_CTOR ( APH )

APH(alpha, A): the acyclic phase-type law.

APH.fitMeanAndSCV(mean, scv).

APH.fitCentral(mean, scv, skew).

Definition at line 124 of file distributions.h.

References line::lang::aph_fit_central(), line::lang::aph_fit_mean_scv(), LINE_DIST_CTOR(), and line::lang::Distrib< T >::phase_type().

◆ LINE_DIST_CTOR() [2/25]

line::LINE_DIST_CTOR ( Bernoulli )

Bernoulli(p).

Definition at line 206 of file distributions.h.

References line::lang::Distrib< T >::bernoulli(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [3/25]

line::LINE_DIST_CTOR ( Binomial )

Binomial(n, p).

Definition at line 211 of file distributions.h.

References line::lang::Distrib< T >::binomial(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [4/25]

line::LINE_DIST_CTOR ( Cox2 )

Cox2(mu1, mu2, phi1).

Cox2.fitCentral(mean, scv, skew).

Definition at line 106 of file distributions.h.

References line::lang::Distrib< T >::cox2(), line::lang::cox2_fit_central(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [5/25]

line::LINE_DIST_CTOR ( Coxian )

Coxian(mu, phi).

Coxian.fitMeanAndSCV(mean, scv).

Coxian.fitCentral(mean, scv, skew).

Definition at line 91 of file distributions.h.

References line::lang::Distrib< T >::coxian(), line::lang::coxian_fit_central(), line::lang::coxian_fit_mean_scv(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [6/25]

line::LINE_DIST_CTOR ( Det )

Det(t): the deterministic law.

Definition at line 146 of file distributions.h.

References line::lang::Distrib< T >::det(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [7/25]

line::LINE_DIST_CTOR ( Disabled )

Disabled(): the class is not served here.

Definition at line 156 of file distributions.h.

References line::lang::Distrib< T >::disabled_dist(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [8/25]

line::LINE_DIST_CTOR ( DiscreteSampler )

DiscreteSampler(p, x).

Definition at line 233 of file distributions.h.

References line::lang::Distrib< T >::discrete_sampler(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [9/25]

line::LINE_DIST_CTOR ( DiscreteUniform )

DiscreteUniform(a, b).

Definition at line 221 of file distributions.h.

References line::lang::Distrib< T >::discrete_uniform(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [10/25]

line::LINE_DIST_CTOR ( Erlang )

Erlang(phase_rate, nphases).

Erlang.fitMeanAndSCV(mean, scv).

Erlang.fitMeanAndOrder(mean, k).

Definition at line 58 of file distributions.h.

References line::lang::Distrib< T >::erlang(), line::lang::Distrib< T >::erlang_fit(), line::lang::erlang_fit_mean_order(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [11/25]

◆ LINE_DIST_CTOR() [12/25]

line::LINE_DIST_CTOR ( Gamma )

Gamma(shape, scale).

Gamma.fitMeanAndSCV(mean, scv).

Definition at line 175 of file distributions.h.

References line::lang::Distrib< T >::gamma_dist(), line::lang::gamma_fit_mean_scv(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [13/25]

line::LINE_DIST_CTOR ( Geometric )

Geometric(p).

Definition at line 201 of file distributions.h.

References line::lang::Distrib< T >::geometric(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [14/25]

line::LINE_DIST_CTOR ( HyperExp )

HyperExp(p, lambda1, lambda2).

HyperExp.fitMeanAndSCV(mean, scv).

HyperExp.fitMeanAndSCVBalanced(mean, scv).

Definition at line 73 of file distributions.h.

References line::lang::Distrib< T >::hyperexp(), line::lang::hyperexp_fit_mean_scv(), line::lang::hyperexp_fit_mean_scv_balanced(), line::lang::Distrib< T >::hyperexp_n(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [15/25]

line::LINE_DIST_CTOR ( Immediate )

Immediate(): a zero-time transition.

Definition at line 151 of file distributions.h.

References line::lang::Distrib< T >::immediate(), and LINE_DIST_CTOR().

◆ LINE_DIST_CTOR() [16/25]

line::LINE_DIST_CTOR ( Lognormal )

Lognormal(logmean, logsigma).

Definition at line 189 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::lognormal().

◆ LINE_DIST_CTOR() [17/25]

line::LINE_DIST_CTOR ( MAP )

MAP(D0, D1).

Definition at line 139 of file distributions.h.

References LINE_DIST_CTOR(), line::lang::MAP, and line::lang::Distrib< T >::map_dist().

◆ LINE_DIST_CTOR() [18/25]

line::LINE_DIST_CTOR ( Normal )

Normal(mu, sigma).

Definition at line 196 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::normal().

◆ LINE_DIST_CTOR() [19/25]

line::LINE_DIST_CTOR ( Pareto )

Pareto(shape, scale).

Pareto.fitMeanAndSCV(mean, scv).

Definition at line 166 of file distributions.h.

References LINE_DIST_CTOR(), line::lang::Distrib< T >::pareto(), and line::lang::pareto_fit_mean_scv().

◆ LINE_DIST_CTOR() [20/25]

line::LINE_DIST_CTOR ( PH )

PH(alpha, A): a general phase-type law.

Definition at line 117 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::phase_type().

◆ LINE_DIST_CTOR() [21/25]

line::LINE_DIST_CTOR ( Poisson )

Poisson(lambda).

Definition at line 216 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::poisson().

◆ LINE_DIST_CTOR() [22/25]

line::LINE_DIST_CTOR ( Replayer )

Replayer(samples) / Replayer(samples, path): the trace-driven law.

Definition at line 243 of file distributions.h.

References LINE_DIST_CTOR(), line::lang::Distrib< T >::replayer(), and line::lang::Distrib< T >::replayer_from().

◆ LINE_DIST_CTOR() [23/25]

line::LINE_DIST_CTOR ( Uniform )

Uniform(a, b).

Definition at line 161 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::uniform().

◆ LINE_DIST_CTOR() [24/25]

line::LINE_DIST_CTOR ( Weibull )

Weibull(scale, shape).

Definition at line 184 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::weibull().

◆ LINE_DIST_CTOR() [25/25]

line::LINE_DIST_CTOR ( Zipf )

Zipf(s, n).

Definition at line 228 of file distributions.h.

References LINE_DIST_CTOR(), and line::lang::Distrib< T >::zipf().

◆ log_bigint()

double line::log_bigint ( const BigInt & v)
inline

log(v) for a positive arbitrary-precision integer.

Keeps only the leading 53 bits of the mantissa and accounts for the discarded bits in the exponent, so the result is finite for values far outside the double range.

Definition at line 97 of file number.h.

References log_bigint().

Referenced by line::num_traits< Rational >::log_as_double(), and log_bigint().

◆ lsoda_final()

std::vector< double > line::lsoda_final ( const LsodaRhs & f,
const std::vector< double > & y0,
double t0,
double t1,
const LsodaOptions & opt = LsodaOptions() )
inline

Convenience form: integrate from t0 to t1 and report only the end state.

Definition at line 435 of file lsoda.h.

References line::LsodaSolution::final_state(), lsoda_final(), and lsoda_integrate().

Referenced by lsoda_final().

◆ lsoda_integrate()

◆ lsoda_integrate_stepwise()

LsodaSolution line::lsoda_integrate_stepwise ( const LsodaRhs & f,
const std::vector< double > & y0,
const std::vector< double > & t_eval,
const LsodaOptions & opt )
inline

Integrate dy/dt = f(t, y) from t_eval.front() through every later entry of t_eval, returning the state at each.

lsoda_integrate on the same output grid, driven one accepted step at a time so LsodaOptions::step_stop can end a window early.

t_eval must be non-empty and non-decreasing; its first entry is the initial time and is reported back unchanged with y0. This is the tspan form the fluid analyzers use, so one call covers both "give me the steady state at T" (two entries) and "give me the transient" (many).

A solver failure is reported, not thrown: success is false and istate carries LSODA's own code, because the fluid iteration treats a step that did not converge as a signal to shorten the horizon rather than as an error. The stepwise driver behind LsodaOptions::step_stop; defined below, after LsodaStepper, which it drives. Declared here so lsoda_integrate can hand off to it without moving either function.

ONE STEPPER PER OUTPUT INTERVAL, and that is what keeps the grid honest. itask = 2 may carry t PAST the interval's end, so each interval is stepped until the stepper reports it is done and then settle_at_end interpolates back onto the requested instant through the same history – exactly what a continuation call with itask = 1 does. The restart between intervals costs a little accuracy against the single itask = 1 call, which is why this driver is NOT the default: only a caller that asked for a stop test pays for it, and the fluid windows that do hand over a two-entry grid, i.e. one interval.

WHEN THE TEST FIRES the state is held for the WHOLE remaining grid rather than the trajectory being truncated. The test says the drift is zero to double precision, so y is that state for every later t and the held values are exact, not padded: a caller reading final_state() or a transient grid cannot tell this window from one that was stepped to its end, which is the point – an early return must not read as a failure to any of them.

Definition at line 379 of file lsoda.h.

References line::LsodaSolution::f_evals, line::LsodaStepper::f_evals(), line::LsodaStepper::failed(), line::LsodaSolution::istate, line::LsodaStepper::istate(), line::LsodaSolution::jacobians, lsoda_integrate_stepwise(), line::LsodaStepper::settle_at_end(), line::LsodaStepper::step(), line::LsodaSolution::steps, line::LsodaStepper::steps(), line::LsodaSolution::success, line::LsodaSolution::t, line::LsodaStepper::t(), line::LsodaStepper::t_end(), line::LsodaSolution::y, and line::LsodaStepper::y().

Referenced by lsoda_integrate(), and lsoda_integrate_stepwise().

◆ lstsq() [1/2]

template<class T>
LstsqResult< T > line::lstsq ( const Matrix< T > & A,
const std::vector< T > & b )

Overload picking the default pivot threshold for the arithmetic in use.

Definition at line 213 of file lstsq.h.

References lstsq().

◆ lstsq() [2/2]

template<class T>
LstsqResult< T > line::lstsq ( const Matrix< T > & A,
const std::vector< T > & b,
const T & tol )

Least-squares solution of A x = b, minimum-norm when A is rank deficient.

Parameters
A(m x n), any shape
b(m)
tolpivot threshold; pass 0 for the exact rank

Definition at line 152 of file lstsq.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), lstsq(), line::LstsqResult< T >::rank, line::LstsqResult< T >::rankdef, line::Matrix< T >::rows(), rref(), solve(), and line::LstsqResult< T >::x.

Referenced by line::fj::fj_boundary_solve(), line::fluid::fluid_dae_hold_multipliers(), line::fluid::fluid_dae_newton(), lstsq(), lstsq(), line::pfqn::pfqn_procomom(), line::spn::spn_pf(), and line::smc::stat().

◆ lu_det()

template<class T>
T line::lu_det ( const Matrix< T > & A)

Determinant of a square matrix, by the same partial-pivoting elimination.

SINGULAR IS A VALUE HERE, NOT AN ERROR, which is why this does not go through lu_factor: that one throws on a zero pivot because every caller of it is solving a system, where a zero pivot means the question has no answer. A determinant of a singular matrix is zero, a perfectly good answer, and Cramer's rule needs it – MarkovProcess.getProbState forms a numerator matrix that IS singular whenever the state has probability zero.

The sign comes from the parity of the row swaps, so it is exact even where the product of the pivots is not.

Definition at line 122 of file lu.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), lu_det(), line::pivot_mag< T >::of(), and line::Matrix< T >::rows().

Referenced by line::lang::processes::get_prob_state(), and lu_det().

◆ lu_factor()

◆ lu_solve()

template<class T>
void line::lu_solve ( const Matrix< T > & LU,
const std::vector< std::size_t > & piv,
std::vector< T > & b )

Solve LUx = Pb in place on b, using the factors from lu_factor.

The whole permutation must be applied to b BEFORE any elimination. lu_factor swaps entire rows, multiplier columns included, so LU(i,k) is the multiplier of the row that ends up at position i. Interleaving the swaps with the forward updates – swap b[k], then update b[i] with LU(i,k) – pairs the row identity at step k with a final-order multiplier whenever a later step moves that row, and silently returns a wrong solution. It does so without any warning sign: the factorization still satisfies LU = PA and the pivots are all healthy. The failure needs a pivot sequence that moves an already-eliminated row, which diagonally dominant matrices rarely produce, so it hides until a generator with a small leading diagonal is solved.

Definition at line 94 of file lu.h.

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

Referenced by line::aoi::aoi_lst_ph(), line::mc::ctmc_solve_reducible_blkdecomp(), line::mc::ctmc_stochcomp(), line::lang::dmap_refresh_moments(), line::infer::infer_lqn_ekf(), inverse(), lu_solve(), ode_rosenbrock4(), line::pfqn::pfqn_comomrm_orig(), line::api::lqn::ph_moments(), line::retrieval::retrieval_fpi_latency(), solve(), and line::SylvesterFactor< T >::solve_sylvester().

◆ lyap_schur()

Matrix< double > line::lyap_schur ( const Matrix< double > & A,
const Matrix< double > & B,
const Matrix< double > & C )
inline

MATLAB lyap(A,B,C) at double via Bartels-Stewart: A X + X B + C = 0.

Definition at line 200 of file sylvester.h.

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

Referenced by line::fj::fj_compute_pi(), line::fj::fj_compute_t(), and lyap_schur().

◆ lyap_solve()

template<class T>
Matrix< T > line::lyap_solve ( const Matrix< T > & A,
const Matrix< T > & B,
const Matrix< T > & C )

MATLAB lyap(A,B,C) solves A X + X B + C = 0, i.e.

sylvester_solve(A, B, -C).

Definition at line 123 of file sylvester.h.

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

Referenced by line::cache::cache_rmf_lna(), lyap_solve(), and line::mam::map_optim_dist().

◆ matmul()

template<class T>
Matrix< T > line::matmul ( const Matrix< T > & A,
const Matrix< T > & B )

Matrix product A B.

Definition at line 36 of file linalg.h.

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

Referenced by line::cache::cache_lrum_map_levelstats(), line::cache::cache_miss_rmf(), line::mam::dmap_exp_mul_int(), line::mam::dmap_geo_mul_sum(), expm(), line::fj::fj_compute_pi(), line::fj::fj_compute_t(), line::fj::fj_compute_t_nare(), line::fluid::fluid_eliminate_immediate(), line::fluid::fluid_lyapunov(), line::fluid::fluid_refine_meanfield(), line::smc::gim1_pi_etaqa(), line::smc::gim1_qlen_etaqa(), line::mam::ldqbd_pi(), line::mam::ldqbd_R(), line::mam::mam_bgchain_station(), line::mam::mam_transient2(), line::mam::mam_transient2_open(), line::mam::map_acfc(), line::mam::map_compute_R(), line::mam::map_compute_R_quadratic(), line::mam::map_compute_R_residual(), line::mam::map_embedded(), line::mam::map_exp_mul_int(), line::mam::map_geo_mul_sum(), line::mam::map_isfeasible(), line::mam::map_joint(), line::mam::map_stochcomp(), line::mam::map_varcount(), matmul(), matpow(), line::mam::mfq_fluflu_sojourn(), line::mam::mfq_fundamental(), line::mam::mfq_general_solve(), line::mam::mfq_ld_solve(), line::mam::mfq_multiregime(), line::mam::mfq_prio_queue(), line::mam::mfq_sojourn(), line::smc::mg1_cr(), line::smc::mg1_eg(), line::smc::mg1_fi(), line::smc::mg1_pi_etaqa(), line::mam::mmap3k_fit(), line::mam::mmap_pie(), line::mam::mmapph1fcfs_ncdistr(), line::mam::mmapph1fcfs_ncmean(), line::npfqn::npfqn_bnd_bpt(), line::npfqn::npfqn_traffic_rqt(), line::fluid::petri::petri_jacobian(), line::pfqn::pfqn_procomom2(), line::mam::ph2hyper(), line::mam::qbd_fundmat(), line::mam::qbd_fundmat_laplace(), line::mam::qbd_G_residual(), line::mam::qbd_mapmap1(), line::mam::qbd_pi(), line::mam::qbd_qlen_factmoment(), line::mam::qbd_R(), line::mam::qbd_R_logred(), line::mam::qbd_R_residual(), line::mam::qbd_rap(), line::mam::qbd_rg(), line::qsys::qsys_bmapm1(), line::qsys::qsys_dmc(), line::qsys::qsys_mapd1(), line::qsys::qsys_mapdc(), line::qsys::qsys_mapg1k(), line::qsys::qsys_mapmc(), line::qsys::qsys_mapphc(), line::qsys::qsys_mmapgk1(), line::qsys::qsys_phmc(), line::ba::solver_ba_bpt(), line::ba::solver_ba_snc_envelopes(), line::mva::solver_rqna(), and sylvester_schur().

◆ matpow()

◆ matrix_from()

template<class T, class S>
Matrix< T > line::matrix_from ( const MatrixView< S > & v)

Deep copy of a view into an owning matrix, converting the element type.

Definition at line 130 of file matrix.h.

References line::MatrixView< T >::cols(), matrix_from(), and line::MatrixView< T >::rows().

Referenced by matrix_from().

◆ matrix_rank()

std::size_t line::matrix_rank ( const Matrix< double > & A)
inline

Numerical rank at the standard max(m,n) eps sigma_1 threshold.

Definition at line 329 of file eig.h.

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

Referenced by matrix_rank(), line::smc::mg1_eg(), and line::smc::mg1_pi_etaqa().

◆ multichoose()

double line::multichoose ( int n,
int k )
inline

Number of multisets of size k from n types, i.e.

C(n+k-1, k).

Definition at line 79 of file population.h.

References multichoose(), and nck().

Referenced by multichoose().

◆ mulvec()

◆ nck()

double line::nck ( int n,
int k )
inline

Binomial coefficient with a thread-local memo table (mp_pfqn util/nck.c).

Definition at line 69 of file population.h.

References nck().

Referenced by multichoose(), nck(), line::pfqn::pfqn_cub_evals(), and line::pfqn::pfqn_nc().

◆ nelder_mead() [1/2]

template<class T, class F>
NelderMeadResult< T > line::nelder_mead ( F f,
const std::vector< T > & x0 )

nelder_mead with the default tuning.

Definition at line 356 of file neldermead.h.

References nelder_mead(), and nelder_mead_defaults().

◆ nelder_mead() [2/2]

template<class T, class F>
NelderMeadResult< T > line::nelder_mead ( F f,
const std::vector< T > & x0,
const NelderMeadOptions< T > & opt )

Unconstrained simplex minimization.

Parameters
fobjective, x -> T
x0starting point, which becomes vertex 0 of the simplex
opttuning

Definition at line 224 of file neldermead.h.

References line::NelderMeadResult< T >::converged, line::NelderMeadResult< T >::evaluations, line::NelderMeadResult< T >::fval, line::InputError::InputError(), line::NelderMeadResult< T >::iterations, nelder_mead(), num_abs(), and line::NelderMeadResult< T >::x.

Referenced by nelder_mead(), nelder_mead(), and nelder_mead_box().

◆ nelder_mead_box() [1/2]

template<class T, class F>
NelderMeadResult< T > line::nelder_mead_box ( F f,
const std::vector< T > & x0,
const std::vector< Bound< T > > & bounds )

nelder_mead_box with the default tuning.

Definition at line 428 of file neldermead.h.

References nelder_mead_box(), and nelder_mead_defaults().

◆ nelder_mead_box() [2/2]

template<class T, class F>
NelderMeadResult< T > line::nelder_mead_box ( F f,
const std::vector< T > & x0,
const std::vector< Bound< T > > & bounds,
const NelderMeadOptions< T > & opt )

Box-constrained simplex minimization by the transformation described in the header comment.

Every point at which f is evaluated satisfies the bounds.

Parameters
fobjective, x -> T, called only at feasible x
x0starting point, clamped into the box if it is outside
boundsone Bound per variable
opttuning

Definition at line 370 of file neldermead.h.

References line::NelderMeadResult< T >::converged, line::NelderMeadResult< T >::evaluations, line::NelderMeadResult< T >::fval, line::InputError::InputError(), line::NelderMeadResult< T >::iterations, nelder_mead(), nelder_mead_box(), and line::NelderMeadResult< T >::x.

Referenced by line::mam::amap2_adjust_gamma(), auglag(), line::api::infer_fmlps(), line::api::infer_mlps(), nelder_mead_box(), and nelder_mead_box().

◆ nelder_mead_defaults()

◆ next_pop()

bool line::next_pop ( std::vector< int > & n,
const std::vector< int > & N )
inline

◆ num_abs()

template<class T>
T line::num_abs ( const T & v)
inline

Definition at line 172 of file number.h.

References num_abs().

Referenced by line::mam::amap2_adjust_gamma(), line::mam::amap2_fit_gamma(), line::mam::amap2_fitall_gamma(), line::mam::aph2_fitall(), line::mam::aph_fit(), line::cache::cache_lrum_map_levelstats(), line::cache::cache_miss_asy(), line::cache::cache_mva_miss(), line::cache::cache_prob_erec(), line::cache::cache_prob_spm(), line::cache::cache_spm(), line::cache::cache_t_lrum_map(), line::cache::cache_ttl_lrua(), line::cache::cache_xi_fp(), line::cache::cache_xi_iter(), line::wf::calculate_branch_diversity(), line::mc::ctmc_foxglynn(), line::mc::ctmc_isfeasible(), line::mc::ctmc_maxabs(), line::mc::ctmc_saddlepoint(), line::mc::ctmc_solve_reducible_blkdecomp(), line::lang::processes::default_uniformization_rate(), line::wf::detect_branches(), line::mam::dmap_isfeasible(), line::env::env_ctmc_decompose(), line::fes::fes_build_isolated(), line::fj::fj_tail_forktail(), line::pfqn::grnmol(), line::mam::hyperexp_fit_longtail_k(), line::infer::infer_gibbs(), line::infer::infer_lqn(), line::infer::infer_lqn_jacobian(), line::pfqn::laplaceapprox(), levmar_jac(), levmar_jacobian_fd(), line::mam::m3pp22_fitc_approx_cov(), line::mam::m3pp22_fitc_approx_cov_multiclass(), line::mam::m3pp2m_fitc(), line::mam::m3pp2m_fitc_approx(), line::mam::m3pp2m_fitc_approx_ag(), line::mam::m3pp2m_fitc_approx_ag_multiclass(), line::mam::mamap22_fit_bs_multiclass(), line::mam::mamap22_fit_fs_multiclass(), line::mam::mamap2m_fit_fb_multiclass(), line::mam::map2_fit(), line::mam::map2mmpp(), line::mam::map_compute_R(), line::mam::map_compute_R_quadratic(), line::mam::map_compute_R_residual(), line::mam::map_gamma_full(), line::mam::map_isfeasible(), line::mam::map_m1ps_cdfrespt(), line::mam::map_m1ps_h_recursive(), line::mam::map_m1ps_sojourn(), line::mam::map_mmpp2(), line::mam::maph2m_fit_multiclass(), line::me::me_cqn(), line::me::me_oqn(), line::mam::mfq_general_solve(), line::mam::mfq_ld_solve(), line::mam::mmap2k_fit(), line::mam::mmap_isfeasible_tol(), line::mam::mmdp_isfeasible(), line::mam::mmpp2_fitc(), nelder_mead(), line::npfqn::npfqn_feedback_elim(), num_abs(), num_abs< double >(), ode_numeric_jacobian(), ode_rosenbrock4(), line::pivot_mag< T >::of(), line::pfqn::pfqn_bk(), line::pfqn::pfqn_lap(), line::pfqn::pfqn_ldbcmp(), line::pfqn::pfqn_le_fpi(), line::pfqn::pfqn_le_fpiZ(), line::pfqn::pfqn_marie(), line::pfqn::pfqn_momlin(), line::pfqn::pfqn_mvaoi_marg(), line::pfqn::pfqn_mwrbb(), line::pfqn::pfqn_propfair(), line::pfqn::pfqn_rd(), line::pfqn::pfqn_sens_linearizer(), line::pfqn::pfqn_sens_mom(), line::pfqn::pfqn_sens_mva(), line::pfqn::pfqn_sens_mvaldmx(), line::mam::ph2hyper(), line::mam::qbd_depproc_residual(), line::mam::qbd_R_logred(), line::qsys::qsys_gg1(), line::qsys::qsys_ggnm_diffusion(), line::qsys::qsys_gig1_approx_myskja2(), line::qsys::qsys_gigk_approx_whitt(), line::qsys::qsys_hh1_lindley(), line::qsys::qsys_mapd1(), line::qsys::qsys_mapdc(), line::qsys::qsys_mapg1k(), line::qsys::qsys_mg1_fb(), line::qsys::qsys_mg1_lrpt(), line::qsys::qsys_mg1_psjf(), line::qsys::qsys_mm1_dps(), line::qsys::qsys_mm1_tandem_lindley(), line::qsys::qsys_mmcc_retrial_fp(), line::qsys::qsys_phmc(), root_brent(), root_newton(), rref(), line::sim::sim_asymvar_ctmc(), line::sim::sim_quest_heuristic_ci(), line::sim::sim_runlength(), line::mam::solver_mam_basic(), line::mam::solver_mna_closed(), line::mva::solver_mva_cache_analyzer(), line::sum::sum_closed(), line::trace::trace_summary(), and line::wf::validate_branch_pattern().

◆ num_abs< double >()

template<>
double line::num_abs< double > ( const double & v)
inline

Definition at line 178 of file number.h.

References num_abs().

◆ num_factorial()

template<class T>
T line::num_factorial ( unsigned n)
inline

◆ num_from_decimal()

template<class T>
T line::num_from_decimal ( const std::string & s)

Parse a decimal literal into T.

Rational reconstructs num/10^k from the digits; every other backend uses strtod, matching what MATLAB's str2double and Java's Double.parseDouble do.

Definition at line 110 of file decimal.h.

References num_from_decimal().

Referenced by num_from_decimal(), num_from_decimal< Rational >(), and line::lqn::read_lqnx_model().

◆ num_from_decimal< Rational >()

template<>
Rational line::num_from_decimal< Rational > ( const std::string & s)
inline

Definition at line 115 of file decimal.h.

References num_from_decimal(), and rational_from_decimal().

◆ num_nck()

template<class T>
T line::num_nck ( int n,
int k )

◆ num_pow_int()

template<class T>
T line::num_pow_int ( const T & base,
unsigned e )
inline

Integer power, valid in any field (no transcendental requirement).

Definition at line 192 of file number.h.

References num_pow_int().

Referenced by line::aoi::aoi_lcfss_mgi1(), line::aoi::aoi_lst_erlang(), line::cache::cache_mva_miss(), line::cache::cache_spm(), line::dqsys::dqsys_geogeo1_pmf(), line::fj::fj_char_max(), line::fj::fj_order_stat(), line::fj::fj_respt_vm(), line::fj::fj_rmax_erlang(), line::fj::fj_xmax_erlang(), line::fj::fj_xmax_hyperexp(), line::fj::fj_xmax_pareto(), line::pfqn::grnmol(), line::pfqn::laplaceapprox(), line::lossn::lossn_erlangfp(), line::me::me_gegecn_pb(), line::moment::moment_central_from_raw(), line::moment::moment_joint_central_from_raw_mean(), line::moment::moment_joint_marking(), line::moment::moment_joint_raw_from_central(), line::moment::moment_raw_from_central(), line::trace::mtrace_cross_moment(), line::trace::mtrace_joint(), line::trace::mtrace_moment(), line::trace::mtrace_summary(), line::npfqn::npfqn_nonexp_approx(), num_pow_int(), line::pfqn::pfqn_comom(), line::pfqn::pfqn_comomrm_orig(), line::pfqn::pfqn_cub(), line::pfqn::pfqn_gerasimov(), line::pfqn::pfqn_gld(), line::pfqn::pfqn_grnmol(), line::pfqn::pfqn_joint(), line::pfqn::pfqn_lcfsqn_ca(), line::pfqn::pfqn_lcfsqn_mva(), line::pfqn::pfqn_lcfsqn_nc(), line::pfqn::pfqn_ldbcmp(), line::pfqn::pfqn_ldmx_ec(), line::pfqn::pfqn_mmint2(), line::pfqn::pfqn_nc(), line::pfqn::pfqn_nc_sanitize(), line::pfqn::pfqn_ncld(), line::pfqn::pfqn_ncoi(), line::pfqn::pfqn_qzgblow(), line::pfqn::pfqn_qzgbup(), line::pfqn::pfqn_schmidt_ext(), line::pfqn::pfqn_sens_ldmx_ec(), line::pfqn::pfqn_sens_respt(), line::pfqn::pfqn_sib(), line::qsys::qsys_gig1_approx_allencunneen(), line::qsys::qsys_gig1_approx_gelenbe(), line::qsys::qsys_gig1_approx_heyman(), line::qsys::qsys_gig1_approx_kimura(), line::qsys::qsys_gig1_approx_klb(), line::qsys::qsys_gig1_approx_kobayashi(), line::qsys::qsys_gig1_approx_marchal(), line::qsys::qsys_gig1_approx_myskja2(), line::qsys::qsys_gig1_ubnd_kingman(), line::qsys::qsys_gigk_approx(), line::qsys::qsys_gigk_approx_cosmetatos(), line::qsys::qsys_gigk_approx_kingman(), line::qsys::qsys_gigk_approx_whitt(), line::qsys::qsys_lindley_moment(), line::qsys::qsys_mg1(), line::qsys::qsys_mg1k_loss(), line::qsys::qsys_mginf(), line::qsys::qsys_mm1k_loss(), line::qsys::qsys_mmck(), line::mva::solver_amvald(), line::ba::solver_ba_analyzer(), line::nc::solver_nc_lcfsqn(), line::trace::trace_gamma(), and line::trace::trace_joint().

◆ ode_numeric_jacobian()

template<class T, class F>
Matrix< T > line::ode_numeric_jacobian ( const F & f,
const T & t,
const std::vector< T > & y,
const std::vector< T > & fy )

Numeric Jacobian by central differences.

The increment is eps^(1/3) scaled by the magnitude of the component, which is the standard balance for a central difference: the truncation error is O(delta^2) and the cancellation error O(eps/delta), and the two meet at delta ~ eps^(1/3), giving about two thirds of the digits of T. A one-sided difference would cost one fewer evaluation per column and half the digits; the extra accuracy matters here because the Jacobian of a stiff problem is what the whole stability of the step rests on.

Definition at line 263 of file ode.h.

References line::InputError::InputError(), num_abs(), and ode_numeric_jacobian().

Referenced by ode_numeric_jacobian(), and ode_rosenbrock4().

◆ ode_rosenbrock4() [1/2]

template<class T, class F, class J>
OdeSolution< T > line::ode_rosenbrock4 ( const F & f,
const J & jac,
const T & t0,
const T & t1,
const std::vector< T > & y0,
const OdeOptions< T > & opt )

Integrate y' = f(t,y) from t0 to t1 with an analytic Jacobian.

Parameters
fright-hand side, std::vector<T> f(const T& t, const std::vector<T>& y)
jacJacobian, Matrix<T> jac(const T& t, const std::vector<T>& y)
t0initial time
t1final time; t1 > t0 is required (this is an initial value problem marched forwards, and a backwards request is an input error rather than a silently reversed integration)
y0initial state
opttolerances and step bounds

Definition at line 304 of file ode.h.

References line::Matrix< T >::cols(), line::OdeSolution< T >::f_evals, line::InputError::InputError(), line::OdeSolution< T >::jacobians, lu_factor(), lu_solve(), num_abs(), line::NumericError::NumericError(), ode_rosenbrock4(), line::OdeSolution< T >::rejected, line::Matrix< T >::rows(), line::OdeSolution< T >::steps, line::OdeSolution< T >::t, and line::OdeSolution< T >::y.

Referenced by line::cache::cache_miss_rmf_transient(), line::cache::cache_rrm_meanfield(), line::fluid::fluid_ode_solve_stiff(), ode_rosenbrock4(), ode_rosenbrock4(), ode_rosenbrock4_endpoint(), and line::fluid::petri::solver_fluid_petri().

◆ ode_rosenbrock4() [2/2]

template<class T, class F>
OdeSolution< T > line::ode_rosenbrock4 ( const F & f,
const T & t0,
const T & t1,
const std::vector< T > & y0,
const OdeOptions< T > & opt )

Integrate y' = f(t,y) with a numeric Jacobian by central differences.

Definition at line 484 of file ode.h.

References ode_numeric_jacobian(), and ode_rosenbrock4().

◆ ode_rosenbrock4_endpoint()

template<class T, class F>
std::vector< T > line::ode_rosenbrock4_endpoint ( const F & f,
const T & t0,
const T & t1,
const std::vector< T > & y0 )

Integrate with the default options and return only the state at t1.

Definition at line 496 of file ode.h.

References ode_rosenbrock4(), and ode_rosenbrock4_endpoint().

Referenced by line::mam::map_pntquad(), and ode_rosenbrock4_endpoint().

◆ ones()

◆ pinv()

Matrix< double > line::pinv ( const Matrix< double > & A)
inline

Moore-Penrose pseudo-inverse, A^+ = V diag(1/s_i) U^T over the singular values above max(m,n) eps sigma_1, which is MATLAB's default pinv tolerance.

Definition at line 93 of file svd.h.

References line::Matrix< T >::cols(), pinv(), line::Matrix< T >::rows(), line::SvdFactors::s, svd_full(), line::SvdFactors::U, and line::SvdFactors::Vt.

Referenced by pinv(), and line::api::sn_pn_firing_rates().

◆ plane_sizes()

◆ pop_index()

std::size_t line::pop_index ( const std::vector< int > & n,
const std::vector< std::size_t > & prods )
inline

◆ population_count()

◆ rational_from_decimal()

Rational line::rational_from_decimal ( const std::string & s)
inline

The literal as an exact rational, num/10^k with no rounding.

Definition at line 84 of file decimal.h.

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

Referenced by num_from_decimal< Rational >(), and rational_from_decimal().

◆ root_bisect()

template<class T, class F>
RootResult< T > line::root_bisect ( F f,
const T & a,
const T & b,
const T & tol,
unsigned maxiter = 200 )

Bisection on a bracket with a sign change.

Parameters
fcallable T -> T
a,bbracket endpoints, in either order
tolabsolute width of the final bracket
maxiteriteration cap
Exceptions
InputErrorif f(a) and f(b) have the same sign and neither is a root

Definition at line 70 of file rootfind.h.

References line::RootResult< T >::bracket_width, line::RootResult< T >::converged, line::InputError::InputError(), line::RootResult< T >::iterations, line::RootResult< T >::root, root_bisect(), and line::RootResult< T >::value.

Referenced by line::cache::cache_t_lrum_map(), line::cache::cache_ttl_lrua(), and root_bisect().

◆ root_brent()

template<class T, class F>
RootResult< T > line::root_brent ( F f,
const T & a0,
const T & b0,
const T & tol,
unsigned maxiter = 200 )

Brent's method on a bracket with a sign change.

Falls back to bisection whenever the interpolated step is not a strict improvement, so the bracket is never lost.

Definition at line 130 of file rootfind.h.

References line::RootResult< T >::bracket_width, line::RootResult< T >::converged, line::InputError::InputError(), line::RootResult< T >::iterations, num_abs(), line::RootResult< T >::root, root_brent(), and line::RootResult< T >::value.

Referenced by line::fj::fj_tail_forktail(), line::fj::fj_tail_ordstat(), line::qsys::qsys_tandem_ub_ciucu(), root_brent(), and line::mva::solver_mva_qsys_analyzer().

◆ root_newton()

template<class T, class F, class DF>
RootResult< T > line::root_newton ( F f,
DF df,
const T & x0,
const T & tol,
unsigned maxiter = 200 )

Plain Newton from a starting point.

The only method here that can find a root of even multiplicity, where f does not change sign and no bracket exists; convergence is then linear rather than quadratic.

Parameters
fcallable T -> T
dfcallable T -> T, the derivative
x0starting point of the iteration
tolconvergence tolerance on the Newton step
maxiteriteration cap (default 200)
Exceptions
NumericErrorif the derivative vanishes at an iterate

Definition at line 247 of file rootfind.h.

References line::RootResult< T >::bracket_width, line::RootResult< T >::converged, line::RootResult< T >::iterations, num_abs(), line::NumericError::NumericError(), line::RootResult< T >::root, root_newton(), and line::RootResult< T >::value.

Referenced by root_newton().

◆ root_newton_safe()

template<class T, class F, class DF>
RootResult< T > line::root_newton_safe ( F f,
DF df,
const T & a0,
const T & b0,
const T & tol,
unsigned maxiter = 200 )

Newton safeguarded by a bracket with a sign change: the Newton step is used only when it stays inside the bracket and at least halves it, otherwise the step is a bisection.

Never diverges and never leaves the bracket.

Definition at line 285 of file rootfind.h.

References line::RootResult< T >::bracket_width, line::RootResult< T >::converged, line::InputError::InputError(), line::RootResult< T >::iterations, line::RootResult< T >::root, root_newton_safe(), and line::RootResult< T >::value.

Referenced by root_newton_safe().

◆ rref()

template<class T>
std::vector< std::size_t > line::rref ( Matrix< T > & A,
const T & tol )

Reduced row echelon form of A, in place, returning the pivot columns.

Rows beyond the returned rank are identically zero.

Definition at line 110 of file lstsq.h.

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

Referenced by lstsq(), rref(), and line::spn::spn_pf().

◆ schur_decomposition()

RealSchur line::schur_decomposition ( const Matrix< double > & A)
inline

Real Schur factorization of a general square matrix (LAPACK dgees, unsorted).

The Schur form is the right basis for splitting a spectrum into invariant subspaces, which is what a multi-regime fluid queue needs: the eigenvector basis exists only for a diagonalizable matrix and is complex whenever the spectrum is, while Z is orthogonal and real for every real A.

Definition at line 182 of file eig.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::NumericError::NumericError(), line::Matrix< T >::rows(), schur_decomposition(), line::RealSchur::T, line::UnsupportedError::UnsupportedError(), and line::RealSchur::Z.

Referenced by line::fluid::aoi_solve_singlebuffer(), line::fj::fj_compute_t_nare(), line::mam::mfq_multiregime(), schur_decomposition(), and sylvester_schur().

◆ schur_reorder()

RealSchur line::schur_reorder ( const RealSchur & s,
const std::vector< double > & key )
inline

Reorder the diagonal blocks of a real Schur form into DESCENDING key order, stably, updating Z so that A = Z T Z^T still holds.

This is MATLAB's ordschur with a CLUSTER-NUMBER select vector, whose documented behaviour is that clusters appear in descending order of the cluster number. The key is given per diagonal ENTRY; for a 2 x 2 block the key of its first row is used and the second is ignored, which is the same requirement MATLAB imposes (a select vector must be constant on a block, and a caller that splits one is asking for a factorization that does not exist over the reals).

WHY dtrexc AND NOT dtrsen. dtrsen splits a spectrum into TWO clusters, the selected one and the rest, so an ordering into three or more classes needs it applied recursively to trailing submatrices, with the accumulated Q and the shifting block boundaries tracked by hand at every level. dtrexc moves ONE diagonal block from position ifst to position ilst and updates Q itself, so an arbitrary key ordering is a stable selection sort over blocks with no submatrix bookkeeping at all. It also refuses to split a 2 x 2 block rather than silently producing a complex pair astride a boundary, which is the failure that would otherwise be discovered downstream as a complex "real" subspace.

Parameters
sa real Schur factorization, typically from schur_decomposition
keyone value per diagonal entry; blocks are sorted descending by it

Definition at line 248 of file eig.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::NumericError::NumericError(), line::Matrix< T >::rows(), schur_reorder(), line::RealSchur::T, line::UnsupportedError::UnsupportedError(), and line::RealSchur::Z.

Referenced by line::fluid::aoi_solve_singlebuffer(), line::fj::fj_compute_t_nare(), line::mam::mfq_multiregime(), and schur_reorder().

◆ serial_routing() [1/2]

void line::serial_routing ( Routing & P,
std::size_t r,
const std::vector< std::size_t > & nodes )
inline

Network.serialRouting(nodes) on one class of a model.

Definition at line 292 of file nodes.h.

References serial_routing().

◆ serial_routing() [2/2]

void line::serial_routing ( Routing & P,
std::size_t r,
std::size_t s,
const std::vector< std::size_t > & nodes )
inline

Network.serialRouting(nodes) for one class pair: 1 -> 2 -> ... -> n.

Definition at line 286 of file nodes.h.

References serial_routing(), and line::qn::RoutingMatrix< T >::set().

Referenced by cyclic_routing(), serial_routing(), and serial_routing().

◆ solve()

template<class T>
std::vector< T > line::solve ( const Matrix< T > & A,
const std::vector< T > & b )

◆ spectral_radius()

double line::spectral_radius ( const Matrix< double > & A)
inline

Largest modulus over the spectrum, i.e.

the spectral radius.

Definition at line 97 of file eig.h.

References eig_values(), and spectral_radius().

Referenced by line::mam::qbd_rap(), and spectral_radius().

◆ subdominant_modulus()

double line::subdominant_modulus ( const Matrix< double > & A)
inline

Second largest modulus over the spectrum.

This is the quantity the NCD machinery needs (ctmc_courtois's epsMAX is built from the subdominant eigenvalue of each diagonal block); returns 0 when the matrix is 1 x 1.

Definition at line 111 of file eig.h.

References eig_values(), and subdominant_modulus().

Referenced by subdominant_modulus().

◆ svd_full()

◆ svd_values()

std::vector< double > line::svd_values ( const Matrix< double > & A)
inline

◆ sylvester_schur()

Matrix< double > line::sylvester_schur ( const Matrix< double > & A,
const Matrix< double > & B,
const Matrix< double > & C )
inline

A X + X B = C by Bartels-Stewart, at double.

WHY THIS EXISTS BESIDE THE KRONECKER SOLVER ABOVE. The Kronecker form is the only one available in an arbitrary field, and its O((n m)^3) cost is acceptable for the phase-space matrices the MMAP queue recursion passes. The FJ_codes fork-join engine passes matrices of order (C + 1) * m^2 * ma with C defaulting to 100, i.e. n and m in the hundreds to low thousands: the Kronecker operator of an 800 x 800 pair is 640000 square, which is 3 TB of LU. Bartels-Stewart is O(n^3 + m^3) and factorizes the same problem in fractions of a second, at the price of a real Schur factorization – LAPACK, hence double only, exactly as util/eig.h is.

A X + X B = C is solved as Ta Y + Y Tb = Za' C Zb with A = Za Ta Za' and B = Zb Tb Zb' real Schur, the quasi-triangular core done by dtrsyl, and X = Za Y Zb'. dtrsyl's scale guards against overflow when the two spectra nearly collide; it is divided out here, and a scale of zero means the equation has no solution, which is reported by name rather than returned as an infinity.

Definition at line 149 of file sylvester.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), matmul(), line::NumericError::NumericError(), line::Matrix< T >::rows(), schur_decomposition(), sylvester_schur(), line::RealSchur::T, line::Matrix< T >::transpose(), line::UnsupportedError::UnsupportedError(), and line::RealSchur::Z.

Referenced by line::fj::fj_compute_pi(), lyap_schur(), and sylvester_schur().

◆ sylvester_solve()

template<class T>
Matrix< T > line::sylvester_solve ( const Matrix< T > & A,
const Matrix< T > & B,
const Matrix< T > & C )

Solve A X + X B = C for X.

Parameters
An x n
Bm x m
Cn x m

Definition at line 115 of file sylvester.h.

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

Referenced by line::fluid::fluid_lyapunov(), and sylvester_solve().

◆ vecmul()

template<class T>
std::vector< T > line::vecmul ( const std::vector< T > & v,
const Matrix< T > & A )

Row vector times matrix, v A.

Definition at line 50 of file linalg.h.

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

Referenced by line::cache::cache_lrum_map_levelstats(), line::mam::dmap_exp_mul_int(), line::mam::dmap_geo_mul_sum(), line::mam::dmap_moment(), line::fes::fes_map_euler(), line::fes::fes_map_moments(), line::fes::fes_map_solve(), line::fj::fj_compute_pi(), line::fj::fj_return_per(), line::fj::fj_return_rt2(), line::mam::ldqbd_pi(), line::mam::map_acf(), line::mam::map_acfc(), line::mam::map_ccdf_derivative(), line::mam::map_cdf(), line::mam::map_count_var(), line::mam::map_geo_mul_sum(), line::mam::map_idc(), line::mam::map_joint(), line::mam::map_jointpdf_derivative(), line::mam::map_lambda(), line::mam::map_m1ps_cdfrespt(), line::mam::map_m1ps_sojourn(), line::mam::map_moment(), line::mam::map_pdf(), line::mam::map_pie(), line::mam::map_varcount(), line::mam::mfq_fluflu_sojourn(), line::mam::mfq_general_solve(), line::mam::mfq_ld_distr(), line::mam::mfq_ld_mean(), line::mam::mfq_multiregime(), line::mam::mfq_prio_queue(), line::mam::mfq_sojourn(), line::mam::mmap_backward_moment(), line::mam::mmap_count_lambda(), line::mam::mmap_count_var(), line::mam::mmap_cross_moment(), line::mam::mmap_forward_moment(), line::mam::mmap_pc(), line::mam::mmap_sigma(), line::mam::mmap_sigma2(), line::mam::mmapph1fcfs_ncmean(), line::mam::mmapph1fcfs_stdistr_ph(), line::mam::qbd_depproc_jointmom(), line::mam::qbd_pi(), line::mam::qbd_qlen_factmoment(), line::mam::qbd_rap(), line::mam::qbd_raprap1(), line::qsys::qsys_bmapm1(), line::qsys::qsys_mapd1(), line::qsys::qsys_mapdc(), line::qsys::qsys_mapg1k(), line::qsys::qsys_mapmc(), line::smc::rowvec_times(), line::ag::solver_ag(), line::mam::solver_mam_ldqbd_transient(), and vecmul().