1%{ @file dtmc_stochcomp.m
2 % @brief Computes the stochastic complement of a DTMC partition
4 % @author LINE Development Team
8 % @brief Computes the stochastic complement of a DTMC partition
11 % Performs stochastic complementation on a partitioned DTMC.
15 % S = dtmc_stochcomp(
P)
16 % [S, P11, P12, P21, P22] = dtmc_stochcomp(
P, I)
21 % <tr><th>Name<th>Description
22 % <tr><td>
P<td>Stochastic transition matrix
23 % <tr><td>I<td>(Optional) Vector of indices representing the subset of states to retain
28 % <tr><th>Name<th>Description
29 % <tr><td>S<td>Stochastic complement matrix
for the subset I
30 % <tr><td>P11<td>Submatrix corresponding to transition within I
31 % <tr><td>P12<td>Submatrix corresponding to transitions from I to complement of I
32 % <tr><td>P21<td>Submatrix corresponding to transitions from complement of I to I
33 % <tr><td>P22<td>Submatrix corresponding to transitions within complement of I
36function [S,P11,P12,P21,P22]=dtmc_stochcomp(
P,I)
38 I=1:ceil(length(
P)/2);
41Ic = Iall(~ismember(Iall,I)); % slightly faster than setdiff
42sparsity = nnz(
P)/prod(size(
P));
49 S2 = sparse(eye(size(P22))-P22);
57 S2 = eye(size(P22))-P22;