-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdist_L1between.m
36 lines (33 loc) · 1.09 KB
/
dist_L1between.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
32
33
34
35
36
function dist = dist_L1betweeen(x, y)
% dist = dist_L1betweeen(x, y)
% Compute the sum of pairwise L_1 distance between vectorized
% networks x and y.
%
% dist is similar to the between-group loss defined in Songdechakraiwut,
% T., Shen, L., Chung, M.K. 2021 Topological learning and its application
% to multimodal brain network integration, MICCAI, 12902:166-176
% https://pages.stat.wisc.edu/~mchung/papers/song.2021.MICCAI.pdf
%
%
% INPUT
% x: a matrix of vectorized networks in group1: nGroup1 x nEdges
% y: a matrix of vectorized networks in group2: nGroup2 x nEdges
%
% OUTPUT:
% dist: the distance between the networks in the groups
%
%
% (C) 2022 Zijian Chen, Sixtus Dakurah, Moo K. Chung
% University of Wisconsin-Madison
%
% Contact [email protected]
% for any inquary about the code. The code is downloaded from
% https://github.com/laplcebeltrami/hodge
z = [x; y];
m = size(z, 1);
vec=[];
for jj = 1:size(x,1)
diff_jj = z(jj, :)-z(size(x,1)+1:m,:);
vec = [vec;vecnorm(diff_jj,1,2)]; %if vecnorm(diff_jj,2,2), we get L2-distance
end
dist = sum(vec);