-
Notifications
You must be signed in to change notification settings - Fork 0
/
causet_get_links.m
31 lines (29 loc) · 1.13 KB
/
causet_get_links.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function L = causet_get_links( C )
%CAUSET_GET_LINKS converts the causals matrix into a links matrix.
%
% Arguments:
% C upper triangular (logical) causals matrix.
%
% Returns:
% L upper triangular (logical) links matrix.
%
% Copyright 2021, C. Minz. BSD 3-Clause License.
if ~islogical( C )
C = logical( C ); % only for backwards compatibility,
% causal and link matrixes are now always logical
end
N = size( C, 1 );
L = false( N );
for i = 1 : N
% Selector for the i-th future light cone:
causalsel = C( i, : );
% Vector of the causal connection count TO each event in the
% future light cone FROM any other event in the cone:
connections = sum( C( causalsel, : ), 1 );
% If such a number is greater than 1, then the respective event
% is not linked because there is a longer path to it. Linked are
% only those events that do not have any connection by other
% events in the future light cone:
L( i, : ) = causalsel & ( connections == 0 );
end
end