LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
map_normalize.m
1function MAP=map_normalize(MAP)
2% MAPOUT=map_normalize(MAPIN) - Try to make a MAP feasible
3%
4% Input:
5% MAPIN: a MAP in the form of {D0,D1}
6%
7% Output:
8% MAPOUT: MAPIN with D0 normalized to make D0+D1 an infinitesimal
9% generator, with all negative entries set to zero, and with complex
10% values set equal to their norm
11%
12% Examples:
13% - map_normalize({[0,0;0,0],[1,2;3,4]}) produces a valid MAP
14%
15
16for i=1:size(MAP{1},1)
17 for j=1:size(MAP{1},1)
18 MAP{1}(i,j)=real(MAP{1}(i,j));
19 MAP{2}(i,j)=real(MAP{2}(i,j));
20 end
21end
22for b=1:length(MAP)
23 MAP{b}(MAP{b}<0)=0;
24end
25for n=1:size(MAP{1},1)
26 MAP{1}(n,n)=0;
27 for b=1:length(MAP)
28 MAP{1}(n,n)=MAP{1}(n,n)-sum(MAP{b}(n,:));
29 end
30end
31end