Class DTMCKt
-
- All Implemented Interfaces:
public final class DTMCKt
-
-
Method Summary
Modifier and Type Method Description final static Matrixdtmc_makestochastic(Matrix P)Normalizes a matrix to be a valid stochastic matrix. final static Integerdtmc_isfeasible(Matrix P)Checks feasibility of a stochastic matrix. final static DoubleArraydtmc_solve(Matrix P)Computes the equilibrium distribution of a discrete-time Markov chain. final static Matrixdtmc_rand(Integer n)Generates a random stochastic transition matrix. final static IntArraydtmc_simulate(Matrix P, DoubleArray pi0, Integer nSteps)Simulates a trajectory of a discrete-time Markov chain. final static Matrixdtmc_stochcomp(Matrix P, IntArray I)Computes the stochastic complement of a DTMC partition. final static Matrixdtmc_timereverse(Matrix P)Computes the time-reversed transition matrix of a DTMC. final static Pair<DoubleArray, Integer>dtmc_uniformization(DoubleArray pi0, Matrix P, Double t, Double tol, Integer maxiter)Computes transient probabilities for a DTMC using uniformization. -
-
Method Detail
-
dtmc_makestochastic
final static Matrix dtmc_makestochastic(Matrix P)
Normalizes a matrix to be a valid stochastic matrix. Rescales rows to sum to 1. Rows with zero sum get 1 at diagonal.
- Parameters:
P- Input matrix- Returns:
Valid stochastic transition matrix
-
dtmc_isfeasible
final static Integer dtmc_isfeasible(Matrix P)
Checks feasibility of a stochastic matrix. Verifies if row sums are close to 1 and elements are non-negative.
- Parameters:
P- Matrix to check- Returns:
Precision level (1-15) if feasible, or 0 if not feasible
-
dtmc_solve
final static DoubleArray dtmc_solve(Matrix P)
Computes the equilibrium distribution of a discrete-time Markov chain.
- Parameters:
P- Stochastic transition matrix- Returns:
Equilibrium distribution vector
-
dtmc_rand
final static Matrix dtmc_rand(Integer n)
Generates a random stochastic transition matrix.
- Parameters:
n- Size of the matrix (n x n)- Returns:
Random stochastic transition matrix
-
dtmc_simulate
final static IntArray dtmc_simulate(Matrix P, DoubleArray pi0, Integer nSteps)
Simulates a trajectory of a discrete-time Markov chain.
- Parameters:
P- Stochastic transition matrixpi0- Initial probability distribution vectornSteps- Number of steps to simulate- Returns:
Vector of state indices visited in the simulation (0-based)
-
dtmc_stochcomp
final static Matrix dtmc_stochcomp(Matrix P, IntArray I)
Computes the stochastic complement of a DTMC partition.
- Parameters:
P- Stochastic transition matrixI- Indices of states to retain (0-based)- Returns:
Stochastic complement matrix for the subset I
-
dtmc_timereverse
final static Matrix dtmc_timereverse(Matrix P)
Computes the time-reversed transition matrix of a DTMC.
- Parameters:
P- Stochastic transition matrix of the original process- Returns:
Stochastic transition matrix of the time-reversed process
-
dtmc_uniformization
final static Pair<DoubleArray, Integer> dtmc_uniformization(DoubleArray pi0, Matrix P, Double t, Double tol, Integer maxiter)
Computes transient probabilities for a DTMC using uniformization.
- Parameters:
pi0- Initial probability distribution vectorP- Transition probability matrixt- Time point for transient analysis (default: 1e4)tol- Error tolerance (default: 1e-12)maxiter- Maximum iterations (default: 100)- Returns:
Pair of (probability distribution at time t, number of iterations)
-
-
-
-