LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ctmc_makeinfgen.m
1%{ @file ctmc_makeinfgen.m
2 % @brief Normalizes a matrix to be a valid infinitesimal generator
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Normalizes a matrix to be a valid infinitesimal generator
9 %
10 % @details
11 % Sets diagonal elements such that row sums are zero.
12 %
13 % @par Syntax:
14 % @code
15 % Q = ctmc_makeinfgen(Q)
16 % @endcode
17 %
18 % @par Parameters:
19 % <table>
20 % <tr><th>Name<th>Description
21 % <tr><td>Q<td>Input matrix
22 % </table>
23 %
24 % @par Returns:
25 % <table>
26 % <tr><th>Name<th>Description
27 % <tr><td>Q<td>Valid infinitesimal generator matrix where rows sum to zero
28 % </table>
29%}
30function Q=ctmc_makeinfgen(Q)
31A=Q-diag(diag(Q)); Q=A-diag(sum(A,2));
32end