-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcauset_find_Aset.m
31 lines (29 loc) · 1.32 KB
/
causet_find_Aset.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 events = causet_find_Aset( C, pastevent, futureevent )
%CAUSET_FIND_ASET returns the indexes of the elements in the Alexandrov set
% between the elements with indexes PASTEVENT and FUTUREEVENT.
%
% Arguments:
% C logical upper triangular causal matrix.
% PASTEVENT index of the first event in the set.
% FUTUREEVENT index of the last event in the set.
%
% Returns:
% EVENTS list of events, which are causally between PASTEVENT
% and FUTUREEVENT. If they are not causally related the
% return is an empty row vector. Otherwise the return
% also includes PASTEVENT as well as FUTUREEVENT and
% returns only a single index if both events are the
% same.
%
% Copyright 2021, C. Minz. BSD 3-Clause License.
if futureevent == pastevent % only one element
events = pastevent;
elseif ~C( pastevent, futureevent ) % no causal relation between the events
events = zeros( 1, 0 );
else % pastevent, all elements causally between, futureevent
events = [ pastevent, ...
find( C( pastevent, 1:futureevent ) ...
& transpose( C( 1:futureevent, futureevent ) ) ), ...
futureevent ];
end
end